iOS: fix flexlayout when sometimes width is not correct

This commit is contained in:
pengfei.zhou 2022-09-05 17:25:23 +08:00 committed by osborn
parent 8e22108cc9
commit 51d1c5c91b

View File

@ -1530,15 +1530,14 @@ - (void)layoutFlex {
if (layout.disabled) { if (layout.disabled) {
continue; continue;
} }
if (layout.layoutType == DoricFlexLayout) {
[layout measureWidth:DoricMeasureSpecMake(DoricMeasureExactly,
YGNodeLayoutGetWidth(child.yoga.node))
height:DoricMeasureSpecMake(DoricMeasureExactly,
YGNodeLayoutGetHeight(child.yoga.node))];
}
[layout layout];
layout.measuredX = YGNodeLayoutGetLeft(child.yoga.node); layout.measuredX = YGNodeLayoutGetLeft(child.yoga.node);
layout.measuredY = YGNodeLayoutGetTop(child.yoga.node); layout.measuredY = YGNodeLayoutGetTop(child.yoga.node);
CGSize size = child.yoga.intrinsicSize;
[layout measureWidth:DoricMeasureSpecMake(DoricMeasureExactly,
size.width)
height:DoricMeasureSpecMake(DoricMeasureExactly,
size.height)];
[layout layout];
} }
} }
@end @end