From 595fa45996092b2df8e0c276bb34b77864441361 Mon Sep 17 00:00:00 2001 From: henry <758981890@qq.com> Date: Fri, 29 Apr 2022 09:38:42 +0800 Subject: [PATCH] =?UTF-8?q?[YogaKit]=20=20if=20set=20UIView=E2=80=98s=20si?= =?UTF-8?q?ze,=20=20UIKit=20can't=20accept=20a=20Nan=20value.=20Fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YogaKit/Source/YGLayout.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/YogaKit/Source/YGLayout.m b/YogaKit/Source/YGLayout.m index 4a95a5ca..2989ffab 100644 --- a/YogaKit/Source/YGLayout.m +++ b/YogaKit/Source/YGLayout.m @@ -489,10 +489,8 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) { }, .size = { - .width = YGRoundPixelValue(bottomRight.x) - - YGRoundPixelValue(topLeft.x), - .height = YGRoundPixelValue(bottomRight.y) - - YGRoundPixelValue(topLeft.y), + .width = MAX(0, YGRoundPixelValue(bottomRight.x) - YGRoundPixelValue(topLeft.x)), + .height = MAX(0, YGRoundPixelValue(bottomRight.y) - YGRoundPixelValue(topLeft.y)), }, };