From a9d94c2dfb45016125cc30d8ae1574e4e2c7f6f4 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Wed, 19 Oct 2016 06:39:34 -0700 Subject: [PATCH] Change flex basis to override main axis size Reviewed By: gkassabli Differential Revision: D4029374 fbshipit-source-id: bc3c72879f3937a50bf8a636b547adc7b9a4f5a7 --- React/CSSLayout/CSSLayout.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/React/CSSLayout/CSSLayout.c b/React/CSSLayout/CSSLayout.c index 6d6c06d5d..0e1d37d63 100644 --- a/React/CSSLayout/CSSLayout.c +++ b/React/CSSLayout/CSSLayout.c @@ -839,7 +839,13 @@ static void computeChildFlexBasis( CSSMeasureMode childWidthMeasureMode; CSSMeasureMode childHeightMeasureMode; - if (isMainAxisRow && isStyleDimDefined(child, CSSFlexDirectionRow)) { + if (!CSSValueIsUndefined(child->style.flexBasis) && + !CSSValueIsUndefined(isMainAxisRow ? width : height)) { + if (CSSValueIsUndefined(child->layout.computedFlexBasis)) { + child->layout.computedFlexBasis = + fmaxf(child->style.flexBasis, getPaddingAndBorderAxis(child, mainAxis)); + } + } else if (isMainAxisRow && isStyleDimDefined(child, CSSFlexDirectionRow)) { // The width is definite, so use that as the flex basis. child->layout.computedFlexBasis = fmaxf(child->style.dimensions[CSSDimensionWidth], @@ -849,12 +855,6 @@ static void computeChildFlexBasis( child->layout.computedFlexBasis = fmaxf(child->style.dimensions[CSSDimensionHeight], getPaddingAndBorderAxis(child, CSSFlexDirectionColumn)); - } else if (!CSSValueIsUndefined(child->style.flexBasis) && - !CSSValueIsUndefined(isMainAxisRow ? width : height)) { - if (CSSValueIsUndefined(child->layout.computedFlexBasis)) { - child->layout.computedFlexBasis = - fmaxf(child->style.flexBasis, getPaddingAndBorderAxis(child, mainAxis)); - } } else { // Compute the flex basis and hypothetical main size (i.e. the clamped // flex basis).