Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

174
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda