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

115
Vistas
Select an item from dropdown and use that value in another component in React native

I'm just trying to do something like that (when user select an item, then navigate to another component):

     const handleValueChange=(itemValue, itemIndex) =>setTypeValue(itemValue)
    
       const onPress = () => {
    
            try{
              
              const topic = "Plant/type";
              ...
              navigation.navigate('Air')
             
            }catch(err){
              console.log(err)
            }  
            
          }
   return (
         <Picker
                  selectedValue={typeValue}
                  onValueChange={handleValueChange}
                  style={{ top: '21%', height: 50, width: 150 }}/> 

       <TouchableOpacity
                          style={styles.button}
                          onPress={()=> onPress()}
                        />
)

Typically when we want to pass value between two component we use props :

<AirScreen typeofPlant={typeValue} />

But in this case I have o idea how can I do it without invoked AirScreen

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can do that like:

const onPress = () => {
    try{
        const topic = "Plant/type";
        ...
        navigation.navigate('Air', {newTopic: topic}) //you can pass another value by separating with comma
    }catch(err){
        console.log(err)
    }     
}

Then you can fetch the same value in next screen like:

function NextScreen({ route, navigation }) {
    const topic = route.params.newTopic
}

Hope this works for you.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Just do something like this:

navigation.navigate('RouteName', { /* params go here */ })

You might want to read the following documentation: https://reactnavigation.org/docs/params/

about 4 years ago · Juan Pablo Isaza 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