Skip to content

Commit

Permalink
Merge pull request #7 from pteasima/master
Browse files Browse the repository at this point in the history
Fix layout of NightAndDay by replacing ZStack with .background
  • Loading branch information
finestructure authored May 23, 2020
2 parents 102063c + 9d2ea26 commit 3d2c388
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 3d2c388

Please sign in to comment.