Closed mjurkus closed 6 years ago
There is no such method as getCurrentTopScreen in Navigator
. You can only pass commands to a navigator but not query it for something. The reason is that NavigationContext
may be not bound yet when you call methods of a navigator.
You can register TransitionListener
using NavigationContext
to track when a current screen is changed and store this screen somewhere.
I suppose it will be useful to have some commands for more complex manipulations with a screen stack (like that conditional goBack), or even an ability for users to create their own commands. I will think in this direction.
When you put it that way - it makes sense.
I'll try to utilize listeners for my purpose.
Custom/pluggable commands sounds really good.
What would be the best approach to solve case as described below:
I have fragments/screens [
A
,B
,C
,D
] in backstack.D
is currently active.Given, that I don't know what fragments are currently in backstack I want to navigate to
E
, but also remove from backstackD
,C
,B
if they are there. So that end result would be [A
,E
]Intention is that user shouldn't see some flow that is no longer relevant to him. And so, that he wouldn't be able to navigate to it via
goBack()
I imagine something that. Does it make sense?