iOS: FlexLayout's root node do not enable margin

This commit is contained in:
pengfei.zhou 2021-10-15 19:04:58 +08:00 committed by osborn
parent 834d98cdb7
commit 3a1d07ecc4

View File

@ -236,6 +236,17 @@ - (void)requestLayout {
if (self.view.doricLayout.heightSpec != DoricLayoutFit) { if (self.view.doricLayout.heightSpec != DoricLayoutFit) {
self.view.yoga.height = YGPointValue(self.view.height); self.view.yoga.height = YGPointValue(self.view.height);
} }
if (![self.superNode isKindOfClass:DoricFlexNode.class]) {
self.view.yoga.margin = YGValueZero;
self.view.yoga.marginLeft = YGValueZero;
self.view.yoga.marginRight = YGValueZero;
self.view.yoga.marginTop = YGValueZero;
self.view.yoga.marginBottom = YGValueZero;
self.view.yoga.marginStart = YGValueZero;
self.view.yoga.marginEnd = YGValueZero;
self.view.yoga.marginVertical = YGValueZero;
self.view.yoga.marginHorizontal = YGValueZero;
}
[self.view.yoga applyLayoutPreservingOrigin:YES]; [self.view.yoga applyLayoutPreservingOrigin:YES];
/// Need layout again. /// Need layout again.
for (UIView *view in self.view.subviews) { for (UIView *view in self.view.subviews) {