I fixed the issue by using a button with a navigation link instead of just NavigationLink and now it doesn't pop to the root view when the parent's state changes. Here is the code:
struct CustomNavigationLink<Content, Destination>: View where Destination: View, Content: View {
let destination: Destination?
let content: () -> Content
@State private var isActive = false
init(destination: Destination, @ViewBuilder content: @escaping () -> Content) {
self.content = content
self.destination = destination
}
var body: some View {
ZStack {
NavigationLink(destination: destination, isActive: $isActive) {}
Button(action: {
self.isActive = true
}) {
content()
}
}
}
}
Post
Replies
Boosts
Views
Activity
Having the same issue on iOS 15, before updating it was working fine (on iOS 14.5), no popping back to the parent view