Fix handling of negative flex gap (#1405)
Summary: X-link: https://github.com/facebook/react-native/pull/39596 Pull Request resolved: https://github.com/facebook/yoga/pull/1405 I noticed that we weren't clamping negative flex gap values to zero. This fixes that bug. Reviewed By: rshest Differential Revision: D49530494 fbshipit-source-id: 069db7312f72a085c5c4b01ead7bc66a353a07e5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a8566a0150
commit
b03a821884
@@ -202,13 +202,13 @@ FloatOptional Node::getMarginForAxis(
|
||||
return getLeadingMargin(axis, widthSize) + getTrailingMargin(axis, widthSize);
|
||||
}
|
||||
|
||||
FloatOptional Node::getGapForAxis(
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const {
|
||||
float Node::getGapForAxis(const FlexDirection axis, const float widthSize)
|
||||
const {
|
||||
auto gap = isRow(axis)
|
||||
? computeColumnGap(style_.gap(), CompactValue::ofZero())
|
||||
: computeRowGap(style_.gap(), CompactValue::ofZero());
|
||||
return yoga::resolveValue(gap, widthSize);
|
||||
? computeColumnGap(style_.gap(), CompactValue::ofUndefined())
|
||||
: computeRowGap(style_.gap(), CompactValue::ofUndefined());
|
||||
auto resolvedGap = yoga::resolveValue(gap, widthSize);
|
||||
return maxOrDefined(resolvedGap.unwrap(), 0);
|
||||
}
|
||||
|
||||
YGSize Node::measure(
|
||||
|
Reference in New Issue
Block a user