Fix issue where we were not applying flex end correctly when justifying (#1487)

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

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

The code here was just wrong. I changed it to be the same logic as the Justify:FlexStart case, but with the flex end sides. Then I get the position for the opposite edge since we need to write to flex start side.

Reviewed By: NickGerleman

Differential Revision: D51383792

fbshipit-source-id: 372835a44edff361dbd84dd92ff9f2ec844b9f9c
This commit is contained in:
Joe Vilches
2023-12-07 21:25:45 -08:00
committed by Facebook GitHub Bot
parent 897f9b7423
commit b573f91a38
5 changed files with 749 additions and 2 deletions

View File

@@ -31,8 +31,14 @@ static void justifyAbsoluteChild(
break;
case Justify::FlexEnd:
child->setLayoutPosition(
(parent->getLayout().measuredDimension(dimension(mainAxis)) -
child->getLayout().measuredDimension(dimension(mainAxis))),
getPositionOfOppositeEdge(
parent->getLayout().border(flexEndEdge(mainAxis)) +
parent->getLayout().padding(flexEndEdge(mainAxis)) +
child->getFlexEndMargin(
mainAxis, direction, containingBlockWidth),
mainAxis,
parent,
child),
flexStartEdge(mainAxis));
break;
case Justify::Center: