Skip to content

Commit

Permalink
Fix layout of NightAndDay by replacing ZStack with .background
Browse files Browse the repository at this point in the history
  • Loading branch information
pteasima committed May 23, 2020
1 parent 102063c commit 9d2ea26
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Sources/Gala/Gala.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ import SwiftUI
public func NightAndDay<A: View>(_ name: String? = nil, @ViewBuilder items: @escaping () -> A) -> some View {
ForEach(ColorScheme.allCases, id: \.self) { scheme in
// Credit https://twitter.com/heckj/status/1239968146682863618
ZStack {
if scheme == .dark {
Color.black
} else {
Color.white
}
items()
}
items()
.background(scheme == .dark ? Color.black : .white)
.previewDisplayName(name.map { "\($0) \(scheme)" } ?? "\(scheme)")
.environment(\.colorScheme, scheme)
}
Expand Down

0 comments on commit 9d2ea26

Please sign in to comment.