Skip to content

Commit abfaad4

Browse files
committed
Fix accidentally inverted condition (for Group stack layout participation check)
The check was backwards which meant that even Groups with no visible children would participate in stack layout participation, so wrapping a bunch of children in a Group wasn't a layout preserving operation.
1 parent 9b6f990 commit abfaad4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Sources/SwiftCrossUI/LayoutSystem.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,19 @@ public enum LayoutSystem {
233233
}
234234
}
235235

236+
// If the stack has been told to inherit its stack layout participation
237+
// and all of its children are hidden, then the stack itself also
238+
// shouldn't participate in stack layouts.
239+
let shouldGetIgnoredInStackLayouts =
240+
inheritStackLayoutParticipation && isHidden.allSatisfy { $0 }
236241
return ViewSize(
237242
size: size,
238243
idealSize: idealSize,
239244
minimumWidth: minimumWidth,
240245
minimumHeight: minimumHeight,
241246
maximumWidth: maximumWidth,
242247
maximumHeight: maximumHeight,
243-
participateInStackLayoutsWhenEmpty:
244-
inheritStackLayoutParticipation
245-
&& isHidden.allSatisfy { $0 }
248+
participateInStackLayoutsWhenEmpty: !shouldGetIgnoredInStackLayouts
246249
)
247250
}
248251
}

0 commit comments

Comments
 (0)