-
-
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
Passing params to nested navigators #6613
Comments
Please provide a full repro |
This shows the issue well. Pressing the text "Navigate to screen B" will navigate to ScreenB, which shows the previously added params. Pressing the text "Navigate to screen C" will navigate to Stack2, which in turn mounts ScreenC. On ScreenC the params object is undefined. |
My bad, thanks for your help! |
@satya164 sorry for interrupting, but what's a workaround for 4 version? This is working only for 5 version |
Even for version 5 I couldn't get this to work. I think I'll use UseContext as I saw suggested on another related thread... |
@raajnadar, I must have read that link at least 10 times... still doesn't work... Parent stack:
I'm trying to move from a screen inside the tab navigator, to one inside the stack as follows -:
And accessing the params as follows -:
Navigation works. But route.params.currentItem is undefined... |
Can you create a snack demo I can help you! PS: I created an example https://snack.expo.io/@raajnadar/pass-params-from-stack-nav-to-tab-nav check for screen name & spelling |
Check line no 66, name is wrong.
|
Yes, I saw that error after sending the snak, thats why I delete it. Here is the snak link (sory for the deletion y tried to delete it before your answer). For others, as @raajnadar said be sure to be using the correct screen name. |
What is the solution? i have the same problem that thijs-qv |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
If you are navigating from/to/past a modal screen, change that in some way. That was my problem, and once I reorganized the screens to not require navigation to/from modal components built on top of the screens in the navigator, passing params as defined in the documents finally worked. |
Solved my issue |
Current Behavior
Params are not passed between nested navigators.
Expected Behavior
Access to the passed params via the route.params object.
How to reproduce
TabNavigator
**StackNavigator
****Screen A
****Screen B
**StackNavigator
****Screen C
When Navigating from screen A or B to C (or vice versa) with props.navigation.navigate('C', {myParam: myValue}), route.params is undefined on screen C. When navigating from A to B the params do get passed. Is there any way to access these props on screen C?
I have found these threads which I believe deal with the same issue:
issue 4811
rfc 43
How can I pass params from screen A to C?
If needed I will create an example project which shows the issue.
The text was updated successfully, but these errors were encountered: