Reputation: 127
I have a functional component screen with a React Native FlatList of custom "Tasks". I want to be able to navigate from a task to another functional component, "TaskEditScreen" and pass some props to the screen as well.
<TouchableOpacity onPress={()=>{navigation.navigate('Task Edit')}}>
<Feather
name="edit"
size={35}
color="black"
style={{
margin: 5
}}
/>
</TouchableOpacity>
The onPress function works and it navigates me to the correct screen, but how do I also pass in some kind of props or data to this screen?
Upvotes: 0
Views: 1309
Reputation: 14191
Documentation: https://reactnavigation.org/docs/params
<TouchableOpacity onPress={() => { navigation.navigate('Task Edit', {someParam: "someValue"}) }}>
<Feather
name="edit"
size={35}
color="black"
style={{
margin: 5
}}
/>
</TouchableOpacity>
Upvotes: 3