From 8a322b1b6036e0451631ee17d719f4346774b2c3 Mon Sep 17 00:00:00 2001 From: appleguy Date: Thu, 10 Jan 2019 11:34:47 +0100 Subject: [PATCH] [ASCollectionView] Supplementary nodes should not enter ASHierarchyStateRangeManaged. As of today, ASRangeController doesn't manage the interfaceState for supplementary nodes. This bug was introduced with a refactoring of this code a couple months ago. With this change, the supplementary nodes will automatically enter each interfaceState bit when they are added to a view hierarchy. --- Source/ASCollectionView.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index 06ff05637..59e4ef4fa 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -2044,7 +2044,7 @@ - (ASCellNodeBlock)dataController:(ASDataController *)dataController supplementa } // Wrap the node block - BOOL disableRangeController = ASCellLayoutModeIncludes(ASCellLayoutModeDisableRangeController); + // BOOL disableRangeController = ASCellLayoutModeIncludes(ASCellLayoutModeDisableRangeController); __weak __typeof__(self) weakSelf = self; return ^{ __typeof__(self) strongSelf = weakSelf; @@ -2052,9 +2052,15 @@ - (ASCellNodeBlock)dataController:(ASDataController *)dataController supplementa ASDisplayNodeAssert([node isKindOfClass:[ASCellNode class]], @"ASCollectionNode provided a non-ASCellNode! %@, %@", node, strongSelf); + // TODO: ASRangeController doesn't currently support managing interfaceState for supplementary nodes. + // For now, we allow the standard ASInterfaceStateInHierarchy behavior by ensuring we do not inform + // the node that it should expect external management of interfaceState. + /* if (!disableRangeController) { [node enterHierarchyState:ASHierarchyStateRangeManaged]; } + */ + if (node.interactionDelegate == nil) { node.interactionDelegate = strongSelf; }