mirror of
https://github.com/status-im/react-native.git
synced 2025-02-24 23:28:12 +00:00
BREAKING - Fix sizing of container with child overflowing parent
Reviewed By: mmmulani Differential Revision: D4182141 fbshipit-source-id: c73fd15d2577ab846fc8a202d529d0e6e1207b75
This commit is contained in:
parent
893941e116
commit
8d2a034f9c
@ -985,7 +985,9 @@ static inline YGDirection YGNodeResolveDirection(const YGNodeRef node,
|
|||||||
|
|
||||||
static float YGBaseline(const YGNodeRef node) {
|
static float YGBaseline(const YGNodeRef node) {
|
||||||
if (node->baseline != NULL) {
|
if (node->baseline != NULL) {
|
||||||
const float baseline = node->baseline(node, node->layout.measuredDimensions[YGDimensionWidth], node->layout.measuredDimensions[YGDimensionHeight]);
|
const float baseline = node->baseline(node,
|
||||||
|
node->layout.measuredDimensions[YGDimensionWidth],
|
||||||
|
node->layout.measuredDimensions[YGDimensionHeight]);
|
||||||
YG_ASSERT(!YGFloatIsUndefined(baseline), "Expect custom baseline function to not return NaN")
|
YG_ASSERT(!YGFloatIsUndefined(baseline), "Expect custom baseline function to not return NaN")
|
||||||
return baseline;
|
return baseline;
|
||||||
}
|
}
|
||||||
@ -2672,19 +2674,22 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
|
|
||||||
// If the user didn't specify a width or height for the node, set the
|
// If the user didn't specify a width or height for the node, set the
|
||||||
// dimensions based on the children.
|
// 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
|
// Clamp the size to the min/max size, if specified, and make sure it
|
||||||
// doesn't go below the padding and border amount.
|
// doesn't go below the padding and border amount.
|
||||||
node->layout.measuredDimensions[dim[mainAxis]] =
|
node->layout.measuredDimensions[dim[mainAxis]] =
|
||||||
YGNodeBoundAxis(node, mainAxis, maxLineMainDim, mainAxisParentSize, parentWidth);
|
YGNodeBoundAxis(node, mainAxis, maxLineMainDim, mainAxisParentSize, parentWidth);
|
||||||
} else if (measureModeMainDim == YGMeasureModeAtMost) {
|
} else if (measureModeMainDim == YGMeasureModeAtMost &&
|
||||||
|
node->style.overflow == YGOverflowScroll) {
|
||||||
node->layout.measuredDimensions[dim[mainAxis]] = fmaxf(
|
node->layout.measuredDimensions[dim[mainAxis]] = fmaxf(
|
||||||
fminf(availableInnerMainDim + paddingAndBorderAxisMain,
|
fminf(availableInnerMainDim + paddingAndBorderAxisMain,
|
||||||
YGNodeBoundAxisWithinMinAndMax(node, mainAxis, maxLineMainDim, mainAxisParentSize)),
|
YGNodeBoundAxisWithinMinAndMax(node, mainAxis, maxLineMainDim, mainAxisParentSize)),
|
||||||
paddingAndBorderAxisMain);
|
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
|
// Clamp the size to the min/max size, if specified, and make sure it
|
||||||
// doesn't go below the padding and border amount.
|
// doesn't go below the padding and border amount.
|
||||||
node->layout.measuredDimensions[dim[crossAxis]] =
|
node->layout.measuredDimensions[dim[crossAxis]] =
|
||||||
@ -2693,7 +2698,8 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
totalLineCrossDim + paddingAndBorderAxisCross,
|
totalLineCrossDim + paddingAndBorderAxisCross,
|
||||||
crossAxisParentSize,
|
crossAxisParentSize,
|
||||||
parentWidth);
|
parentWidth);
|
||||||
} else if (measureModeCrossDim == YGMeasureModeAtMost) {
|
} else if (measureModeCrossDim == YGMeasureModeAtMost &&
|
||||||
|
node->style.overflow == YGOverflowScroll) {
|
||||||
node->layout.measuredDimensions[dim[crossAxis]] =
|
node->layout.measuredDimensions[dim[crossAxis]] =
|
||||||
fmaxf(fminf(availableInnerCrossDim + paddingAndBorderAxisCross,
|
fmaxf(fminf(availableInnerCrossDim + paddingAndBorderAxisCross,
|
||||||
YGNodeBoundAxisWithinMinAndMax(node,
|
YGNodeBoundAxisWithinMinAndMax(node,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user