0

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?

1 Answer 1

3

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.