Why immediately dismiss when Tree Based navigation with navigationDestination(item: destination:)
#3264
-
Hello, I am working with TCA and utilizing TreeBased Navigation for navigation. I am wrapping the RootView with a However, the problem arises when I set the view with the NavigationStack as the destination and pass the Reducer as an init parameter. In this case, the dismiss action is passed to the parent reducer, causing the screen to disappear immediately upon appearing. The strange thing is that if I send an action to the reducer that triggers ifLet again, the navigation works correctly. Could you please help me understand what the issue might be? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @MaraMincho, you have nested For example, The Further, the |
Beta Was this translation helpful? Give feedback.
Hi @MaraMincho, you have nested
NavigationStack
s in this code sample, and that is not a valid thing to do, even in vanilla SwiftUI.For example, The
RootNavigationView
has a stack at its root, and then it can navigate toChildNavigationView
, which also has a stack. You will need to refactor this so that there is only one singleNavigationStack
.Further, the
navigationDestination(item:)
API in SwiftUI is quite buggy when it comes to multiple levels of navigation. You typically cannot deep link more than 1 level.