I want to show the original color of my list item, but it seems NavigationLink has an overlay above it. And I try .buttonStyle(PlainButtonStyle())
, but it didn't help. Using both iOS 16+ and iOS 15+, same result.
Please look the screenshots for what I got.
Without NavigationLink
var colors: [Color] = [.red, .blue, .yellow]
var body: some View {
VStack {
List {
ForEach(colors, id: \.self) { color in
color
}
.listRowInsets(EdgeInsets())
}
.listStyle(PlainListStyle())
}
.padding(.horizontal)
}
With NavigationLink
var colors: [Color] = [.red, .blue, .yellow]
var body: some View {
VStack {
List {
ForEach(colors, id: \.self) { color in
NavigationLink {
// Some details view
} label: {
color
// Custom view in my real project
}
// No help
.buttonStyle(PlainButtonStyle())
}
.listRowInsets(EdgeInsets())
}
.listStyle(PlainListStyle())
}
.padding(.horizontal)
}