Permalink
Browse files

Allow aspect ratio to expand beyond bounds of parent

Reviewed By: passy

Differential Revision: D4397547

fbshipit-source-id: d2b1ca7b096f2f17b3efbd8f47a50678bfe7bb5f
  • Loading branch information...
emilsjolander authored and facebook-github-bot committed Jan 10, 2017
1 parent da428d6 commit 7c2f8a9e14f4c36718c8721660c78d710a085f38
Showing with 10 additions and 4 deletions.
  1. +10 −4 ReactCommon/yoga/yoga/Yoga.c
@@ -2239,17 +2239,23 @@ static void YGNodelayoutImpl(const YGNodeRef node,
availableInnerWidth));
childHeightMeasureMode = YGMeasureModeExactly;
childHeight = fminf(childHeight, availableInnerHeight);
childWidth = childHeight * currentRelativeChild->style.aspectRatio;
// Parent size constraint should have higher priority than flex
if (YGNodeIsFlex(currentRelativeChild)) {
childHeight = fminf(childHeight, availableInnerHeight);
childWidth = childHeight * currentRelativeChild->style.aspectRatio;
}
} else {
childWidth = fmaxf(childHeight * currentRelativeChild->style.aspectRatio,
YGNodePaddingAndBorderForAxis(currentRelativeChild,
YGFlexDirectionRow,
availableInnerWidth));
childWidthMeasureMode = YGMeasureModeExactly;
childWidth = fminf(childWidth, availableInnerWidth);
childHeight = childWidth / currentRelativeChild->style.aspectRatio;
// Parent size constraint should have higher priority than flex
if (YGNodeIsFlex(currentRelativeChild)) {
childWidth = fminf(childWidth, availableInnerWidth);
childHeight = childWidth / currentRelativeChild->style.aspectRatio;
}
}
}

0 comments on commit 7c2f8a9

Please sign in to comment.