Passing props to nested tab scenes
See original GitHub issueVersion
Tell us which versions you are using:
- react-native-router-flux v4.0.0-beta26
- react-native v0.50.3
Expected behaviour
When navigated from a login screen to a nested scene with tabs, all children tab scenes should have a prop passed to the parent scene by Actions
Actual behaviour
The prop cannot be passed to the parent scene. It will work as expected if I pass it to a child scene using Actions, but I want the prop to be available to all children tab scenes
Steps to reproduce
For non-obvious bugs, please fork this component, modify Example project to reproduce your issue and include link here.
- Sign in with any username and password
- navigate to create trip tap
- hit create trip, alert(this.props.user_id) is undefined
My declarations of the Scenes hierarchy
<Scene key = "main" tabs = {true} hideNavBar = {true} >
<Scene key = "feedTab" hideNavBar = {true} title = " " iconName = "Feed" icon = {TabIcon} >
<Scene key ="home" component = {Feed} title = "Home"/>
</Scene>
<Scene key = "createTripTab" hideNavBar = {true} title = " " iconName = "Create Trip" icon = {TabIcon}>
<Scene key = "createTrip" component = {CreateTrip} title = "Create Trip" />
</Scene>
<Scene key = "findHostTab" hideNavBar = {true} title = " " iconName = "Find Host" icon = {TabIcon} >
<Scene key = "findHost" component = {FindHost} title = "Find Host" />
</Scene>
<Scene key = "profileTab" hideNavBar = {true} title = " " iconName = "Profile" icon = {TabIcon} >
<Scene key = "profile" component = {Profile} title = "Profile" />
</Scene>
</Scene>
Actions.main({user_id: json.user_id})
doesnt work while Actions.createTripTab({user_id: json.user_id})
works
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
React Native Passing Props through Nested Navigators
I would ideally like to pass props (the data object) to both the Info and Chapter URIs under the tab navigator. I assume...
Read more >Nested Tabs in ReactJS - GeeksforGeeks
In this article, we will see how to create nested tabs using React Tabs which is an accessible and easy tab component for...
Read more >React router v6 pass props on Link click - YouTube
In this video, I am walking through React Router v6, mainly using params, passing value from params, and showing the values.
Read more >Learn how to handle nested routes and nested content using ...
React router pass the match props, we retrieve the user info using the userName value from our data. Showing nested routes as tab...
Read more >Navigation prop reference
It's important to highlight the navigation prop is not passed in to all components; ... jumpTo - go to a specific screen in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes! I found the problem in ‘Tab’. Tabs are ‘wrapped’ by default - i.e. all children are wrapped by Stack with own nav bar. You may disable wrapping by using wrap={false} for Tabs and check passing props again.
<Scene key="Scene" tabs={true} wrap={false}> <Scene key="someTab" component={SomeTab} title="SomeTab" icon={TabIcon}/> <Scene key="Modal" component={Modal} title="Modal" hideNavBar direction="vertical"/> </Scene>
Here props are find when passing from someTab to Modal via Actions.Modal({someProp: theProp})
Please check Example project and TabView.js with
Actions.tab_5_1({ data: 'test!' })