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
TabNavigator does not pass params to children when using NAVIGATE action within RESET action #2073
Comments
I have the same issue with |
@alexn777 You can call the init() function instead of navigate(). That worked for me.
|
@adkl Yes, it works. Thank you! |
Sorry I didn't see :) |
I'm now using '1.0.0-beta22' and the bug still exists. But @adkl 's workaround doesn't work anymore.
|
Well... now I have another workaround.
|
I'm also having this issue and the typings aren't allowing me to even use the workaround without overriding them with my own. |
Seems the reason your workaround works is here: https://github.com/react-navigation/react-navigation/blob/master/src/routers/TabRouter.js#L68
The NAVIGATE action isn't propagating the params to child routes. Changing this to:
fixes the issue for me, but I can't speak to the ramifications of this change. |
@jordanmkoncz Hi I am still facing this issue in v1.4.0. Please tell me what is wrong. I am using the workaround that you have suggested,but its not working. I have the following setup.
Inside my SplashScreen I am sending
Inside my
|
moving discussion over to react-navigation/rfcs#43 because this is not a bug (unless i'm totally misunderstanding, in which case please explain it to me on that rfc issue), but rather the behavior is not well explained and also not obvious |
Current Behavior
Suppose you have the following navigation structure:
If you dispatch a
NAVIGATE
action, for example:The result of this action is that the params from the
NAVIGATE
action will be passed down to all children of TabNavigatorA, i.e. ScreenA and ScreenB will receive the params from theNAVIGATE
action vianavigation.state.params
. This is working as expected.However, if you dispatch an equivalent
RESET
action, for example:The result of this action is that the params from the
NAVIGATE
action will not be passed down to any children of TabNavigatorA, i.e.navigation.state.params
will be undefined in ScreenA and ScreenB.Expected Behavior
The behaviour of a TabNavigator should be the same in both of the above examples since the
NAVIGATE
actions are identical, i.e. the params from theNAVIGATE
action should be passed down to all children in both of these cases.Notes
I believe this is the same problem as @TGNC describes here: #143 (comment). His workaround of dispatching an
INIT
action within theRESET
action (instead of aNAVIGATE
action) does seem to work for me, but I believe the expected behaviour I've described above is how it should work and you shouldn't need to use @TGNC's workaround to fix this issue.Your Environment
The text was updated successfully, but these errors were encountered: