Browse Source

swaping datepicker for textinput

master
analuizaff 4 years ago
parent
commit
90ca859b17
  1. 26
      src/app/screens/PluviometerSharingDataScreen.js

26
src/app/screens/PluviometerSharingDataScreen.js

@ -22,18 +22,19 @@ import colors from "../config/colors";
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
pluviometer: Yup.number().required().min(1).max(10000).label("pluviometer"), pluviometer: Yup.number().required().min(1).max(10000).label("pluviometer"),
data: Yup.string().min(1, "Por favor preencha a data"),
images: Yup.array().min(1, "Por favor, selecione uma imagem."), images: Yup.array().min(1, "Por favor, selecione uma imagem."),
}); });
function PluviometerSharingDataScreen(props) { function PluviometerSharingDataScreen(props) {
const location = useLocation(); const location = useLocation();
/*-------------------------------------------DATETIMEPICKER------------------------------------------------*/
let dateTime = new Date().toString();
/*-------------------------------------------DATETIMEPICKER------------------------------------------------
const { textStyle, defaultDate } = props; const { textStyle, defaultDate } = props;
const [date, setDate] = useState(moment(defaultDate)) const [date, setDate] = useState(moment(defaultDate))
const [show, setShow] = useState(false); const [show, setShow] = useState(false);
let dateTime = new Date().toString();
//---------------ios------------------------ //---------------ios------------------------
const onChange = (e, selectedDate) => { const onChange = (e, selectedDate) => {
setDate(moment(selectedDate)); setDate(moment(selectedDate));
@ -69,7 +70,7 @@ function PluviometerSharingDataScreen(props) {
/> />
) )
} }
/*---------------------------------------------------------------------------------------------------------*/
---------------------------------------------------------------------------------------------------------*/
return ( return (
<Screen style={styles.container}> <Screen style={styles.container}>
@ -86,6 +87,7 @@ function PluviometerSharingDataScreen(props) {
<Form <Form
initialValues={{ initialValues={{
pluviometer: "", pluviometer: "",
data:"",
images: [], images: [],
}} }}
onSubmit={(values) => { onSubmit={(values) => {
@ -117,6 +119,18 @@ function PluviometerSharingDataScreen(props) {
<Text style={styles.labelStyle}> <Text style={styles.labelStyle}>
Data da coleta: Data da coleta:
</Text> </Text>
<View style={{flexDirection:"row"}}>
<FormField
keyboardType="numbers-and-punctuation"
maxLength={10}
name="data"
placeholder="dd/mm/aaaa"
width={240}
values={dateTime}
/>
<FontAwesome5 style={styles.dateIcon} name="calendar-day" size={24} color="grey" />
</View>
{/*
<TouchableOpacity style={styles.datepickerStyle} <TouchableOpacity style={styles.datepickerStyle}
onPress={() => setShow(true)}> onPress={() => setShow(true)}>
<View style={styles.datePickerView}> <View style={styles.datePickerView}>
@ -180,6 +194,7 @@ function PluviometerSharingDataScreen(props) {
)} )}
</View> </View>
</TouchableOpacity> </TouchableOpacity>
*/}
</View> </View>
<FormImagePicker <FormImagePicker
backgroundColor="#1976D2" backgroundColor="#1976D2"
@ -217,7 +232,8 @@ const styles = StyleSheet.create({
backgroundColor: "#f8f4f4", backgroundColor: "#f8f4f4",
}, },
dateIcon: { dateIcon: {
marginRight: 25,
marginTop: 25,
marginLeft: 15,
}, },
labelStyle: { labelStyle: {
fontSize: 16, fontSize: 16,

Loading…
Cancel
Save