Permalink
Browse files

Fix justify content with min/max constraint parent

Summary:
The min/max inner width shouldn't take the margins into account.
Adds a test for both cases.

Fixes #664
Closes facebook/yoga#665

Differential Revision: D6407982

Pulled By: emilsjolander

fbshipit-source-id: ffa549a06f802263e3b8488e90756aa3f722d52d
  • Loading branch information...
woehrl01 authored and facebook-github-bot committed Nov 24, 2017
1 parent 05e862d commit f5becebc0710d5bb875bb9c0a2d3809a00f62605
Showing with 4 additions and 4 deletions.
  1. +4 −4 ReactCommon/yoga/yoga/Yoga.cpp
@@ -1862,17 +1862,17 @@ static void YGNodelayoutImpl(const YGNodeRef node,

// STEP 2: DETERMINE AVAILABLE SIZE IN MAIN AND CROSS DIRECTIONS
const float minInnerWidth =
YGResolveValue(&node->style.minDimensions[YGDimensionWidth], parentWidth) - marginAxisRow -
YGResolveValue(&node->style.minDimensions[YGDimensionWidth], parentWidth) -
paddingAndBorderAxisRow;
const float maxInnerWidth =
YGResolveValue(&node->style.maxDimensions[YGDimensionWidth], parentWidth) - marginAxisRow -
YGResolveValue(&node->style.maxDimensions[YGDimensionWidth], parentWidth) -
paddingAndBorderAxisRow;
const float minInnerHeight =
YGResolveValue(&node->style.minDimensions[YGDimensionHeight], parentHeight) -
marginAxisColumn - paddingAndBorderAxisColumn;
paddingAndBorderAxisColumn;
const float maxInnerHeight =
YGResolveValue(&node->style.maxDimensions[YGDimensionHeight], parentHeight) -
marginAxisColumn - paddingAndBorderAxisColumn;
paddingAndBorderAxisColumn;
const float minInnerMainDim = isMainAxisRow ? minInnerWidth : minInnerHeight;
const float maxInnerMainDim = isMainAxisRow ? maxInnerWidth : maxInnerHeight;

0 comments on commit f5beceb

Please sign in to comment.