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

175
Vistas
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
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