Best way to access Navigation prop with renderItem function
See original GitHub issueHi, this project looks awesome but I had a quick question about the new renderItem
function.
I would like to pass the navigation prop down to my individual SliderEntry
items, but can’t seem to find the best way to do so. I tried doing something like this, but the renderItem
function in this example doesn’t seem to take any other arguments. I am working off of the example in this repo.
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Access the navigation prop from any component
Access the navigation prop from any component ; * as React from 'react'; ; import { Button } from 'react-native'; ; function GoToButton({...
Read more >Passing Navigator object in renderItem - react native
Instead of passing the navigation prop, you can try using the withNavigation HOC. Where your List Component is defined:
Read more >Passing Props to Another Screen Using React Navigation
Yo! In todays video we're PUSHIN' P!!!! and we're also gonna be learning how to work with navigation props. and pass anime ...
Read more >SectionList - React Native
Rendered in between each item, but not at the top or bottom. By default, highlighted , section , and [leading/trailing][Item/Section] props are ...
Read more >Getting Started with React Navigation v6 and TypeScript in ...
If you are using @react-navigation/stack , you can use StackScreenProps instead of StackNavigationProp . Adding type checks for route params. To ...
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
@pcooney10 @lucienboillod Hey guys, here’s my solution for this:
In your Carousel:
Adding the bind allows the _renderItem function to understand what “this” is (in this.props.navigation.)
In the renderItem function:
And inside SliderEntry.js:
Hope this helps!
@koswarabilly Adapting the example above: