Fix issue where paddingStart and paddingEnd were swapped with row reverse (#1426)

Summary:
X-link: https://github.com/facebook/react-native/pull/41023

Pull Request resolved: https://github.com/facebook/yoga/pull/1426

Just like D50140503 where marginStart and marginEnd were not working with row reverse, paddingStart and paddingEnd are not working either with row reverse either. The solution is similar - we were checking the flex item layout starting/ending edges and not the general layout starting/ending edges. This change makes it so that we look at the proper edge according to what direction is set.

One caveat is that in the case of padding (and also border) there is a callsite that actually wants to get the flex item layout's leading/trailing padding and not the one dictated by direction. So, I made a new function to accommodate this and just swapped that callsite out.

Reviewed By: NickGerleman

Differential Revision: D50348995

fbshipit-source-id: 85717df23de7cf5f66b38d3ff28435b053a4e68e
This commit is contained in:
Joe Vilches
2023-10-17 20:30:16 -07:00
committed by Facebook GitHub Bot
parent b558059b74
commit 7502595bef
3 changed files with 67 additions and 14 deletions

View File

@@ -1535,13 +1535,17 @@ static void calculateLayoutImpl(
node->getInlineEndBorder(flexColumnDirection, direction), YGEdgeBottom);
node->setLayoutPadding(
node->getFlexStartPadding(flexRowDirection, ownerWidth), startEdge);
node->getInlineStartPadding(flexRowDirection, direction, ownerWidth),
startEdge);
node->setLayoutPadding(
node->getFlexEndPadding(flexRowDirection, ownerWidth), endEdge);
node->getInlineEndPadding(flexRowDirection, direction, ownerWidth),
endEdge);
node->setLayoutPadding(
node->getFlexStartPadding(flexColumnDirection, ownerWidth), YGEdgeTop);
node->getInlineStartPadding(flexColumnDirection, direction, ownerWidth),
YGEdgeTop);
node->setLayoutPadding(
node->getFlexEndPadding(flexColumnDirection, ownerWidth), YGEdgeBottom);
node->getInlineEndPadding(flexColumnDirection, direction, ownerWidth),
YGEdgeBottom);
if (node->hasMeasureFunc()) {
measureNodeWithMeasureFunc(