Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

504
Views
TypeError: undefined is not an object (evaluating 'route.params.id')

I'm trying to add a competition entry to my competitions database in firebase but I'm getting the error:

TypeError: undefined is not an object (evaluating 'route.params.id')

Here's my code:


const AddEntry = ({route, navigation}) => {


  const id = route.params.id
  const [title, onChangeTitle] = React.useState('')
  const [image, setImage] = React.useState("/")

  const pickImage = async () => {
      // No permissions request is necessary for launching the image library
      let result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.All,
        allowsEditing: true,
        aspect: [4, 3],
        quality: 1,
      });
  
      console.log(result);
  
      if (!result.cancelled) {
        setImage(result.uri);
      }
    };

  const AddEntry = async() => {
      let imageUrl = await handleImageUpload()
      addEntryToComp({title, imageUrl}, id)
  }
//Image code here

    return(
       <View>
           <Text>Add Entry</Text>
           <Text>{id}</Text>

           <Button title='Upload Entry Image' color="red" onPress={pickImage}></Button>
           <Button title='Save' color="purple" onPress={AddEntry}></Button>
       </View>
    )
}

export default AddEntry

Any ideas?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Params are used for passing data to route by putting them in an object as a second parameter to the navigation.navigate function.

For example:

navigation.navigate('AddEntry', { id })

...and then you can access those passed params from route.params.

More here: https://reactnavigation.org/docs/params/

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!