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
@@ -1215,7 +1215,7 @@ static void justifyMainAxis(
|
||||
node->getLeadingPaddingAndBorder(mainAxis, ownerWidth).unwrap();
|
||||
const float trailingPaddingAndBorderMain =
|
||||
node->getTrailingPaddingAndBorder(mainAxis, ownerWidth).unwrap();
|
||||
const float gap = node->getGapForAxis(mainAxis, ownerWidth).unwrap();
|
||||
const float gap = node->getGapForAxis(mainAxis, ownerWidth);
|
||||
// If we are using "at most" rules in the main axis, make sure that
|
||||
// remainingFreeSpace is 0 when min main dimension is not given
|
||||
if (measureModeMainDim == MeasureMode::AtMost &&
|
||||
@@ -1666,8 +1666,7 @@ static void calculateLayoutImpl(
|
||||
generationCount);
|
||||
|
||||
if (childCount > 1) {
|
||||
totalMainDim +=
|
||||
node->getGapForAxis(mainAxis, availableInnerCrossDim).unwrap() *
|
||||
totalMainDim += node->getGapForAxis(mainAxis, availableInnerCrossDim) *
|
||||
static_cast<float>(childCount - 1);
|
||||
}
|
||||
|
||||
@@ -1692,7 +1691,7 @@ static void calculateLayoutImpl(
|
||||
float totalLineCrossDim = 0;
|
||||
|
||||
const float crossAxisGap =
|
||||
node->getGapForAxis(crossAxis, availableInnerCrossDim).unwrap();
|
||||
node->getGapForAxis(crossAxis, availableInnerCrossDim);
|
||||
|
||||
// Max main dimension of all the lines.
|
||||
float maxLineMainDim = 0;
|
||||
|
@@ -33,7 +33,7 @@ FlexLine calculateFlexLine(
|
||||
const FlexDirection mainAxis = resolveDirection(
|
||||
node->getStyle().flexDirection(), node->resolveDirection(ownerDirection));
|
||||
const bool isNodeFlexWrap = node->getStyle().flexWrap() != Wrap::NoWrap;
|
||||
const float gap = node->getGapForAxis(mainAxis, availableInnerWidth).unwrap();
|
||||
const float gap = node->getGapForAxis(mainAxis, availableInnerWidth);
|
||||
|
||||
// Add items to the current line until it's full or we run out of items.
|
||||
for (; endOfLineIndex < node->getChildren().size(); endOfLineIndex++) {
|
||||
|
Reference in New Issue
Block a user