'SwiftUI NavigationView nests TabView auto pop
NavigationView nests TabView, I have a List, and push to the next page
When the application returns to the background and returns to the active state, the push page automatically pops up.
If TabView nests NavigationView, there will be no problem, but I want NavigationView to nest TabView, is there any way to solve it
struct ContentView: View {
var body: some View {
NavigationView {
TabView {
List {
ForEach(0..<30) { index in
RowView(index: index)
}
}
}
}
}
}
struct RowView: View {
var index: Int
@State var userViewActive: Int?
var body: some View {
NavigationLink {
Text("Hello, world!")
} label: {
Text("Hello, world!")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
