diff --git a/ReactCommon/yoga/yoga/Yoga.c b/ReactCommon/yoga/yoga/Yoga.c index 1163e870a..c476b47d2 100644 --- a/ReactCommon/yoga/yoga/Yoga.c +++ b/ReactCommon/yoga/yoga/Yoga.c @@ -256,12 +256,16 @@ static inline const YGValue *YGComputedEdgeValue(const YGValue edges[YGEdgeCount return defaultValue; } -static inline float YGValueResolve(const YGValue *const unit, const float parentSize) { - if (unit->unit == YGUnitPixel) { - return unit->value; - } else { - return unit->value * parentSize / 100.0f; +static inline float YGValueResolve(const YGValue *const value, const float parentSize) { + switch (value->unit) { + case YGUnitUndefined: + return YGUndefined; + case YGUnitPixel: + return value->value; + case YGUnitPercent: + return value->value * parentSize / 100.0f; } + return YGUndefined; } int32_t gNodeInstanceCount = 0; @@ -2253,7 +2257,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, childHeight = YGValueResolve(¤tRelativeChild->style.dimensions[YGDimensionHeight], availableInnerHeight) + marginColumn; - childHeightMeasureMode = YGMeasureModeExactly; + childHeightMeasureMode = + YGFloatIsUndefined(childHeight) ? YGMeasureModeUndefined : YGMeasureModeExactly; } } else { childHeight = updatedMainSize + marginColumn; @@ -2277,7 +2282,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, childWidth = YGValueResolve(¤tRelativeChild->style.dimensions[YGDimensionWidth], availableInnerWidth) + marginRow; - childWidthMeasureMode = YGMeasureModeExactly; + childWidthMeasureMode = + YGFloatIsUndefined(childWidth) ? YGMeasureModeUndefined : YGMeasureModeExactly; } }