Skip to content

Commit c927520

Browse files
committed
fix(ios): prevent edge case error in onLayout (native view disposed)
1 parent 19ca7e1 commit c927520

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/collectionview/index.ios.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@ export class CollectionView extends CollectionViewBase {
380380
public onLayout(left: number, top: number, right: number, bottom: number) {
381381
super.onLayout(left, top, right, bottom);
382382

383+
const layoutView = this.nativeViewProtected?.collectionViewLayout;
384+
if (!layoutView) {
385+
return;
386+
}
383387
const p = CollectionViewBase.plugins[this.layoutStyle];
384388
if (p && p.onLayout) {
385389
p.onLayout(this, left, top, right, bottom);
@@ -389,10 +393,6 @@ export class CollectionView extends CollectionViewBase {
389393
p.onLayout && p.onLayout(this, left, top, right, bottom);
390394
});
391395

392-
const layoutView = this.nativeViewProtected.collectionViewLayout;
393-
if (!layoutView) {
394-
return;
395-
}
396396
if (!this._delegate) {
397397
const layoutStyle = CollectionViewBase.layoutStyles[this.layoutStyle];
398398
if (layoutStyle && layoutStyle.createDelegate) {

0 commit comments

Comments
 (0)