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;
