Skip to content

Commit e0569bd

Browse files
committed
Update Divider to adapt to layout orientation (fixes #172)
1 parent 9e29399 commit e0569bd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SwiftCrossUI/Views/Divider.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/// in light mode it's black with 10% opacity.
44
public struct Divider: View {
55
@Environment(\.colorScheme) var colorScheme
6+
@Environment(\.layoutOrientation) var layoutOrientation
67

78
var color: Color {
89
switch colorScheme {
@@ -16,6 +17,9 @@ public struct Divider: View {
1617
public init() {}
1718

1819
public var body: some View {
19-
color.frame(height: 1)
20+
color.frame(
21+
width: layoutOrientation == .horizontal ? 1 : nil,
22+
height: layoutOrientation == .vertical ? 1 : nil
23+
)
2024
}
2125
}

0 commit comments

Comments
 (0)