From e004fd362583a020b07f87536aac077269eaad27 Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@thetaggid.com>
Date: Tue, 27 Oct 2020 18:34:08 -0400
Subject: date picker done (#80)

---
 src/components/common/TaggDatePicker.tsx | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 src/components/common/TaggDatePicker.tsx

(limited to 'src/components/common/TaggDatePicker.tsx')

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;
-- 
cgit v1.2.3-70-g09d2

