From bbeede82d36cd89657faf385aaa704f45443c326 Mon Sep 17 00:00:00 2001 From: Nishan Date: Fri, 9 Dec 2022 07:59:27 +0530 Subject: [PATCH] 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 88c77ab8..8b7b1c2b 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; }