Cannot pass params to screens on navigate
See original GitHub issueVersion
Tell us which versions you are using:
- react-native-router-flux v4.0.0-beta.28 (v3 is not supported)
- react-native v0.52.0
Expected behaviour
For the app to navigate to the new screen with the params as props.
Actual behaviour
Error code undefined is not a function (evaluating '_this2[type](routeName, res)')
Steps to reproduce
The code for my router looks like this:
<Scene
key="Filters"
component={Filters}
hideNavBar
/>
<Scene
key="FiltersList"
component={FiltersList}
hideNavBar
/>
In my Filters screen, I want to navigate to the FiltersList and pass props but I get the error code I mentioned.
This is what my action looks like:
<ListItem
icon
button={true}
onPress={() => Actions.FiltersList({type: 'controller'})}
/>
<Body>
<Text>Controllers</Text>
</Body>
<Right>
<Icon name="ios-arrow-forward" />
</Right>
</ListItem>
Whenever I remove the params, then the app navigates to FiltersList without a problem but if I try to add the params I need then my app crash.
Any solutions around this problem?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
I can't pass parameters using react-navigation in ...
I can navigate but I can't get the params. Below is how I try to get the parameters in the target stack navigator...
Read more >Passing parameters to routes
Pass params to a route by putting them in an object as a second parameter to the navigation.navigate function: navigation.navigate('RouteName', { /* params...
Read more >Params not being passed when navigating between Stacks ...
When navigating to the second stack, params are being passed. It doesn't appear that those params are being passed to the new screen....
Read more >Why you should not use useNavigation
First, we need to define its list of screens with their associated navigation parameters. In our example, we are not going to use...
Read more >Passing the value from one screen to another in React Native
Pass params to a route by putting them in an object as a second parameter to the navigation.navigate function from First Screen
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
It is because
type
is a prop already used in this library (i.e.reset
,refresh
etc…), this is why it was not working.A quick look at the API would have helped you.
If anybody had this issue, please use the
react-navigation
API that is provided in this package.I wasn’t really sure about what the documentation meant when it mentions the API… I guess for people familiar with the package there wouldn’t be any need to mention it but the react-navigation API is accessible from Actions object.
Something along the lines of: