|
@ -13,6 +13,7 @@ import DateTimePicker from "@react-native-community/datetimepicker"; |
|
|
|
|
|
|
|
|
import moment from "moment"; |
|
|
import moment from "moment"; |
|
|
import colors from "../../config/colors"; |
|
|
import colors from "../../config/colors"; |
|
|
|
|
|
import { dimensions } from "../../config/dimensions"; |
|
|
|
|
|
|
|
|
const FormDatePicker = (props) => { |
|
|
const FormDatePicker = (props) => { |
|
|
const { textStyle, defaultDate } = props; |
|
|
const { textStyle, defaultDate } = props; |
|
@ -65,15 +66,21 @@ const FormDatePicker = (props) => { |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<TouchableOpacity onPress={() => setShow(true)}> |
|
|
<TouchableOpacity onPress={() => setShow(true)}> |
|
|
<View style={{ flex: 1, flexDirection: "row", alignItems: 'center', justifyContent: "space-between" }}> |
|
|
|
|
|
<View style={ styles.dateInput }> |
|
|
|
|
|
<Text> {date.format("DD/MM/YYYY")}</Text> |
|
|
|
|
|
|
|
|
<View |
|
|
|
|
|
style={{ |
|
|
|
|
|
flex: 1, |
|
|
|
|
|
flexDirection: "row", |
|
|
|
|
|
alignItems: "center", |
|
|
|
|
|
justifyContent: "space-between", |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<View style={styles.dateInput}> |
|
|
|
|
|
<Text style={{ fontSize: dimensions.text.default }}> |
|
|
|
|
|
{" "} |
|
|
|
|
|
{date.format("DD/MM/YYYY")} |
|
|
|
|
|
</Text> |
|
|
</View> |
|
|
</View> |
|
|
<FontAwesome5 |
|
|
|
|
|
name="calendar-day" |
|
|
|
|
|
size={30} |
|
|
|
|
|
color="grey" |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<FontAwesome5 name="calendar-day" size={30} color="grey" /> |
|
|
</View> |
|
|
</View> |
|
|
{Platform.OS !== "ios" && show && renderDatePicker()} |
|
|
{Platform.OS !== "ios" && show && renderDatePicker()} |
|
|
|
|
|
|
|
@ -140,7 +147,7 @@ const FormDatePicker = (props) => { |
|
|
FormDatePicker.defaultProps = { |
|
|
FormDatePicker.defaultProps = { |
|
|
textStyle: {}, |
|
|
textStyle: {}, |
|
|
defaultDate: moment(), |
|
|
defaultDate: moment(), |
|
|
onDateChange: () => { }, |
|
|
|
|
|
|
|
|
onDateChange: () => {}, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({ |
|
|
const styles = StyleSheet.create({ |
|
@ -165,7 +172,7 @@ const styles = StyleSheet.create({ |
|
|
borderRadius: 25, |
|
|
borderRadius: 25, |
|
|
padding: 18, |
|
|
padding: 18, |
|
|
marginVertical: 10, |
|
|
marginVertical: 10, |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
export default FormDatePicker; |
|
|
export default FormDatePicker; |