Skip to content

Commit 6d97a43

Browse files
priteshrnandgaonkarLukeDurrant
authored andcommitted
Changed the return type of YGResolveValueMargin to YGFloatOptional
Reviewed By: emilsjolander Differential Revision: D7304090 fbshipit-source-id: cbec03a9367cf34976d083ad475d4da0b736e6d2
1 parent 34d02fb commit 6d97a43

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

ReactCommon/yoga/yoga/Utils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ inline YGFlexDirection YGResolveFlexDirection(
136136
return flexDirection;
137137
}
138138

139-
static inline float YGResolveValueMargin(
139+
static inline YGFloatOptional YGResolveValueMargin(
140140
const YGValue value,
141141
const float ownerSize) {
142-
return value.unit == YGUnitAuto ? 0 : YGUnwrapFloatOptional(YGResolveValue(value, ownerSize));
142+
return value.unit == YGUnitAuto ? YGFloatOptional(0)
143+
: YGResolveValue(value, ownerSize);
143144
}

ReactCommon/yoga/yoga/YGNode.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,27 @@ float YGNode::getLeadingMargin(
144144
const float widthSize) const {
145145
if (YGFlexDirectionIsRow(axis) &&
146146
style_.margin[YGEdgeStart].unit != YGUnitUndefined) {
147-
return YGResolveValueMargin(style_.margin[YGEdgeStart], widthSize);
147+
return YGUnwrapFloatOptional(
148+
YGResolveValueMargin(style_.margin[YGEdgeStart], widthSize));
148149
}
149150

150-
return YGResolveValueMargin(
151+
return YGUnwrapFloatOptional(YGResolveValueMargin(
151152
*YGComputedEdgeValue(style_.margin, leading[axis], &YGValueZero),
152-
widthSize);
153+
widthSize));
153154
}
154155

155156
float YGNode::getTrailingMargin(
156157
const YGFlexDirection axis,
157158
const float widthSize) const {
158159
if (YGFlexDirectionIsRow(axis) &&
159160
style_.margin[YGEdgeEnd].unit != YGUnitUndefined) {
160-
return YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize);
161+
return YGUnwrapFloatOptional(
162+
YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize));
161163
}
162164

163-
return YGResolveValueMargin(
165+
return YGUnwrapFloatOptional(YGResolveValueMargin(
164166
*YGComputedEdgeValue(style_.margin, trailing[axis], &YGValueZero),
165-
widthSize);
167+
widthSize));
166168
}
167169

168170
float YGNode::getMarginForAxis(

0 commit comments

Comments
 (0)