-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Providing an action to navigate
is never dispatched, while trying to replace a screen
#5338
Comments
you can use |
also just wanted to mention that in the example 2 the replace action will attempt to replace SecondScreen with SecondScreen, so that's why you don't see anything happen |
@brentvatne Thank you for your help! |
hmm it seems like my snack doesn't show the latest change i made to it :( if you need help figuring it out i can rewrite it, sorry |
went ahead and rewrote it, should be fine now at https://snack.expo.io/@notbrent/reset-state |
@brentvatne Wow, thank you. This helps me a lot!😊 |
Current Behavior
I have a Stack with three screens (Root, First and Second). I'm trying to follow the docs to navigate to a screen while simultaneously dispatching a navigation action.
The goal is to navigate from the root screen to the first screen. After wards navigate from the First screen to the Second screen, but have the back button point to the HomeScreen again (as if the First screen never was in the stack in the first place).
Using the action parameter I'm trying to dispatch a stack action to reset the state to the desired state while the animation is playing.
The current behaviour is dependent on the way I attempt this. In the demo below you can read, see and try out all my attempts (on
FirstScreen
). It seems like the StackAction provided is never dispatched.Expected Behavior
What should be happening is the animation should play out and you should be able to directly go back from the SecondScreen to the HomeScreen, without crossing the FirstScreen.
- Include a screenshot if it makes sense.How to reproduce
See my attempts at demo and corresponding bugs in the demo.
https://snack.expo.io/SklozIBJE
If this isn't a bug and I'm just not capable of understanding the API could you kindly give a example how one would achieve this? (It's entirely possible that this is not a bug, but I'm just bad at understanding the docs).
Your Environment
The text was updated successfully, but these errors were encountered: