From 3b1ad41c0bc9b310a03efa438bbd8a28bc43738b Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Thu, 26 Oct 2023 11:59:36 -0700 Subject: [PATCH] Simplify getting padding + border for cross axis in algorithm Summary: Reading through the sizing logic and this seemed a bit redundant/confusing. Lets use the same function we just used for the main axis for the cross axis as well so people do not think its special. Also we will need one less variable. The reason this was done it seems is because we need the leading padding + border elsewhere so this is technically a few less steps but this is cleaner Differential Revision: D50704177 --- .../ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp index 93256fb3005000..3e8524dfa63641 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp @@ -1606,12 +1606,10 @@ static void calculateLayoutImpl( const float paddingAndBorderAxisMain = paddingAndBorderForAxis(node, mainAxis, ownerWidth); + const float paddingAndBorderAxisCross = + paddingAndBorderForAxis(node, crossAxis, ownerWidth); const float leadingPaddingAndBorderCross = node->getInlineStartPaddingAndBorder(crossAxis, direction, ownerWidth); - const float trailingPaddingAndBorderCross = - node->getInlineEndPaddingAndBorder(crossAxis, direction, ownerWidth); - const float paddingAndBorderAxisCross = - leadingPaddingAndBorderCross + trailingPaddingAndBorderCross; MeasureMode measureModeMainDim = isMainAxisRow ? widthMeasureMode : heightMeasureMode;