Permalink
Browse files

Fix percentage in flexing parent

Summary:
If we don't measure exactly, percentage values aren't exactly either. Fix for #414.
Closes facebook/yoga#416
Closes facebook/yoga#414

Reviewed By: astreet

Differential Revision: D4604729

Pulled By: emilsjolander

fbshipit-source-id: 66880230073209cbe89668b838c2a82e7f9b34df
  • Loading branch information...
woehrl01 authored and facebook-github-bot committed Feb 28, 2017
1 parent 2030b6b commit f52d66c3111f2f5254f3c95fdb7332e8fc31d5e8
Showing with 7 additions and 3 deletions.
  1. +7 −3 ReactCommon/yoga/yoga/Yoga.c
@@ -2045,7 +2045,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
}
const bool flexBasisOverflows =
measureModeMainDim == YGMeasureModeUndefined ? false : totalFlexBasis > availableInnerMainDim;
measureModeMainDim == YGMeasureModeUndefined ? false : totalFlexBasis > availableInnerMainDim;
if (isNodeFlexWrap && flexBasisOverflows && measureModeMainDim == YGMeasureModeAtMost) {
measureModeMainDim = YGMeasureModeExactly;
}
@@ -2338,8 +2338,12 @@ static void YGNodelayoutImpl(const YGNodeRef node,
childCrossSize = YGValueResolve(currentRelativeChild->resolvedDimensions[dim[crossAxis]],
availableInnerCrossDim) +
marginCross;
childCrossMeasureMode =
YGFloatIsUndefined(childCrossSize) ? YGMeasureModeUndefined : YGMeasureModeExactly;
const bool isLoosePercentageMeasurement =
currentRelativeChild->resolvedDimensions[dim[crossAxis]]->unit == YGUnitPercent &&
measureModeCrossDim != YGMeasureModeExactly;
childCrossMeasureMode = YGFloatIsUndefined(childCrossSize) || isLoosePercentageMeasurement
? YGMeasureModeUndefined
: YGMeasureModeExactly;
}
if (!YGFloatIsUndefined(currentRelativeChild->style.aspectRatio)) {

0 comments on commit f52d66c

Please sign in to comment.