diff options
Diffstat (limited to 'src/components/common')
-rw-r--r-- | src/components/common/TaggDatePicker.tsx | 30 | ||||
-rw-r--r-- | src/components/common/index.ts | 1 |
2 files changed, 31 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; diff --git a/src/components/common/index.ts b/src/components/common/index.ts index 950b3f61..87ebe810 100644 --- a/src/components/common/index.ts +++ b/src/components/common/index.ts @@ -11,4 +11,5 @@ export {default as LoadingIndicator} from './LoadingIndicator'; export {default as DateLabel} from './DateLabel'; export {default as SocialLinkModal} from './SocialLinkModal'; export {default as ComingSoon} from './ComingSoon'; +export {default as TaggDatePicker} from './TaggDatePicker'; export * from './post'; |