Hi,
I found a case that cause a list to never deselect the row when the back button is pressed.
In the following code I modally present a list. When you select a row another list is displayed. If you select a row of the second list and you go back the row will stay selected.
This is the code:
Does anyone know if there is a way to force the list to deselect the row when the back button is pressed?
Thank you
I found a case that cause a list to never deselect the row when the back button is pressed.
In the following code I modally present a list. When you select a row another list is displayed. If you select a row of the second list and you go back the row will stay selected.
This is the code:
Code Block struct ContentView: View { @State var modalVisible = false var body: some View { Button(action:{ self.modalVisible.toggle() }) { Text("Open modal") } .sheet(isPresented: $modalVisible) { NavigationView { List { NavigationLink("Item", destination: List { NavigationLink("Sub Item", destination: Text("If you go back the row will stay selected.")) }) } } } } }
Does anyone know if there is a way to force the list to deselect the row when the back button is pressed?
Thank you