aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/TaggDatePicker.tsx
blob: d80102517d29d4df9304b9956dfd3c83cab27837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React, {useState} from 'react';
import DatePicker from 'react-native-date-picker';

interface TaggDatePickerProps {
  handleDateUpdate: (_: Date) => void;
  maxDate: Date;
  textColor: string;
}

const TaggDatePicker: React.FC<TaggDatePickerProps> = ({
  handleDateUpdate,
  maxDate,
  textColor,
}) => {
  const [date, setDate] = useState(new Date());
  return (
    <DatePicker
      date={date}
      textColor={textColor}
      mode={'date'}
      maximumDate={maxDate}
      onDateChange={(newDate) => {
        setDate(newDate);
        handleDateUpdate(newDate);
      }}
    />
  );
};

export default TaggDatePicker;