Post not yet marked as solved
Post marked as unsolved with 1 replies, 806 views
I have List inside a TabView.
If you tap an item in the list, the item will be highlighted and you will be navigated to destination by NavigationLink.
The strange behavior is that when you get back to previous screen, the item you tapped is still highlighted.
It occurs only in TabView with .tabViewStyle(PageTabViewStyle())
How can reset highlighting on the item?
Xcode: 12.0
struct ContentView: View {
@State private var selectedIndex = 0
var body: some View {
NavigationView {
TabView(selection: $selectedIndex) {
List {
ForEach(0..<100, id: \.self) { row in
NavigationLink(
destination: Text("Row \(row)"),
label: {
Text("Row \(row)")
}
)
}
}
.tag(0)
}
.tabViewStyle(PageTabViewStyle())
.navigationBarTitle("List")
}
}
}