Fix a bug in IGListBindingSingleSectionController for displayingCell setting

Summary:
When a section/cell is reloaded, UICollectionView actually calls:

1/ WillDisplay (new cell)
2/ DidEndDisplay (old cell)

So if we set `_displayingCell` in willDisplay call, then set it to nil in didEndDisplay, we would just have a nil cell. Thus we need to make sure the cell in `didEndDisplay` match with the previous `_displayCell` to avoid nil-ing ourselves out.

Reviewed By: alanzeino

Differential Revision: D19906734

fbshipit-source-id: 5217908ae99d488a2af5ff3f90ef8e021774acda
This commit is contained in:
Zhisheng Huang 2020-02-14 15:27:12 -08:00 committed by Facebook Github Bot
parent fecf9e4124
commit bb89f70510

View file

@ -72,7 +72,9 @@
- (void)listAdapter:(nonnull IGListAdapter *)listAdapter didEndDisplayingSectionController:(nonnull IGListSectionController *)sectionController cell:(nonnull UICollectionViewCell *)cell atIndex:(NSInteger)index {
IGParameterAssert(index == 0);
_displayingCell = nil;
if (cell == _displayingCell) {
_displayingCell = nil;
}
}
#pragma mark - IGListSectionController Overrides