Skip to content

Commit fd223d0

Browse files
wiseoldduckhebertialmeida
authored andcommitted
Resolve root constrained size before informing delegate to resolve infinite layout loop. (TextureGroup#1359)
1 parent 49dd925 commit fd223d0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Source/ASDisplayNode+Yoga.mm

+4-4
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ - (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize
333333
return;
334334
}
335335

336+
if (ASSizeRangeEqualToSizeRange(rootConstrainedSize, ASSizeRangeUnconstrained)) {
337+
rootConstrainedSize = [self _locked_constrainedSizeForLayoutPass];
338+
}
339+
336340
[self willCalculateLayout:rootConstrainedSize];
337341
[self enumerateInterfaceStateDelegates:^(id<ASInterfaceStateDelegate> _Nonnull delegate) {
338342
if ([delegate respondsToSelector:@selector(nodeWillCalculateLayout:)]) {
@@ -352,10 +356,6 @@ - (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize
352356
};
353357
});
354358

355-
if (ASSizeRangeEqualToSizeRange(rootConstrainedSize, ASSizeRangeUnconstrained)) {
356-
rootConstrainedSize = [self _locked_constrainedSizeForLayoutPass];
357-
}
358-
359359
ASYogaLog("CALCULATING at Yoga root with constraint = {%@, %@}: %@",
360360
NSStringFromCGSize(rootConstrainedSize.min), NSStringFromCGSize(rootConstrainedSize.max), self);
361361

0 commit comments

Comments
 (0)