fix: remove gap if it's last element in line

This commit is contained in:
Nishan
2022-12-09 07:59:27 +05:30
parent 35f3335efc
commit bbeede82d3

View File

@@ -2540,6 +2540,9 @@ static void YGJustifyMainAxis(
const YGNodeRef child = node->getChild(i); const YGNodeRef child = node->getChild(i);
const YGStyle& childStyle = child->getStyle(); const YGStyle& childStyle = child->getStyle();
const YGLayout childLayout = child->getLayout(); 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) { if (childStyle.display() == YGDisplayNone) {
continue; continue;
} }