diff --git a/src/app/components/forms/FormDatePicker.js b/src/app/components/forms/FormDatePicker.js
index b39dee2..1310d8a 100644
--- a/src/app/components/forms/FormDatePicker.js
+++ b/src/app/components/forms/FormDatePicker.js
@@ -1,151 +1,151 @@
-import React, { useState } from 'react'; 7
-import { Modal, StyleSheet, Text, TouchableHighlight, View, Platform, TouchableOpacity } from 'react-native';
+import React, { useState } from "react";
+import {
+ Modal,
+ StyleSheet,
+ Text,
+ TouchableHighlight,
+ View,
+ Platform,
+ TouchableOpacity,
+} from "react-native";
import DateTimePicker from "@react-native-community/datetimepicker";
import moment from "moment";
-import colors from '../../config/colors';
+import colors from "../../config/colors";
const FormDatePicker = (props) => {
-
- const { textStyle, defaultDate } = props;
- const [date, setDate] = useState(moment(defaultDate));
- const [show, setShow] = useState(false);
-
- const onChange = (e, selectedDate) => {
- setDate(moment(selectedDate));
- }
-
- const androidOnChange = (e, selectedDate) => {
- setShow(false);
- if (selectedDate) {
- setDate(moment(selectedDate));
- props.onDateChange(selectedDate);
- // console.log(moment(selectedDate).format("DD-MM-YYYY"));
- // console.log(date.format("DD-MM-YYYY"));
- }
- }
-
- const onCancelPress = () => {
- setDate(moment(defaultDate));
- setShow(false);
- //console.log(moment(defaultDate).format("DD-MM-YYYY"))
- }
-
- const onDonePress = () => {
- props.onDateChange(date);
- setShow(false);
- //console.log("done");
- //console.log(date.format("DD-MM-YYYY"));
-
+ const { textStyle, defaultDate } = props;
+ const [date, setDate] = useState(moment(defaultDate));
+ const [show, setShow] = useState(false);
+
+ const onChange = (e, selectedDate) => {
+ setDate(moment(selectedDate));
+ };
+
+ const androidOnChange = (e, selectedDate) => {
+ setShow(false);
+ if (selectedDate) {
+ setDate(moment(selectedDate));
+ props.onDateChange(selectedDate);
+ // console.log(moment(selectedDate).format("DD-MM-YYYY"));
+ // console.log(date.format("DD-MM-YYYY"));
}
-
- const renderDatePicker = () => {
- return (
-
- )
- }
-
+ };
+
+ const onCancelPress = () => {
+ setDate(moment(defaultDate));
+ setShow(false);
+ //console.log(moment(defaultDate).format("DD-MM-YYYY"))
+ };
+
+ const onDonePress = () => {
+ props.onDateChange(date);
+ setShow(false);
+ //console.log("done");
+ //console.log(date.format("DD-MM-YYYY"));
+ };
+
+ const renderDatePicker = () => {
return (
- setShow(true)}>
- {date.format("DD-MM-YYYY")}
- {Platform.OS !== 'ios' && show && renderDatePicker()}
-
- {Platform.OS === 'ios' && show && (
- setShow(false)}
- >
-
- setShow(false)}>
- console.log("datepicker clicked")}
- >
-
-
- { renderDatePicker() }
-
- onCancelPress()}
- style={[styles.btnText, styles.btnCancel]}
- >
-
- Cancel
-
-
- onDonePress()}
- style={[styles.btnText, styles.btnDone]}
- >
-
- Done
-
-
-
-
-
-
-
-
-
- )}
-
+
);
+ };
+
+ return (
+ setShow(true)}>
+ {date.format("DD-MM-YYYY")}
+ {Platform.OS !== "ios" && show && renderDatePicker()}
+
+ {Platform.OS === "ios" && show && (
+ setShow(false)}
+ >
+
+ setShow(false)}
+ >
+ console.log("datepicker clicked")}
+ >
+
+ {renderDatePicker()}
+ onCancelPress()}
+ style={[styles.btnText, styles.btnCancel]}
+ >
+ Cancel
+
+ onDonePress()}
+ style={[styles.btnText, styles.btnDone]}
+ >
+ Done
+
+
+
+
+
+
+ )}
+
+ );
};
FormDatePicker.defaultProps = {
- textStyle: {},
- defaultDate: moment(),
- onDateChange: () => { },
-}
+ textStyle: {},
+ defaultDate: moment(),
+ onDateChange: () => {},
+};
const styles = StyleSheet.create({
- btnCancel: {
- left: 0,
- },
- btnDone: {
- right: 0,
- },
- btnText: {
- position: "absolute",
- top: 0,
- height: 42,
- paddingHorizontal: 20,
- flexDirection: "row",
- alignItems: "center",
- justifyContent: "center",
- },
+ btnCancel: {
+ left: 0,
+ },
+ btnDone: {
+ right: 0,
+ },
+ btnText: {
+ position: "absolute",
+ top: 0,
+ height: 42,
+ paddingHorizontal: 20,
+ flexDirection: "row",
+ alignItems: "center",
+ justifyContent: "center",
+ },
});
-export default FormDatePicker;
\ No newline at end of file
+export default FormDatePicker;