diff --git a/ReactCommon/yoga/yoga/Utils.h b/ReactCommon/yoga/yoga/Utils.h index 328ccef7105..1de614ce885 100644 --- a/ReactCommon/yoga/yoga/Utils.h +++ b/ReactCommon/yoga/yoga/Utils.h @@ -136,8 +136,9 @@ inline YGFlexDirection YGResolveFlexDirection( return flexDirection; } -static inline float YGResolveValueMargin( +static inline YGFloatOptional YGResolveValueMargin( const YGValue value, const float ownerSize) { - return value.unit == YGUnitAuto ? 0 : YGUnwrapFloatOptional(YGResolveValue(value, ownerSize)); + return value.unit == YGUnitAuto ? YGFloatOptional(0) + : YGResolveValue(value, ownerSize); } diff --git a/ReactCommon/yoga/yoga/YGNode.cpp b/ReactCommon/yoga/yoga/YGNode.cpp index 01be3a7c032..87a92b394d3 100644 --- a/ReactCommon/yoga/yoga/YGNode.cpp +++ b/ReactCommon/yoga/yoga/YGNode.cpp @@ -144,12 +144,13 @@ float YGNode::getLeadingMargin( const float widthSize) const { if (YGFlexDirectionIsRow(axis) && style_.margin[YGEdgeStart].unit != YGUnitUndefined) { - return YGResolveValueMargin(style_.margin[YGEdgeStart], widthSize); + return YGUnwrapFloatOptional( + YGResolveValueMargin(style_.margin[YGEdgeStart], widthSize)); } - return YGResolveValueMargin( + return YGUnwrapFloatOptional(YGResolveValueMargin( *YGComputedEdgeValue(style_.margin, leading[axis], &YGValueZero), - widthSize); + widthSize)); } float YGNode::getTrailingMargin( @@ -157,12 +158,13 @@ float YGNode::getTrailingMargin( const float widthSize) const { if (YGFlexDirectionIsRow(axis) && style_.margin[YGEdgeEnd].unit != YGUnitUndefined) { - return YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize); + return YGUnwrapFloatOptional( + YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize)); } - return YGResolveValueMargin( + return YGUnwrapFloatOptional(YGResolveValueMargin( *YGComputedEdgeValue(style_.margin, trailing[axis], &YGValueZero), - widthSize); + widthSize)); } float YGNode::getMarginForAxis(