'SwiftUI List row color inconsistent while scrolling in a NavigationView
Solution 1:[1]
Use
@Environment(\.colorScheme) var colorScheme
struct YourView: View {
var body: some View {
Text("Your views")
.listRowBackground(
colorScheme == .light ? Color.white : Color(white: 0.09, opacity: 1)
)
}
}
colorScheme
is necessary to support dark mode.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |