|
|
@ -1,9 +1,7 @@ |
|
|
|
import React, { useState, useContext, useEffect } from "react"; |
|
|
|
import { StyleSheet, Text, View, ScrollView } from "react-native"; |
|
|
|
import { |
|
|
|
Form, |
|
|
|
SubmitButton, |
|
|
|
} from "../components/forms"; |
|
|
|
import { MaterialCommunityIcons, FontAwesome } from "@expo/vector-icons"; |
|
|
|
import { Form, SubmitButton } from "../components/forms"; |
|
|
|
import Screen from "../components/Screen"; |
|
|
|
import { showMessage } from "react-native-flash-message"; |
|
|
|
import { dimensions, scaleDimsFromWidth } from "../config/dimensions"; |
|
|
@ -14,137 +12,108 @@ import FormLocationPicker from "../components/forms/FormLocationPicker"; |
|
|
|
import { EventLocationContext } from "../context/EventLocationContext"; |
|
|
|
import SchoolPicker from "../components/SchoolPicker"; |
|
|
|
import { TouchableOpacity } from "react-native-gesture-handler"; |
|
|
|
|
|
|
|
|
|
|
|
import DatePicker from "../components/DatePicker"; |
|
|
|
|
|
|
|
const dims = scaleDimsFromWidth(85, 85, 25); |
|
|
|
|
|
|
|
function PluviometerRegisterScreen(props) { |
|
|
|
const context = useContext(EventLocationContext); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
context.defaultLocation(); |
|
|
|
}, []); |
|
|
|
const context = useContext(EventLocationContext); |
|
|
|
|
|
|
|
const location = context.eventCoordinates; |
|
|
|
const address = context.eventLocation; |
|
|
|
const [dateTime, setDateTime] = useState(moment()); |
|
|
|
const [school, setSchool] = useState(); |
|
|
|
useEffect(() => { |
|
|
|
context.defaultLocation(); |
|
|
|
}, []); |
|
|
|
|
|
|
|
return ( |
|
|
|
<Screen style={styles.container}> |
|
|
|
<Form |
|
|
|
initialValues={{ |
|
|
|
const location = context.eventCoordinates; |
|
|
|
const address = context.eventLocation; |
|
|
|
const [date, setDate] = useState(moment()); |
|
|
|
const [time, setTime] = useState(moment()); |
|
|
|
const [school, setSchool] = useState(); |
|
|
|
|
|
|
|
}} |
|
|
|
onSubmit={() => { |
|
|
|
//insertRainData({ ...values, rain, location, date, time, address });
|
|
|
|
showMessage({ |
|
|
|
message: "Ainda não implementado", |
|
|
|
duration: 1950, |
|
|
|
icon: "warning", |
|
|
|
type: "warning", |
|
|
|
onPress: () => { }, |
|
|
|
}); |
|
|
|
//props.navigation.navigate("Home");
|
|
|
|
}}> |
|
|
|
return ( |
|
|
|
<View style={styles.container}> |
|
|
|
<Form |
|
|
|
initialValues={{}} |
|
|
|
onSubmit={() => { |
|
|
|
showMessage({ |
|
|
|
message: "Ainda não implementado", |
|
|
|
duration: 1950, |
|
|
|
icon: "warning", |
|
|
|
type: "warning", |
|
|
|
onPress: () => {}, |
|
|
|
}); |
|
|
|
}} |
|
|
|
> |
|
|
|
<View |
|
|
|
style={{ |
|
|
|
alignContent: "flex-start", |
|
|
|
}} |
|
|
|
> |
|
|
|
<Text style={styles.title}>Cadastro do Pluviômetro</Text> |
|
|
|
|
|
|
|
<View |
|
|
|
style={{ |
|
|
|
flexDirection: "column", |
|
|
|
alignContent: "flex-start", |
|
|
|
justifyContent: "space-evenly", |
|
|
|
flex: 1 |
|
|
|
}} |
|
|
|
> |
|
|
|
<View style={{ flex: 0.10 }}> |
|
|
|
<Text style={styles.title}>Cadastro do Pluviômetro</Text> |
|
|
|
</View> |
|
|
|
<View> |
|
|
|
<Text |
|
|
|
style={{ |
|
|
|
marginTop: 24, |
|
|
|
fontSize: dimensions.text.secondary, |
|
|
|
fontWeight: "bold", |
|
|
|
textAlign: "left", |
|
|
|
color: colors.primary, |
|
|
|
}} |
|
|
|
> |
|
|
|
Data do cadastro:{" "} |
|
|
|
</Text> |
|
|
|
|
|
|
|
{/* Escola: */} |
|
|
|
<View style={{ flex: 0.25, marginTop: 5}}> |
|
|
|
<Text style={styles.label}>Escola: </Text> |
|
|
|
<SchoolPicker |
|
|
|
itemSelected={(value) => setSchool(value)} /> |
|
|
|
</View> |
|
|
|
<FormDatePicker |
|
|
|
onDateChange={(value) => setDate(value)} |
|
|
|
onTimeChange={(value) => setTime(value)} |
|
|
|
date={date} |
|
|
|
time={time} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
|
|
|
|
<View style={{ |
|
|
|
flex: 0.60, flexDirection: "column" |
|
|
|
}}> |
|
|
|
<ScrollView contentContainerStyle={{ |
|
|
|
flexGrow: 1 |
|
|
|
}}> |
|
|
|
<View style={{ |
|
|
|
flex: 1, |
|
|
|
flexDirection: "column", |
|
|
|
justifyContent: "space-between" |
|
|
|
}}> |
|
|
|
{/*Local do pluvioômetro:*/} |
|
|
|
<View style={{ flex: 1 }}> |
|
|
|
<TouchableOpacity onPress={() => props.navigation.navigate("FormMap")}> |
|
|
|
<View style={{ flex: 1 }}> |
|
|
|
<Text style={styles.label}>Endereço do pluviômetro: </Text> |
|
|
|
<FormLocationPicker subtitle="Defina o endereço do pluviômetro" /> |
|
|
|
</View> |
|
|
|
</TouchableOpacity> |
|
|
|
</View> |
|
|
|
{/* <View style={{ marginTop: 5 }}> */} |
|
|
|
{/* <Text style={styles.label}>Escola: </Text> */} |
|
|
|
{/* <SchoolPicker itemSelected={(value) => setSchool(value)} /> */} |
|
|
|
{/* </View> */} |
|
|
|
|
|
|
|
{/*Data de cadastro:*/} |
|
|
|
<View style={{ flex: 1 }}> |
|
|
|
<Text style={{ |
|
|
|
fontSize: dimensions.text.secondary, |
|
|
|
fontWeight: "bold", |
|
|
|
textAlign: "left", |
|
|
|
color: colors.lightBlue, |
|
|
|
}}>Data do cadastro: </Text> |
|
|
|
<FormDatePicker |
|
|
|
disabled={true} |
|
|
|
textStyle={{ |
|
|
|
borderColor: colors.gray, |
|
|
|
borderWidth: 3, |
|
|
|
}} |
|
|
|
subtitle=" " |
|
|
|
defaultDate={new Date()} |
|
|
|
onDateChange={(value) => setDateTime(value)} |
|
|
|
onTimeChange={(value) => setTime(value)} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
{/* <TouchableOpacity */} |
|
|
|
{/* onPress={() => props.navigation.navigate("FormMap")} */} |
|
|
|
{/* > */} |
|
|
|
{/* <View> */} |
|
|
|
{/* <Text style={styles.label}>Endereço do pluviômetro: </Text> */} |
|
|
|
{/* <FormLocationPicker subtitle="Defina o endereço do pluviômetro" /> */} |
|
|
|
{/* </View> */} |
|
|
|
{/* </TouchableOpacity> */} |
|
|
|
|
|
|
|
<View style={{ flex: 0.05, marginTop: 15 }}> |
|
|
|
<SubmitButton title="Cadastrar" alignContent="flex-end" /> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</ScrollView> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</Form> |
|
|
|
</Screen> |
|
|
|
); |
|
|
|
<SubmitButton title="Cadastrar" alignContent="flex-end" /> |
|
|
|
</View> |
|
|
|
</Form> |
|
|
|
</View> |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
const styles = StyleSheet.create({ |
|
|
|
container: { |
|
|
|
padding: 10, |
|
|
|
flex: 1 |
|
|
|
}, |
|
|
|
image: { |
|
|
|
width: dims.width * 0.8, |
|
|
|
height: dims.height * 0.8, |
|
|
|
justifyContent: "center", |
|
|
|
alignItems: "center", |
|
|
|
}, |
|
|
|
label: { |
|
|
|
fontSize: dimensions.text.secondary, |
|
|
|
fontWeight: "bold", |
|
|
|
textAlign: "left", |
|
|
|
color: colors.lightBlue, |
|
|
|
}, |
|
|
|
title: { |
|
|
|
fontSize: 20, |
|
|
|
fontWeight: "bold", |
|
|
|
textAlign: "center", |
|
|
|
color: colors.primary, |
|
|
|
}, |
|
|
|
container: { |
|
|
|
padding: 10, |
|
|
|
}, |
|
|
|
image: { |
|
|
|
width: dims.width * 0.8, |
|
|
|
height: dims.height * 0.8, |
|
|
|
justifyContent: "center", |
|
|
|
alignItems: "center", |
|
|
|
}, |
|
|
|
label: { |
|
|
|
fontSize: dimensions.text.secondary, |
|
|
|
fontWeight: "bold", |
|
|
|
textAlign: "left", |
|
|
|
color: colors.lightBlue, |
|
|
|
}, |
|
|
|
title: { |
|
|
|
fontSize: 16, |
|
|
|
fontWeight: "bold", |
|
|
|
textAlign: "center", |
|
|
|
color: colors.primary, |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
export default PluviometerRegisterScreen; |