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

305
Views
¿Cómo restablecer react-native-picker-select en el formulario enviado usando formik inReact Native?

Estoy usando Formik y react-native-picker-select, puedo restablecer los campos de texto y números después del envío, pero no puedo restablecer la selección del selector. ¿Cómo puedo lograrlo?

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

0

El valor restablecido para react-native-picker-select es nulo.

Por lo tanto, debe crear un estado que almacene el valor actual del selector y, cuando desee restablecerlo, configúrelo en nulo.

El secreto aquí es establecer el parámetro value={state variable} , de modo que el selector se actualice cada vez que también se actualice el estado. La state variable se actualiza con onValueChange .

 const Component = () => { const [pickerValue, setPickerValue] = useState(null); return ( <> <RNPickerSelect onValueChange={v => setPickerValue(v)} value={pickerValue} items={[ {label: 'Football', value: 'football'}, {label: 'Baseball', value: 'baseball'}, {label: 'Hockey', value: 'hockey'}, ]} /> <TouchableOpacity onPress={() => setPickerValue(null)}> <Text>Submit</Text> </TouchableOpacity> </> ); };
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!