[YogaKit] if set UIView‘s size, UIKit can't accept a Nan value. Fixed

This commit is contained in:
henry
2022-04-29 09:38:42 +08:00
parent 97f80e79a2
commit 595fa45996

View File

@@ -489,10 +489,8 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
}, },
.size = .size =
{ {
.width = YGRoundPixelValue(bottomRight.x) - .width = MAX(0, YGRoundPixelValue(bottomRight.x) - YGRoundPixelValue(topLeft.x)),
YGRoundPixelValue(topLeft.x), .height = MAX(0, YGRoundPixelValue(bottomRight.y) - YGRoundPixelValue(topLeft.y)),
.height = YGRoundPixelValue(bottomRight.y) -
YGRoundPixelValue(topLeft.y),
}, },
}; };