Skip to content

Commit 3b93ba9

Browse files
woehrl01facebook-github-bot
authored andcommitted
The total flex factores need to be a minimum of 1 if any
Summary: The only thing I found in the spec for this change is the following. Not exactly sure if this is the thing this PR is about: > For each flex item, subtract its outer flex base size from its max-content contribution size. If that result is not zero, divide it by (if the result was positive) its **flex grow factor floored at 1** or (if the result was negative) by its scaled flex shrink factor, having **floored the flex shrink factor at 1**. This is the item’s max-content flex fraction. But at least it seems a required change. Fixes facebook/yoga#566 Closes facebook/yoga#572 Differential Revision: D5264388 Pulled By: emilsjolander fbshipit-source-id: 0004d1c3b9bad070a98cd6766c1adc06a54475f8
1 parent 8fa55ca commit 3b93ba9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ReactCommon/yoga/yoga/Yoga.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,6 +2278,16 @@ static void YGNodelayoutImpl(const YGNodeRef node,
22782278
}
22792279
}
22802280

2281+
// The total flex factor needs to be floored to 1.
2282+
if (totalFlexGrowFactors > 0 && totalFlexGrowFactors < 1) {
2283+
totalFlexGrowFactors = 1;
2284+
}
2285+
2286+
// The total flex shrink factor needs to be floored to 1.
2287+
if (totalFlexShrinkScaledFactors > 0 && totalFlexShrinkScaledFactors < 1) {
2288+
totalFlexShrinkScaledFactors = 1;
2289+
}
2290+
22812291
// If we don't need to measure the cross axis, we can skip the entire flex
22822292
// step.
22832293
const bool canSkipFlex = !performLayout && measureModeCrossDim == YGMeasureModeExactly;

0 commit comments

Comments
 (0)