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

308
Vistas
How to Reset react-native-picker-select on form submit using formik inReact Native?

I am using Formik and react-native-picker-select, I can reset text and number fields after submission but can not able to reset picker-select. How can I achieve it?

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

0

The reseted value for react-native-picker-select is null.

So you need to create a state that stores the current value of the picker and when you want to reset it, set it to null.

The secret here is set the value={state variable} parameter, so that the picker updates every time that the state is also updated. The state variable is updated with 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 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