Permalink
Browse files

Change flex basis to override main axis size

Reviewed By: gkassabli

Differential Revision: D4029374

fbshipit-source-id: bc3c72879f3937a50bf8a636b547adc7b9a4f5a7
  • Loading branch information...
1 parent 2e06e70 commit a9d94c2dfb45016125cc30d8ae1574e4e2c7f6f4 @emilsjolander emilsjolander committed with Facebook Github Bot Oct 19, 2016
Showing with 7 additions and 7 deletions.
  1. +7 −7 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).

0 comments on commit a9d94c2

Please sign in to comment.