From 22c99ec71d03683bc942efb54b43b6f843bb8935 Mon Sep 17 00:00:00 2001 From: wwwcg Date: Tue, 6 Aug 2024 21:33:29 +0800 Subject: [PATCH] fix(ios): remove invalid if statement at cell reuse --- .../component/listview/HippyNextBaseListView.mm | 4 +--- .../waterfalllist/HippyShadowWaterfallItem.h | 2 -- .../waterfalllist/HippyShadowWaterfallItem.m | 12 +----------- .../component/waterfalllist/HippyWaterfallView.mm | 4 +--- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/renderer/native/ios/renderer/component/listview/HippyNextBaseListView.mm b/renderer/native/ios/renderer/component/listview/HippyNextBaseListView.mm index f299e3d83b7..40daabd1b53 100644 --- a/renderer/native/ios/renderer/component/listview/HippyNextBaseListView.mm +++ b/renderer/native/ios/renderer/component/listview/HippyNextBaseListView.mm @@ -269,9 +269,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell UIView *cellView = nil; UIView *cachedVisibleCellView = [_cachedWeakCellViews objectForKey:shadowView.hippyTag]; - if (cachedVisibleCellView && - [shadowView isKindOfClass:HippyShadowWaterfallItem.class] && - !((HippyShadowWaterfallItem *)shadowView).layoutDirty) { + if (cachedVisibleCellView) { cellView = cachedVisibleCellView; HippyLogTrace(@"🟢 use cached visible cellView at %@ for %@", indexPath, shadowView.hippyTag); } else { diff --git a/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.h b/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.h index fee091dcf58..8e75ba48228 100644 --- a/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.h +++ b/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.h @@ -38,8 +38,6 @@ NS_ASSUME_NONNULL_BEGIN /// Waterfall item's shadowView @interface HippyShadowWaterfallItem : HippyShadowView -@property (nonatomic, assign, getter=isLayoutDirty) BOOL layoutDirty; - /// frame change observer, usually is shadowListView @property (nonatomic, weak) id observer; diff --git a/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.m b/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.m index ff409d7e967..167412d8707 100644 --- a/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.m +++ b/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.m @@ -46,17 +46,7 @@ - (void)amendLayoutBeforeMount:(NSMutableSet *)blocks // If item has not yet been created, then no need to collect blocks. return; } - _layoutDirty = NO; - if (NativeRenderUpdateLifecycleComputed == _propagationLifecycle) { - return; - } - if (NativeRenderUpdateLifecycleLayoutDirtied == _propagationLifecycle) { - _layoutDirty = YES; - } - _propagationLifecycle = NativeRenderUpdateLifecycleComputed; - for (HippyShadowView *renderObjectView in self.hippySubviews) { - [renderObjectView amendLayoutBeforeMount:blocks]; - } + [super amendLayoutBeforeMount:blocks]; } @end diff --git a/renderer/native/ios/renderer/component/waterfalllist/HippyWaterfallView.mm b/renderer/native/ios/renderer/component/waterfalllist/HippyWaterfallView.mm index 36739531ff7..8561640ad85 100644 --- a/renderer/native/ios/renderer/component/waterfalllist/HippyWaterfallView.mm +++ b/renderer/native/ios/renderer/component/waterfalllist/HippyWaterfallView.mm @@ -263,9 +263,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell UIView *cellView = nil; UIView *cachedCellView = [_cachedWeakCellViews objectForKey:shadowView.hippyTag]; - if (cachedCellView && - [shadowView isKindOfClass:HippyShadowWaterfallItem.class] && - !((HippyShadowWaterfallItem *)shadowView).layoutDirty) { + if (cachedCellView) { cellView = cachedCellView; } else { cellView = [self.uiManager createViewForShadowListItem:shadowView];