Skip to content

Commit

Permalink
Resolve root constrained size before informing delegate to resolve in…
Browse files Browse the repository at this point in the history
…finite layout loop. (#1359)
  • Loading branch information
wiseoldduck authored and Adlai-Holler committed Mar 5, 2019
1 parent 50e8dbf commit 96e6a6c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Source/ASDisplayNode+Yoga.mm
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ - (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize
return;
}

if (ASSizeRangeEqualToSizeRange(rootConstrainedSize, ASSizeRangeUnconstrained)) {
rootConstrainedSize = [self _locked_constrainedSizeForLayoutPass];
}

[self willCalculateLayout:rootConstrainedSize];
[self enumerateInterfaceStateDelegates:^(id<ASInterfaceStateDelegate> _Nonnull delegate) {
if ([delegate respondsToSelector:@selector(nodeWillCalculateLayout:)]) {
Expand All @@ -352,10 +356,6 @@ - (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize
};
});

if (ASSizeRangeEqualToSizeRange(rootConstrainedSize, ASSizeRangeUnconstrained)) {
rootConstrainedSize = [self _locked_constrainedSizeForLayoutPass];
}

ASYogaLog("CALCULATING at Yoga root with constraint = {%@, %@}: %@",
NSStringFromCGSize(rootConstrainedSize.min), NSStringFromCGSize(rootConstrainedSize.max), self);

Expand Down

0 comments on commit 96e6a6c

Please sign in to comment.