Fix issue where absolute children of row-reverse containers would inset on the wrong side (#1446)
Summary: X-link: https://github.com/facebook/react-native/pull/41293 Pull Request resolved: https://github.com/facebook/yoga/pull/1446 NickGerleman pointed out that my recent changes to fix the slew of row-reverse problems in Yoga actually ended up regressing some parts. Specifically, absolute children of row-reverse containers would have their insets set to the wrong side. So if you set left: 10 it would apply it to the right. Turns out, in `layoutAbsoluteChild` there were cases where we were applying inlineStart/End values to the flexStart/End edge, which can never be right. So I changed the values to also be flexStart/End as the fix here. Reviewed By: NickGerleman Differential Revision: D50945475 fbshipit-source-id: 290de06dcc04e8e644a3a32c127af12fdabb2f75
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c09554056d
commit
283e3203f6
@@ -99,6 +99,15 @@ YGEdge Node::getInlineEndEdgeUsingErrata(
|
||||
: inlineEndEdge(flexDirection, direction);
|
||||
}
|
||||
|
||||
bool Node::isFlexStartPositionDefined(FlexDirection axis) const {
|
||||
const YGEdge startEdge = flexStartEdge(axis);
|
||||
auto leadingPosition = isRow(axis)
|
||||
? computeEdgeValueForRow(style_.position(), YGEdgeStart, startEdge)
|
||||
: computeEdgeValueForColumn(style_.position(), startEdge);
|
||||
|
||||
return leadingPosition.isDefined();
|
||||
}
|
||||
|
||||
bool Node::isInlineStartPositionDefined(FlexDirection axis, Direction direction)
|
||||
const {
|
||||
const YGEdge startEdge = getInlineStartEdgeUsingErrata(axis, direction);
|
||||
@@ -109,6 +118,15 @@ bool Node::isInlineStartPositionDefined(FlexDirection axis, Direction direction)
|
||||
return leadingPosition.isDefined();
|
||||
}
|
||||
|
||||
bool Node::isFlexEndPositionDefined(FlexDirection axis) const {
|
||||
const YGEdge endEdge = flexEndEdge(axis);
|
||||
auto trailingPosition = isRow(axis)
|
||||
? computeEdgeValueForRow(style_.position(), YGEdgeEnd, endEdge)
|
||||
: computeEdgeValueForColumn(style_.position(), endEdge);
|
||||
|
||||
return !trailingPosition.isUndefined();
|
||||
}
|
||||
|
||||
bool Node::isInlineEndPositionDefined(FlexDirection axis, Direction direction)
|
||||
const {
|
||||
const YGEdge endEdge = getInlineEndEdgeUsingErrata(axis, direction);
|
||||
@@ -119,6 +137,15 @@ bool Node::isInlineEndPositionDefined(FlexDirection axis, Direction direction)
|
||||
return trailingPosition.isDefined();
|
||||
}
|
||||
|
||||
float Node::getFlexStartPosition(FlexDirection axis, float axisSize) const {
|
||||
const YGEdge startEdge = flexStartEdge(axis);
|
||||
auto leadingPosition = isRow(axis)
|
||||
? computeEdgeValueForRow(style_.position(), YGEdgeStart, startEdge)
|
||||
: computeEdgeValueForColumn(style_.position(), startEdge);
|
||||
|
||||
return resolveValue(leadingPosition, axisSize).unwrapOrDefault(0.0f);
|
||||
}
|
||||
|
||||
float Node::getInlineStartPosition(
|
||||
FlexDirection axis,
|
||||
Direction direction,
|
||||
@@ -131,6 +158,15 @@ float Node::getInlineStartPosition(
|
||||
return resolveValue(leadingPosition, axisSize).unwrapOrDefault(0.0f);
|
||||
}
|
||||
|
||||
float Node::getFlexEndPosition(FlexDirection axis, float axisSize) const {
|
||||
const YGEdge endEdge = flexEndEdge(axis);
|
||||
auto trailingPosition = isRow(axis)
|
||||
? computeEdgeValueForRow(style_.position(), YGEdgeEnd, endEdge)
|
||||
: computeEdgeValueForColumn(style_.position(), endEdge);
|
||||
|
||||
return resolveValue(trailingPosition, axisSize).unwrapOrDefault(0.0f);
|
||||
}
|
||||
|
||||
float Node::getInlineEndPosition(
|
||||
FlexDirection axis,
|
||||
Direction direction,
|
||||
@@ -143,6 +179,15 @@ float Node::getInlineEndPosition(
|
||||
return resolveValue(trailingPosition, axisSize).unwrapOrDefault(0.0f);
|
||||
}
|
||||
|
||||
float Node::getFlexStartMargin(FlexDirection axis, float widthSize) const {
|
||||
const YGEdge startEdge = flexStartEdge(axis);
|
||||
auto leadingMargin = isRow(axis)
|
||||
? computeEdgeValueForRow(style_.margin(), YGEdgeStart, startEdge)
|
||||
: computeEdgeValueForColumn(style_.margin(), startEdge);
|
||||
|
||||
return resolveValue(leadingMargin, widthSize).unwrapOrDefault(0.0f);
|
||||
}
|
||||
|
||||
float Node::getInlineStartMargin(
|
||||
FlexDirection axis,
|
||||
Direction direction,
|
||||
@@ -155,6 +200,15 @@ float Node::getInlineStartMargin(
|
||||
return resolveValue(leadingMargin, widthSize).unwrapOrDefault(0.0f);
|
||||
}
|
||||
|
||||
float Node::getFlexEndMargin(FlexDirection axis, float widthSize) const {
|
||||
const YGEdge endEdge = flexEndEdge(axis);
|
||||
auto trailingMargin = isRow(axis)
|
||||
? computeEdgeValueForRow(style_.margin(), YGEdgeEnd, endEdge)
|
||||
: computeEdgeValueForColumn(style_.margin(), endEdge);
|
||||
|
||||
return resolveValue(trailingMargin, widthSize).unwrapOrDefault(0.0f);
|
||||
}
|
||||
|
||||
float Node::getInlineEndMargin(
|
||||
FlexDirection axis,
|
||||
Direction direction,
|
||||
|
Reference in New Issue
Block a user