date time picker react-native code example

Example 1: react-native date time picker

expo install react-native-modal-datetime-picker @react-native-community/datetimepicker

import React, { useState } from "react";
import { Button, View } from "react-native";
import DateTimePickerModal from "react-native-modal-datetime-picker";

const Example = () => {
  const [isDatePickerVisible, setDatePickerVisibility] = useState(false);

  const showDatePicker = () => {
    setDatePickerVisibility(true);
  };

  const hideDatePicker = () => {
    setDatePickerVisibility(false);
  };

  const handleConfirm = (date) => {
    console.warn("A date has been picked: ", date);
    hideDatePicker();
  };

  return (
    
      

Example 2: reactnative timePicker

timePicker in reactNative

Tags:

Misc Example