From d376155e2c84d70ae5df032d4db473fa990f98c6 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Mon, 17 Oct 2016 04:07:54 -0700 Subject: [PATCH] Fix justify content + min dimension usage in root Reviewed By: gkassabli, lucasr Differential Revision: D4021443 fbshipit-source-id: 00f58c6078ac3076221e1148aacc34712786deb5 --- React/CSSLayout/CSSLayout.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/React/CSSLayout/CSSLayout.c b/React/CSSLayout/CSSLayout.c index e44429b7e..c50095bf1 100644 --- a/React/CSSLayout/CSSLayout.c +++ b/React/CSSLayout/CSSLayout.c @@ -1514,10 +1514,14 @@ static void layoutNodeImpl(const CSSNodeRef node, // that are aligned "stretch". We need to compute these stretch values and // set the final positions. - // If we are using "at most" rules in the main axis, we won't distribute - // any remaining space at this point. + // If we are using "at most" rules in the main axis. Calculate the remaining space when + // constraint by the min size defined for the main axis. if (measureModeMainDim == CSSMeasureModeAtMost) { - remainingFreeSpace = 0; + if (!CSSValueIsUndefined(node->style.minDimensions[dim[mainAxis]]) && node->style.minDimensions[dim[mainAxis]] >= 0) { + remainingFreeSpace = fmaxf(0, node->style.minDimensions[dim[mainAxis]] - (availableInnerMainDim - remainingFreeSpace)); + } else { + remainingFreeSpace = 0; + } } switch (justifyContent) {