diff --git a/ReactCommon/yoga/yoga/Yoga.c b/ReactCommon/yoga/yoga/Yoga.c index d42854443cb..d032f1fb01f 100644 --- a/ReactCommon/yoga/yoga/Yoga.c +++ b/ReactCommon/yoga/yoga/Yoga.c @@ -2520,19 +2520,22 @@ static void YGNodelayoutImpl(const YGNodeRef node, // If the user didn't specify a width or height for the node, set the // dimensions based on the children. - if (measureModeMainDim == YGMeasureModeUndefined) { + if (measureModeMainDim == YGMeasureModeUndefined || + (node->style.overflow != YGOverflowScroll && measureModeMainDim == YGMeasureModeAtMost)) { // Clamp the size to the min/max size, if specified, and make sure it // doesn't go below the padding and border amount. node->layout.measuredDimensions[dim[mainAxis]] = YGNodeBoundAxis(node, mainAxis, maxLineMainDim, mainAxisParentSize, parentWidth); - } else if (measureModeMainDim == YGMeasureModeAtMost) { + } else if (measureModeMainDim == YGMeasureModeAtMost && + node->style.overflow == YGOverflowScroll) { node->layout.measuredDimensions[dim[mainAxis]] = fmaxf( fminf(availableInnerMainDim + paddingAndBorderAxisMain, YGNodeBoundAxisWithinMinAndMax(node, mainAxis, maxLineMainDim, mainAxisParentSize)), paddingAndBorderAxisMain); } - if (measureModeCrossDim == YGMeasureModeUndefined) { + if (measureModeCrossDim == YGMeasureModeUndefined || + (node->style.overflow != YGOverflowScroll && measureModeCrossDim == YGMeasureModeAtMost)) { // Clamp the size to the min/max size, if specified, and make sure it // doesn't go below the padding and border amount. node->layout.measuredDimensions[dim[crossAxis]] = @@ -2541,7 +2544,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, totalLineCrossDim + paddingAndBorderAxisCross, crossAxisParentSize, parentWidth); - } else if (measureModeCrossDim == YGMeasureModeAtMost) { + } else if (measureModeCrossDim == YGMeasureModeAtMost && + node->style.overflow == YGOverflowScroll) { node->layout.measuredDimensions[dim[crossAxis]] = fmaxf(fminf(availableInnerCrossDim + paddingAndBorderAxisCross, YGNodeBoundAxisWithinMinAndMax(node,