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

304
Views
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 answers
Answer question

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 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!