From c04994ab21ffd350a9e06714248010097075d35c Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 15 Oct 2021 19:31:39 +0800 Subject: [PATCH] iOS: FlexNode ignore maxSize if largger than intrinsic size when it is root flex node --- doric-iOS/Pod/Classes/Shader/DoricFlexNode.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doric-iOS/Pod/Classes/Shader/DoricFlexNode.m b/doric-iOS/Pod/Classes/Shader/DoricFlexNode.m index 1e2080f7..e6240f93 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricFlexNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricFlexNode.m @@ -246,6 +246,15 @@ - (void)requestLayout { self.view.yoga.marginEnd = YGValueZero; self.view.yoga.marginVertical = YGValueZero; self.view.yoga.marginHorizontal = YGValueZero; + CGSize size = self.view.yoga.intrinsicSize; + if (self.view.yoga.maxWidth.unit != YGUnitPoint + ||(self.view.yoga.maxWidth.unit == YGUnitPoint && self.view.yoga.maxWidth.value > size.width)){ + self.view.yoga.maxWidth = YGValueUndefined; + } + if (self.view.yoga.maxHeight.unit != YGUnitPoint + ||(self.view.yoga.maxHeight.unit == YGUnitPoint && self.view.yoga.maxHeight.value > size.height)){ + self.view.yoga.maxHeight = YGValueUndefined; + } } [self.view.yoga applyLayoutPreservingOrigin:YES]; /// Need layout again.