From 51d1c5c91b0a285d500f7e16bd5ee4203d28d052 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Mon, 5 Sep 2022 17:25:23 +0800 Subject: [PATCH] iOS: fix flexlayout when sometimes width is not correct --- doric-iOS/Pod/Classes/Shader/DoricLayouts.m | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m index 93e65c2e..ab05627e 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricLayouts.m +++ b/doric-iOS/Pod/Classes/Shader/DoricLayouts.m @@ -1530,15 +1530,14 @@ - (void)layoutFlex { if (layout.disabled) { 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.measuredY = YGNodeLayoutGetTop(child.yoga.node); + CGSize size = child.yoga.intrinsicSize; + [layout measureWidth:DoricMeasureSpecMake(DoricMeasureExactly, + size.width) + height:DoricMeasureSpecMake(DoricMeasureExactly, + size.height)]; + [layout layout]; } } @end