Skip to content

Commit 530588b

Browse files
committed
fix(collectionview): ios prevent endless performLayout
1 parent 2f1941c commit 530588b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/collectionview/index.ios.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,8 @@ export class CollectionView extends CollectionViewBase {
808808
// for a cell to update correctly on cell layout change we need
809809
// to do it ourself instead of "propagating it"
810810
view['performLayout'] = () => {
811-
if (!this._preparingCell) {
811+
if (!this._preparingCell && !view['inPerformLayout']) {
812+
view['inPerformLayout'] = true;
812813
const index = cell.currentIndex;
813814
const nativeView = this.nativeViewProtected;
814815
const sizes: NSMutableArray<NSValue> = this._delegate instanceof UICollectionViewDelegateImpl ? this._delegate.cachedSizes : null;
@@ -823,6 +824,7 @@ export class CollectionView extends CollectionViewBase {
823824
cell.contentView.subviews.objectAtIndex(0)?.layoutSubviews();
824825
// nativeView.collectionViewLayout.invalidateLayout();
825826
}, null);
827+
view['inPerformLayout'] = false;
826828
}
827829
};
828830
}

0 commit comments

Comments
 (0)