Measure nodes which have margin: auto and align-item: stretch
Summary: If you have a measurable node and set ```marign-left: auto``` + ```align-item:stretch``` on it, it won't get measured and they get a width/height of ```-(nan)```. This change fixes that behaviour. Fixes #644. Closes https://github.com/facebook/yoga/pull/645 Differential Revision: D6413512 Pulled By: emilsjolander fbshipit-source-id: 755febeb33bb0d4520ca6b3c28d56ac333e4a14d
This commit is contained in:
parent
1050e0b476
commit
5f99b1a55f
|
@ -2327,7 +2327,9 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||
availableInnerCrossDim) &&
|
||||
measureModeCrossDim == YGMeasureModeExactly &&
|
||||
!(isNodeFlexWrap && flexBasisOverflows) &&
|
||||
YGNodeAlignItem(node, currentRelativeChild) == YGAlignStretch) {
|
||||
YGNodeAlignItem(node, currentRelativeChild) == YGAlignStretch &&
|
||||
YGMarginLeadingValue(currentRelativeChild, crossAxis)->unit != YGUnitAuto &&
|
||||
YGMarginTrailingValue(currentRelativeChild, crossAxis)->unit != YGUnitAuto) {
|
||||
childCrossSize = availableInnerCrossDim;
|
||||
childCrossMeasureMode = YGMeasureModeExactly;
|
||||
} else if (!YGNodeIsStyleDimDefined(currentRelativeChild,
|
||||
|
@ -2363,7 +2365,9 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||
|
||||
const bool requiresStretchLayout =
|
||||
!YGNodeIsStyleDimDefined(currentRelativeChild, crossAxis, availableInnerCrossDim) &&
|
||||
YGNodeAlignItem(node, currentRelativeChild) == YGAlignStretch;
|
||||
YGNodeAlignItem(node, currentRelativeChild) == YGAlignStretch &&
|
||||
YGMarginLeadingValue(currentRelativeChild, crossAxis)->unit != YGUnitAuto &&
|
||||
YGMarginTrailingValue(currentRelativeChild, crossAxis)->unit != YGUnitAuto;
|
||||
|
||||
const float childWidth = isMainAxisRow ? childMainSize : childCrossSize;
|
||||
const float childHeight = !isMainAxisRow ? childMainSize : childCrossSize;
|
||||
|
|
Loading…
Reference in New Issue