From 9777dc063072338ad49125ab225fff3d44bdf20d Mon Sep 17 00:00:00 2001 From: Ricky Tan Date: Wed, 9 Oct 2019 18:30:40 +0800 Subject: [PATCH] fix: some subview didn't enable yoga, and crash with NaN frame --- YogaKit/Source/YGLayout.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index fef88ae5..518fe5a5 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -441,10 +441,14 @@ static CGFloat YGRoundPixelValue(CGFloat value) static void YGApplyLayoutToViewHierarchy(UIView *view, BOOL preserveOrigin) { NSCAssert([NSThread isMainThread], @"Framesetting should only be done on the main thread."); - + + if (!view.isYogaEnabled) { + return; + } + const YGLayout *yoga = view.yoga; - if (!yoga.isIncludedInLayout) { + if (!yoga.isEnabled || !yoga.isIncludedInLayout) { return; } -- 2.50.1.windows.1