From bbeede82d36cd89657faf385aaa704f45443c326 Mon Sep 17 00:00:00 2001 From: Nishan Date: Fri, 9 Dec 2022 07:59:27 +0530 Subject: [PATCH 1/3] fix: remove gap if it's last element in line --- yoga/Yoga.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 88c77ab850..8b7b1c2bd2 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -2540,6 +2540,9 @@ static void YGJustifyMainAxis( const YGNodeRef child = node->getChild(i); const YGStyle& childStyle = child->getStyle(); const YGLayout childLayout = child->getLayout(); + const bool isLastChild = i == collectedFlexItemsValues.endOfLineIndex - 1; + // remove the gap if it is the last element of the line + betweenMainDim -= isLastChild ? gap : 0; if (childStyle.display() == YGDisplayNone) { continue; } From 60dd791dd8d56e0fdb978ac3357030c200a2c130 Mon Sep 17 00:00:00 2001 From: Nishan Date: Fri, 9 Dec 2022 10:31:58 +0530 Subject: [PATCH 2/3] nit --- yoga/Yoga.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 8b7b1c2bd2..1b5a5564a9 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -2542,7 +2542,9 @@ static void YGJustifyMainAxis( const YGLayout childLayout = child->getLayout(); const bool isLastChild = i == collectedFlexItemsValues.endOfLineIndex - 1; // remove the gap if it is the last element of the line - betweenMainDim -= isLastChild ? gap : 0; + if (isLastChild) { + betweenMainDim -= gap; + } if (childStyle.display() == YGDisplayNone) { continue; } From 97be2cedce9d5d50d08f68d913f9b6bb8c6b34fc Mon Sep 17 00:00:00 2001 From: Nishan Date: Sat, 10 Dec 2022 09:48:04 +0530 Subject: [PATCH 3/3] nit: clang format --- yoga/Yoga.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 1b5a5564a9..a66adec123 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -2543,7 +2543,7 @@ static void YGJustifyMainAxis( const bool isLastChild = i == collectedFlexItemsValues.endOfLineIndex - 1; // remove the gap if it is the last element of the line if (isLastChild) { - betweenMainDim -= gap; + betweenMainDim -= gap; } if (childStyle.display() == YGDisplayNone) { continue;