Skip to content

Commit

Permalink
fix(ios): cellView detach bug of listview and waterfall
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg authored and zealotchen0 committed Nov 30, 2023
1 parent 2a4533c commit 4753e3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,13 @@ - (void)collectionView:(UICollectionView *)collectionView
}
}

- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
- (void)collectionView:(UICollectionView *)collectionView
didEndDisplayingCell:(UICollectionViewCell *)cell
forItemAtIndexPath:(NSIndexPath *)indexPath {
if ([cell isKindOfClass:[NativeRenderBaseListViewCell class]]) {
NativeRenderBaseListViewCell *hpCell = (NativeRenderBaseListViewCell *)cell;
if (hpCell.cellView) {
[_cachedItems setObject:[hpCell.cellView hippyTag] forKey:indexPath];
hpCell.cellView = nil;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ - (instancetype)initWithFrame:(CGRect)frame {
_scrollListeners = [NSHashTable weakObjectsHashTable];
_scrollEventThrottle = 100.f;
_weakItemMap = [NSMapTable strongToWeakObjectsMapTable];
_cachedItems = [NSMutableDictionary dictionaryWithCapacity:32];
_cachedItems = [NSMutableDictionary dictionary];
_dataSourcePool = [NSMutableArray array];
_dataSourceSem = dispatch_semaphore_create(1);
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
Expand Down Expand Up @@ -396,12 +396,13 @@ - (void)collectionView:(UICollectionView *)collectionView
}
}

- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
- (void)collectionView:(UICollectionView *)collectionView
didEndDisplayingCell:(UICollectionViewCell *)cell
forItemAtIndexPath:(NSIndexPath *)indexPath {
if ([cell isKindOfClass:[NativeRenderWaterfallViewCell class]]) {
NativeRenderWaterfallViewCell *hpCell = (NativeRenderWaterfallViewCell *)cell;
if (hpCell.cellView) {
[_cachedItems setObject:[hpCell.cellView hippyTag] forKey:indexPath];
hpCell.cellView = nil;
}
}
}
Expand Down

0 comments on commit 4753e3b

Please sign in to comment.