|
|
@ -1,25 +1,16 @@ |
|
|
|
import React, { useState, useContext, useEffect } from "react"; |
|
|
|
import { StyleSheet, Text, View, ScrollView, PixelRatio } from "react-native"; |
|
|
|
import { StyleSheet, Text, View, ScrollView } from "react-native"; |
|
|
|
import * as Yup from "yup"; |
|
|
|
import { |
|
|
|
Form, |
|
|
|
FormField, |
|
|
|
FormPicker as Picker, |
|
|
|
SubmitButton, |
|
|
|
} from "../components/forms"; |
|
|
|
import { Form, FormField, SubmitButton } from "../components/forms"; |
|
|
|
import Screen from "../components/Screen"; |
|
|
|
import useLocation from "../hooks/useLocation"; |
|
|
|
import FormImagePicker from "../components/forms/FormImagePicker"; |
|
|
|
import { insertPluviometerData } from "../database/databaseLoader"; |
|
|
|
import { showMessage } from "react-native-flash-message"; |
|
|
|
import { dimensions, scaleDimsFromWidth } from "../config/dimensions"; |
|
|
|
import FormDatePicker from "../components/forms/FormDatePicker"; |
|
|
|
import colors from "../config/colors/"; |
|
|
|
import moment from "moment"; |
|
|
|
import FormLocationPicker from "../components/forms/FormLocationPicker"; |
|
|
|
import { TouchableOpacity } from "react-native-gesture-handler"; |
|
|
|
import { EventLocationContext } from "../context/EventLocationContext"; |
|
|
|
import PickEventDateLocation from "../components/PickEventDateLocation"; |
|
|
|
import { EventLocationContext } from "../context/EventLocationContext"; |
|
|
|
|
|
|
|
const dims = scaleDimsFromWidth(85, 85, 25); |
|
|
|
|
|
|
@ -36,24 +27,19 @@ const validationSchema = Yup.object().shape({ |
|
|
|
|
|
|
|
function PluviometerSharingDataScreen(props) { |
|
|
|
const context = useContext(EventLocationContext); |
|
|
|
|
|
|
|
const amount = 2; |
|
|
|
const [dateTime, setDateTime] = useState(moment()); |
|
|
|
const [time, setTime] = useState(moment()); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
context.defaultLocation(); |
|
|
|
}, []); |
|
|
|
const location = context.eventCoordinates; |
|
|
|
const address = context.eventLocation; |
|
|
|
|
|
|
|
const [dateTime, setDateTime] = useState(moment()); |
|
|
|
const [time, setTime] = useState(moment()); |
|
|
|
|
|
|
|
return ( |
|
|
|
<Screen style={styles.container}> |
|
|
|
<ScrollView> |
|
|
|
<Form |
|
|
|
initialValues={{ |
|
|
|
pluviometer: "", |
|
|
|
pluviometer: 0, |
|
|
|
description: "", |
|
|
|
images: [], |
|
|
|
}} |
|
|
@ -69,22 +55,20 @@ function PluviometerSharingDataScreen(props) { |
|
|
|
}} |
|
|
|
validationSchema={validationSchema} |
|
|
|
> |
|
|
|
<Text style={{...styles.labelStyle, paddingTop: 24 }}>Quantidade de chuva (mm):</Text> |
|
|
|
|
|
|
|
<Text style={{ ...styles.labelStyle, paddingTop: 24 }}> |
|
|
|
Quantidade de chuva (mm): |
|
|
|
</Text> |
|
|
|
|
|
|
|
<FormField |
|
|
|
keyboardType="decimal-pad" |
|
|
|
keyboardType="number-pad" |
|
|
|
maxLength={200} |
|
|
|
numberOfLines={2} |
|
|
|
name="pluviometer" |
|
|
|
placeholder="Digite a quantidade de chuva" |
|
|
|
placeholder="Quantidade de chuva" |
|
|
|
increaseDecreaseButtons={true} |
|
|
|
/> |
|
|
|
|
|
|
|
<FormImagePicker |
|
|
|
backgroundColor={colors.primary} |
|
|
|
name="images" |
|
|
|
styles={{ width: 50 }} |
|
|
|
/> |
|
|
|
<FormImagePicker backgroundColor={colors.primary} name="images" /> |
|
|
|
|
|
|
|
<PickEventDateLocation |
|
|
|
setDate={setDateTime} |
|
|
|