Skip to content

Commit aa8eb80

Browse files
woehrl01facebook-github-bot
authored andcommitted
Fix shrinking in non strech alignments
Summary: This fixes shrinking of elements which are in a non stretch alignment Fixes #633 Closes facebook/yoga#634 Differential Revision: D5874862 Pulled By: emilsjolander fbshipit-source-id: 1426aa6b60f6ba42c2be702e6f24cea935ab7acb
1 parent 565a241 commit aa8eb80

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ReactCommon/yoga/yoga/Yoga.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2308,6 +2308,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
23082308
// If the main dimension size isn't known, it is computed based on
23092309
// the line length, so there's no more space left to distribute.
23102310

2311+
bool sizeBasedOnContent = false;
23112312
// If we don't measure with exact main dimension we want to ensure we don't violate min and max
23122313
if (measureModeMainDim != YGMeasureModeExactly) {
23132314
if (!YGFloatIsUndefined(minInnerMainDim) && sizeConsumedOnCurrentLine < minInnerMainDim) {
@@ -2322,11 +2323,12 @@ static void YGNodelayoutImpl(const YGNodeRef node,
23222323
// space we've used is all space we need. Root node also should be shrunk to minimum
23232324
availableInnerMainDim = sizeConsumedOnCurrentLine;
23242325
}
2326+
sizeBasedOnContent = true;
23252327
}
23262328
}
23272329

23282330
float remainingFreeSpace = 0;
2329-
if (!YGFloatIsUndefined(availableInnerMainDim)) {
2331+
if (!sizeBasedOnContent && !YGFloatIsUndefined(availableInnerMainDim)) {
23302332
remainingFreeSpace = availableInnerMainDim - sizeConsumedOnCurrentLine;
23312333
} else if (sizeConsumedOnCurrentLine < 0) {
23322334
// availableInnerMainDim is indefinite which means the node is being sized based on its

0 commit comments

Comments
 (0)