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
Independant navigator feature is broken #9080
Comments
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
Can you verify that the issue still exists after upgrading to the latest versions of these packages? |
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
Can you verify that the issue still exists after upgrading to the latest versions of these packages? |
Here's the commit that changed resetRoot to cause a crash. Our @react-navigation/* versions are not latest because we are forced to lock the core version to 5.13.2, in order to avoid crashing the app. However, the Snack I provided is using the latest versions |
this issue is about advanced but undocumented
<NavigationContainer independent={true} />
feature. We use it on purpose, and our goal is not to achieve regular nested navigation.Current Behavior
When using
<NavigationContainer independent={true} />
, the code will crash or give invalid results when you attempt to use any of the *RootState functions provided by the navigation ref. Eg. getRootState, resetRoot etc. getCurrentRoute is also affected, as it uses getRootState.Issue is caused by the state not having root key at all. resetRoot used to work before 5.14, as it operated directly on state. Now it tries to get root value from state and throws NOT_INITIALIZED_ERROR.
resetRoot -> crash
getRootState -> undefined
getCurrentRoute -> undefined
It also seems that onStateChange is never called with state value.
Expected Behavior
*RootState functions should work correctly and operate on the root state of the independant navigation.
How to reproduce
By using independent={true} and trying to use functions mentioned above.
https://snack.expo.io/@njaah/react-navigation---independant
Your Environment
The text was updated successfully, but these errors were encountered: