stinsen icon indicating copy to clipboard operation
stinsen copied to clipboard

Pushing to stack when inside another navigation stack

Open jblanco-applaudostudios opened this issue 2 years ago • 1 comments

Hello, I'm currently having an issue when having two nested NavigationViewCoordinatable. Currently I have Coordinator1 that starts at its root, then I have a route that routes to Coordinator2, which is also a NavigationViewCoordinatable.

The problem is, if I don't define Coordinator2 as NavigationViewCoordinator<Coordinator2>, I cannot push to the stack, even though it is already inside its parent stack (Coordinator1). If I do define it as NavigationViewCoordinator<Coordinator2> I get duplicated Navigation Bars.

Is this behavior expected, how can I overcome this issue?

jblanco-applaudostudios avatar Oct 04 '21 06:10 jblanco-applaudostudios

The second part of your problem is intended behavior. If you embed a NavigationViewCoordinator inside another NavigationViewCoordinator twice you will get duplicated navigation bars, just like if in SwiftUI you would embed a NavigationView within another NavigationView, since basically NavigationViewCoordinator is just a wrapper to create one. I really don't understand what you mean with "cannot push to stack" though. For instance, check StinsenApp and how the User Registration flow is presented in the Unauthenticated Coordinator. It works fine there, I'm guessing that is what you're trying to accomplish? :)

rundfunk47 avatar Oct 04 '21 09:10 rundfunk47