Permalink
Browse files

Dont constrain absolute children to zero sized parents

Reviewed By: gkassabli

Differential Revision: D4453612

fbshipit-source-id: e8269521560d2f42b2d6f0f0ff264a1605a57d79
  • Loading branch information...
emilsjolander authored and facebook-github-bot committed Jan 25, 2017
1 parent 9a9ecea commit 018b853b9b90d932cd4882ccd9fe73f6ea08c590
Showing with 4 additions and 5 deletions.
  1. +4 −5 ReactCommon/yoga/yoga/Yoga.c
@@ -1431,11 +1431,10 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
childHeightMeasureMode =
YGFloatIsUndefined(childHeight) ? YGMeasureModeUndefined : YGMeasureModeExactly;
// According to the spec, if the main size is not definite and the
// child's inline axis is parallel to the main axis (i.e. it's
// horizontal), the child should be sized using "UNDEFINED" in
// the main size. Otherwise use "AT_MOST" in the cross axis.
if (!isMainAxisRow && YGFloatIsUndefined(childWidth) && widthMode != YGMeasureModeUndefined) {
// If the size of the parent is defined then try to constrain the absolute child to that size
// as well. This allows text within the absolute child to wrap to the size of its parent.
// This is the same behavior as many browsers implement.
if (!isMainAxisRow && YGFloatIsUndefined(childWidth) && widthMode != YGMeasureModeUndefined && width > 0) {
childWidth = width;
childWidthMeasureMode = YGMeasureModeAtMost;
}

0 comments on commit 018b853

Please sign in to comment.