“React-natives Datumszeitpicker reagieren” Code-Antworten

React-natives Datumszeitpicker reagieren

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 (
    <View>
      <Button title="Show Date Picker" onPress={showDatePicker} />
      <DateTimePickerModal
        isVisible={isDatePickerVisible}
        mode="date"
        onConfirm={handleConfirm}
        onCancel={hideDatePicker}
      />
    </View>
  );
};

export default Example;
NathanNoSudo

Reagieren Sie den nativen Zeitbereichspicker

npm install react-native-paper-dates --save
V1CTOR

Ähnliche Antworten wie “React-natives Datumszeitpicker reagieren”

Fragen ähnlich wie “React-natives Datumszeitpicker reagieren”

Weitere verwandte Antworten zu “React-natives Datumszeitpicker reagieren” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen