diff options
author | Ivan Chen <ivan@thetaggid.com> | 2020-10-27 18:34:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-27 18:34:08 -0400 |
commit | e004fd362583a020b07f87536aac077269eaad27 (patch) | |
tree | a4b0f6abf71b2e169a5d1fa6873f2327f60b57c1 /src/components/common/TaggDatePicker.tsx | |
parent | 9b9b1b792f914709de01e1d502014b8deb66e291 (diff) |
date picker done (#80)
Diffstat (limited to 'src/components/common/TaggDatePicker.tsx')
-rw-r--r-- | src/components/common/TaggDatePicker.tsx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/components/common/TaggDatePicker.tsx b/src/components/common/TaggDatePicker.tsx new file mode 100644 index 00000000..d8010251 --- /dev/null +++ b/src/components/common/TaggDatePicker.tsx @@ -0,0 +1,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; |