Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pop all controllers including the root one in one step from a child router? #438

Closed
kaciula opened this issue Jun 7, 2018 · 3 comments

Comments

@kaciula
Copy link

kaciula commented Jun 7, 2018

As it is said in the title, I want to pop all controllers from a child router in one go. What I am doing now is calling popToRoot(), setPopsLastView(true) and popCurrentController(). But this means the root controller calls onCreateView() right before I pop it and also the changehandler of the root controller is called. It's not visually appealing.

So I want a method that pops ALL controllers from a child router in one single step. Is this possible?

@chris6647
Copy link

The only solution I know of, is to do something like the RouterPagerAdapter does, or as I do in my BottomNavigationController (#316) and call removeChildRouter(childRouter) to destroy the childRouter, and then recreate it.

Otherwise, depending on what exactly you're trying to achieve, setting a new backstack all together may be good enough for you.

@kaciula
Copy link
Author

kaciula commented Jun 7, 2018

I did try setting an empty backstack but the visible controllers were not popped from the screen for some reason.

Will try the removeChildRouter() approach. Thanks.

@kaciula
Copy link
Author

kaciula commented Jun 7, 2018

removeChildRouter() was exactly what I needed. Thanks.

@kaciula kaciula closed this as completed Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants