iOS: FlexNode ignore maxSize if largger than intrinsic size when it is root flex node

This commit is contained in:
pengfei.zhou 2021-10-15 19:31:39 +08:00 committed by osborn
parent 3e1051ed4e
commit c04994ab21

View File

@ -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.