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

108
Views
Seleccione un elemento del menú desplegable y use ese valor en otro componente en React native

Solo estoy tratando de hacer algo así (cuando el usuario selecciona un elemento, luego navega a otro componente):

 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()} /> )

Por lo general, cuando queremos pasar valor entre dos componentes, usamos accesorios:

 <AirScreen typeofPlant={typeValue} />

Pero en este caso no tengo idea de cómo puedo hacerlo sin invocar AirScreen

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puedes hacer eso como:

 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) } }

Luego puede obtener el mismo valor en la siguiente pantalla como:

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

Espero que esto funcione para usted.

about 4 years ago · Juan Pablo Isaza Report

0

Solo haz algo como esto:

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

Es posible que desee leer la siguiente documentación: https://reactnavigation.org/docs/params/

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