Caching scrollable directions is not safe (#2474)

This commit is contained in:
Garrett Moon 2016-10-24 14:05:03 -07:00 committed by Adlai Holler
parent f7b30577b8
commit 86a5aece9c

View File

@ -30,7 +30,6 @@ typedef struct ASRangeGeometry ASRangeGeometry;
@package @package
ASCollectionView * __weak _collectionView; ASCollectionView * __weak _collectionView;
UICollectionViewLayout * __strong _collectionViewLayout; UICollectionViewLayout * __strong _collectionViewLayout;
ASScrollDirection _scrollableDirections;
} }
@end @end
@ -42,7 +41,6 @@ typedef struct ASRangeGeometry ASRangeGeometry;
return nil; return nil;
} }
_scrollableDirections = [collectionView scrollableDirections];
_collectionView = collectionView; _collectionView = collectionView;
_collectionViewLayout = [collectionView collectionViewLayout]; _collectionViewLayout = [collectionView collectionViewLayout];
return self; return self;
@ -74,12 +72,7 @@ typedef struct ASRangeGeometry ASRangeGeometry;
{ {
CGRect rect = _collectionView.bounds; CGRect rect = _collectionView.bounds;
// Scrollable directions can change for non-flow layouts return CGRectExpandToRangeWithScrollableDirections(rect, tuningParameters, [_collectionView scrollableDirections], scrollDirection);
if ([_collectionViewLayout asdk_isFlowLayout] == NO) {
_scrollableDirections = [_collectionView scrollableDirections];
}
return CGRectExpandToRangeWithScrollableDirections(rect, tuningParameters, _scrollableDirections, scrollDirection);
} }
@end @end