Highlight on List item keeps remaining when it is inside TabView of PageTabViewStyle

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


Code Block swift
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")
    }
  }
}

Replies

I'm having the same issue. It works on iOS13 but on iOS14 it shows this strange behavior. I wrote a workaround:
Instead of the List, use a VStack or LazyVstack and but the row/cell (in your case  Text("Row \(row)")) inside an HStack with an Image(systemName: "chevron.right") .foregroundColor(.gray). Put horizontal Padding on the HStack and Divider().padding(.horizontal) below the HStack. The NavigationLink then needs the .foregroundColor(.black) modifier.

Looks quite like a list but it doesn't run as smooth.

And it works on iOS14, when the List is outside of any View. Thats weird.