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

173
Views
How to close date picker modal when date is selected in react native

I am using @react-native-community/datetimepicker for the date picker. Everything is working fine but what I face is about to close the date picker modal. Actually, I want to close a modal when the user selects a date. I really tried hard but didn't a solution to resolve my problem. Could someone please help me with how to resolve this issue.

Thanks

Code

onChange = (event, selectedDate) => {
    if (event.type) {
      switch (event.type) {
        // Handle dismissing the datepicker modal on Android
        case "dismissed":
          setShow(false);
          return;
        // Handle setting the currently selected value on Android
        case "set":
          setShow(false);
          break;
        default:
          return;
      }
    }
    const currentDate = selectedDate || date;
    this.fetchAllOrders(currentDate);
    this.setState({
      show: Platform.OS === "ios",
      date: currentDate,
    });
  };


<DateTimePicker
value={date}
minimumDate={Date.parse(new Date())}
display="default"
mode={mode}
onChange={this.onChange}
style={{ width: "90%" }}
/>
about 4 years ago · Juan Pablo Isaza
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!