mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-23 09:18:29 +00:00
Fix logic flaw of of shouldInvalidateLayoutForBoundsChange in IGListCollectionViewLayout (#1236)
Summary: Issue fixed: #1235 - [x] All tests pass. Demo project builds and runs. - [x] I added tests, an experiment, or detailed why my change isn't tested. - [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. - [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1236 Reviewed By: lorixx Differential Revision: D12839081 Pulled By: rnystrom fbshipit-source-id: 3e9e1192f16912d560d76f3730a377f303708cd7
This commit is contained in:
parent
3f31d05ac3
commit
8ebde97b92
2 changed files with 7 additions and 2 deletions
|
|
@ -36,6 +36,7 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag
|
|||
|
||||
- Fixed crash when using `-[IGListCollectionContext dequeueReusableCellOfClass:withReuseIdentifier:forSectionController:atIndex:]` [Jeremy Lawrence](https://github.com/ziewvater) (tbd)
|
||||
|
||||
- Fixed logic flaw in `[IGListCollectionViewLayout shouldInvalidateLayoutForBoundsChange:]`. [Allen Hsu](https://github.com/allenhsu) (tbd)
|
||||
|
||||
3.4.0
|
||||
-----
|
||||
|
|
|
|||
|
|
@ -415,13 +415,17 @@ static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attribut
|
|||
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
|
||||
const CGRect oldBounds = self.collectionView.bounds;
|
||||
|
||||
// always invalidate for size changes
|
||||
if (!CGSizeEqualToSize(oldBounds.size, newBounds.size)) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
// if the y origin has changed, only invalidate when using sticky headers
|
||||
if (CGRectGetMinInDirection(newBounds, self.scrollDirection) != CGRectGetMinInDirection(oldBounds, self.scrollDirection)) {
|
||||
return self.stickyHeaders;
|
||||
}
|
||||
|
||||
// always invalidate for size changes
|
||||
return !CGSizeEqualToSize(oldBounds.size, newBounds.size);
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)prepareLayout {
|
||||
|
|
|
|||
Loading…
Reference in a new issue