Force ASPagerNode pages to be bounds-sized (#2973)

This commit is contained in:
Adlai Holler
2017-02-03 10:29:15 -08:00
committed by GitHub
parent bf2363cb8f
commit a2ff2b9900
2 changed files with 5 additions and 2 deletions

View File

@@ -66,7 +66,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param index The index of the node. * @param index The index of the node.
* @return A constrained size range for layout the node at this index. * @return A constrained size range for layout the node at this index.
*/ */
- (ASSizeRange)pagerNode:(ASPagerNode *)pagerNode constrainedSizeForNodeAtIndex:(NSInteger)index; - (ASSizeRange)pagerNode:(ASPagerNode *)pagerNode constrainedSizeForNodeAtIndex:(NSInteger)index ASDISPLAYNODE_DEPRECATED_MSG("Pages in a pager node should be the exact size of the collection node (default behavior).");
@end @end

View File

@@ -153,11 +153,14 @@
- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath - (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath
{ {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (_pagerDelegateFlags.constrainedSizeForNode) { if (_pagerDelegateFlags.constrainedSizeForNode) {
return [_pagerDelegate pagerNode:self constrainedSizeForNodeAtIndex:indexPath.item]; return [_pagerDelegate pagerNode:self constrainedSizeForNodeAtIndex:indexPath.item];
} }
#pragma clang diagnostic pop
return ASSizeRangeMake(CGSizeZero, self.bounds.size); return ASSizeRangeMake(self.bounds.size);
} }
#pragma mark - Data Source Proxy #pragma mark - Data Source Proxy