|
|
@ -1,6 +1,14 @@ |
|
|
|
import React, { useState } from "react"; |
|
|
|
|
|
|
|
import { StyleSheet, Text, View, Image, ScrollView, Modal, Platform } from "react-native"; |
|
|
|
import { |
|
|
|
StyleSheet, |
|
|
|
Text, |
|
|
|
View, |
|
|
|
Image, |
|
|
|
ScrollView, |
|
|
|
Modal, |
|
|
|
Platform, |
|
|
|
} from "react-native"; |
|
|
|
import * as Yup from "yup"; |
|
|
|
|
|
|
|
import { |
|
|
@ -13,18 +21,25 @@ import Screen from "../components/Screen"; |
|
|
|
import useLocation from "../hooks/useLocation"; |
|
|
|
import FormImagePicker from "../components/forms/FormImagePicker"; |
|
|
|
import { insertPluviometerData } from "../database/databaseLoader"; |
|
|
|
import { TouchableHighlight, TouchableOpacity } from "react-native-gesture-handler"; |
|
|
|
import DateTimePicker from '@react-native-community/datetimepicker'; |
|
|
|
import { FontAwesome5 } from '@expo/vector-icons'; |
|
|
|
import { |
|
|
|
TouchableHighlight, |
|
|
|
TouchableOpacity, |
|
|
|
} from "react-native-gesture-handler"; |
|
|
|
import DateTimePicker from "@react-native-community/datetimepicker"; |
|
|
|
import { FontAwesome5 } from "@expo/vector-icons"; |
|
|
|
import { showMessage } from "react-native-flash-message"; |
|
|
|
import moment from 'moment'; |
|
|
|
import moment from "moment"; |
|
|
|
import colors from "../config/colors"; |
|
|
|
import { scaleDimsFromWidth } from "../config/dimensions"; |
|
|
|
|
|
|
|
const dims = scaleDimsFromWidth(85, 85, 25); |
|
|
|
|
|
|
|
const validationSchema = Yup.object().shape({ |
|
|
|
pluviometer: Yup.number().required("Campo obrigatório").min(0, "O valor deve ser maior ou igual a 0.").max(10000).label("pluviometer"), |
|
|
|
pluviometer: Yup.number() |
|
|
|
.required("Campo obrigatório") |
|
|
|
.min(0, "O valor deve ser maior ou igual a 0.") |
|
|
|
.max(10000) |
|
|
|
.label("pluviometer"), |
|
|
|
data: Yup.string().min(1, "Por favor preencha a data"), |
|
|
|
images: Yup.array(), |
|
|
|
}); |
|
|
@ -76,7 +91,6 @@ function PluviometerSharingDataScreen(props) { |
|
|
|
---------------------------------------------------------------------------------------------------------*/ |
|
|
|
return ( |
|
|
|
<Screen style={styles.container}> |
|
|
|
|
|
|
|
<View style={{ alignItems: "center" }}> |
|
|
|
<Image |
|
|
|
style={styles.image} |
|
|
@ -86,7 +100,7 @@ function PluviometerSharingDataScreen(props) { |
|
|
|
Pluviômetro |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
<ScrollView style={styles.container}> |
|
|
|
<ScrollView> |
|
|
|
<Form |
|
|
|
initialValues={{ |
|
|
|
pluviometer: "", |
|
|
@ -106,10 +120,8 @@ function PluviometerSharingDataScreen(props) { |
|
|
|
validationSchema={validationSchema} |
|
|
|
> |
|
|
|
<View style={{ marginTop: 30, flex: 1 }}> |
|
|
|
<Text style={styles.labelStyle}> |
|
|
|
Quantidade de chuva: |
|
|
|
</Text> |
|
|
|
<View style={{ flex: 1, flexDirection: 'row' }}> |
|
|
|
<Text style={styles.labelStyle}>Quantidade de chuva:</Text> |
|
|
|
<View style={{ flex: 1, flexDirection: "row" }}> |
|
|
|
<FormField |
|
|
|
keyboardType="number-pad" |
|
|
|
maxLength={200} |
|
|
@ -120,10 +132,8 @@ function PluviometerSharingDataScreen(props) { |
|
|
|
</View> |
|
|
|
|
|
|
|
<View style={{ marginTop: 10, flex: 1, borderRadius: 25 }}> |
|
|
|
<Text style={styles.labelStyle}> |
|
|
|
Data da coleta: |
|
|
|
</Text> |
|
|
|
<View style={{ flex: 1, flexDirection: 'row' }}> |
|
|
|
<Text style={styles.labelStyle}>Data da coleta:</Text> |
|
|
|
<View style={{ flex: 1, flexDirection: "row" }}> |
|
|
|
<View style={{ flex: 1 }}> |
|
|
|
<FormField |
|
|
|
keyboardType="numbers-and-punctuation" |
|
|
@ -134,7 +144,12 @@ function PluviometerSharingDataScreen(props) { |
|
|
|
flex={1} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
<FontAwesome5 style={styles.dateIcon} name="calendar-day" size={24} color="grey" /> |
|
|
|
<FontAwesome5 |
|
|
|
style={styles.dateIcon} |
|
|
|
name="calendar-day" |
|
|
|
size={24} |
|
|
|
color="grey" |
|
|
|
/> |
|
|
|
</View> |
|
|
|
{/* |
|
|
|
<TouchableOpacity style={styles.datepickerStyle} |
|
|
@ -208,8 +223,7 @@ function PluviometerSharingDataScreen(props) { |
|
|
|
styles={{ width: 50 }} |
|
|
|
/> |
|
|
|
<SubmitButton title="Enviar" style={{ marginBottom: 100 }} /> |
|
|
|
<View style={{ flex: 1 }}> |
|
|
|
</View> |
|
|
|
<View style={{ flex: 1 }}></View> |
|
|
|
</Form> |
|
|
|
</ScrollView> |
|
|
|
</Screen> |
|
|
@ -219,8 +233,7 @@ function PluviometerSharingDataScreen(props) { |
|
|
|
const styles = StyleSheet.create({ |
|
|
|
container: { |
|
|
|
padding: 10, |
|
|
|
flex: 1 |
|
|
|
|
|
|
|
flex: 1, |
|
|
|
}, |
|
|
|
image: { |
|
|
|
width: dims.width * 0.8, |
|
|
|