Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

506
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda