-
With the new NavigationStack introduced in iOS 16, whenever a new item (screen) is added to the navigation path, the new view for the screen slides left into place. Likewise, when you pop off an item from the navigation path, the current screen slides to the right to reveal the previous screen. However, if you popup off more than one item in the path, the slide animation is NOT performed, and the resulting view just instantly appears. Does this library "fix" or address this issue and allow the slide animation to occur when popping off multiple items from the path? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@rkonopka thanks for your question. I'm afraid the same behavior occurs even when using custom transitions. It could be possible to work around that bug via view introspection and ship it as part of this library. I'll explore this soon and come back to you with answer. |
Beta Was this translation helpful? Give feedback.
-
@rkonopka good news! I was able to come up with a workaround — see #44. Here's a working example (from https://stackoverflow.com/q/73753796/1922543): import NavigationTransitions
import SwiftUI
struct DemoPop: View {
@State private var path = NavigationPath()
var body: some View {
NavigationStack(path: $path) {
List {
Section("List One") {
NavigationLink("Navigate to View 1", value: "View 1")
NavigationLink("Navigate to View 2", value: "View 2")
}
}
.navigationDestination(for: String.self) { textDesc in
VStack {
Text(textDesc).padding()
Button("Navigate to View 3") {
path.append("View 3")
}.padding()
Button("Pop to Root View") {
path.removeLast(path.count)
}.padding()
}
}
.navigationTitle("Test Pop To Root")
}
.navigationTransition(.default) // ✨
}
}
struct DemoPop_Previews: PreviewProvider {
static var previews: some View {
DemoPop()
}
} The fix is available in version 0.7.1. |
Beta Was this translation helpful? Give feedback.
@rkonopka good news! I was able to come up with a workaround — see #44.
Here's a working example (from https://stackoverflow.com/q/73753796/1922543):