-
-
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
Crash when reset from nested navigator #6715
Comments
The navigation.dispatch({
...CommonActions.reset({
index: 0,
routes: [{ name: 'compat-api', key: 'whatever' }],
}),
target: 'state.key-of-the-navigator'
}); Also, here the top-level navigator is a drawer navigator. Not the stack navigator whose state you're trying to reset. |
Ah I see. It's not ideal because the screens would need to know about how the navigation is structured.
|
In this case you're trying to reset state of a parent stack navigator which is not root. Without key, there'd be no way to know which navigator to reset. But reset is usually for advanced tasks, so I think it's okay that it requires additional knowledge. We could add another
The key should be generated automatically if you don't provide them. |
I think
In my testing, the keys are missing from the state after |
It's how the library works. The state can be in 2 modes: stale, and non-stale (denoted by the |
What you said works fine with
|
Current Behavior
The following exception is thrown when tries to
reset
app to top-level from nested navigator:Expected Behavior
App should be reset to the destination state.
How to reproduce
reset
code to the example app:Your Environment
The text was updated successfully, but these errors were encountered: