Skip to content

Commit 20fd5da

Browse files
authored
Merge pull request #60 from jcassidyav/fix-refreshVisibleItems-height
fix(ios): Fix refreshVisibleItems not recalculating heights
2 parents d6f6cc4 + 4ac6c57 commit 20fd5da

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/collectionview/index.ios.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,17 @@ export class CollectionView extends CollectionViewBase {
546546
if (!view) {
547547
return;
548548
}
549+
const sizes: NSMutableArray<NSValue> = this._delegate instanceof UICollectionViewDelegateImpl ? this._delegate.cachedSizes : null;
550+
549551
const visibles = view.indexPathsForVisibleItems;
552+
553+
if (sizes) {
554+
const indexes: NSIndexPath[] = Array.from(visibles);
555+
indexes.forEach((value) => {
556+
sizes.replaceObjectAtIndexWithObject(value.row, NSValue.valueWithCGSize(CGSizeZero));
557+
});
558+
}
559+
550560
UIView.performWithoutAnimation(() => {
551561
view.performBatchUpdatesCompletion(() => {
552562
view.reloadItemsAtIndexPaths(visibles);

0 commit comments

Comments
 (0)