diff --git a/src/app/api/auth.js b/src/app/api/auth.js
index e7ca3c4..22a5dc3 100644
--- a/src/app/api/auth.js
+++ b/src/app/api/auth.js
@@ -9,7 +9,7 @@ function login(name, password) {
return {
ok: true,
data:
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiVXN1w6FyaW8gVGVzdGUiLCJlbWFpbCI6InVzdWFyaW9AdGVzdGUuY29tLmJyIiwiSUQiOiIxIn0.hGrMWzg3EPlmjbga4-hmcMFmkDINFAWVP9kOmebXeAM",
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiVXN1w6FyaW8gVGVzdGUiLCJlbWFpbCI6InVzdWFyaW9AdGVzdGUuY29tLmJyIiwiaW5zdGl0dXRpb25OYW1lIjoiRS4gRS4gVmljZW50ZSBMZXBvcmFjZSIsImluc3RpdHV0aW9uVHlwZSI6IkVzY29sYSIsIklEIjoiMSJ9.dk-Nl5VLvAWhT_JUYREpJYYCc98s71SyHJwmwH55ZS4",
};
}
diff --git a/src/app/components/forms/FormLocationPicker.js b/src/app/components/forms/FormLocationPicker.js
index 5d460a8..8f85166 100644
--- a/src/app/components/forms/FormLocationPicker.js
+++ b/src/app/components/forms/FormLocationPicker.js
@@ -12,11 +12,12 @@ function FormLocationPicker({ subtitle }) {
return (
+
@@ -32,6 +33,7 @@ function FormLocationPicker({ subtitle }) {
{subtitle ? subtitle : "Defina o local no mapa"}
+
);
}
@@ -41,14 +43,18 @@ const styles = StyleSheet.create({
flexDirection: "row",
alignContent: "space-around",
justifyContent: "flex-start",
+ marginTop: 24,
},
adressText: {
height: "100%",
- paddingLeft: 12,
+ paddingLeft: 16,
},
mapIcon: {
+ backgroundColor: colors.primary,
+ width: 40,
+ height: 40,
justifyContent: "center",
alignItems: "center",
borderRadius: 5,
diff --git a/src/app/navigation/AccountNavigator.js b/src/app/navigation/AccountNavigator.js
index 9f379f8..2127fcd 100644
--- a/src/app/navigation/AccountNavigator.js
+++ b/src/app/navigation/AccountNavigator.js
@@ -76,6 +76,7 @@ const AccountNavigator = () => (
{
Location.setGoogleApiKey("AIzaSyD_wuuokS3SVczc8qSASrsBq0E5qIpdyMc");
const address = await Location.reverseGeocodeAsync(coordenadas);
- // console.log(address);
- // console.log(coordenadas);
+ // console.log(address);
+ // console.log(coordenadas);
if (address[0] != undefined) {
var street = address[0].street == null ? "" : address[0].street;
var number = address[0].name == null ? "" : ", " + address[0].name;
var district =
address[0].district == null ? "" : "\n" + address[0].district;
- context.saveNewLocation(street + number + district, coordenadas);
+ return street + number + district;
} else {
//Quando o usuário não da permissão de acesso da localização o geoCode retorna um array vazio
- context.saveNewLocation("Erro ao carregar endereço", coordenadas);
+ return "Erro ao carregar endereço";
}
};
+
const setLocation = () => {
- getAddress(moveEndListener);
+ getAddress(moveEndListener).then((addr) => {
+ if (props.route.params && props.route.params.setLocationAddr)
+ props.route.params.setLocationAddr(addr);
+ else
+ context.saveNewLocation(addr, moveEndListener);
+ });
+
props.navigation.goBack(null);
};
//leva o mapa pra localização escolhida pelo usuário
const moveLocation = (l) => {
- // console.log(l);
+ // console.log(l);
setMoveEndListener(l);
// setPosition({
// lat: l["latitude"],
diff --git a/src/app/screens/PluviometerRegisterScreen.js b/src/app/screens/PluviometerRegisterScreen.js
index 6c334f1..4b725de 100644
--- a/src/app/screens/PluviometerRegisterScreen.js
+++ b/src/app/screens/PluviometerRegisterScreen.js
@@ -1,41 +1,98 @@
-import React, { useState, useContext, useEffect } from "react";
-import { StyleSheet, Text, View, ScrollView } from "react-native";
-import { MaterialCommunityIcons, FontAwesome } from "@expo/vector-icons";
+import React, { useState, useContext } from "react";
+import { MaterialIcons } from "@expo/vector-icons";
+import { StyleSheet, Text, View } from "react-native";
import { Form, SubmitButton } from "../components/forms";
-import Screen from "../components/Screen";
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 { EventLocationContext } from "../context/EventLocationContext";
-import SchoolPicker from "../components/SchoolPicker";
import { TouchableOpacity } from "react-native-gesture-handler";
-import DatePicker from "../components/DatePicker";
-import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
+import { FontAwesome5 } from "@expo/vector-icons";
+import { AuthContext } from "../auth/context";
+import { Shadow } from "react-native-shadow-2";
const dims = scaleDimsFromWidth(85, 85, 25);
-function PluviometerRegisterScreen(props) {
- const context = useContext(EventLocationContext);
+function Institution({ user }) {
+ return (
+
+ Tippo de instituição:
+
+
+ {user.institutionType}
+
- useEffect(() => {
- context.defaultLocation();
- }, []);
+
+ Nome da instituição:
+
+
+
+ {user.institutionName}
+
+
+ );
+}
- const location = context.eventCoordinates;
- const address = context.eventLocation;
- const [date, setDate] = useState(moment());
- const [time, setTime] = useState(moment());
- const [school, setSchool] = useState();
+function LocationPicker({ navigation }) {
+ const [location, setLocationAddr] = useState("Defina o endereço no mapa");
return (
+
+
+
+
+ navigation.navigate("FormMap", {
+ setLocationAddr: setLocationAddr,
+ })
+ }
+ >
+
+ {location}
+
+
+
+
+
+ );
+}
+
+function PluviometerRegisterScreen(props) {
+ const [date, setDate] = useState(moment());
+ const [time, setTime] = useState(moment());
+ const { user, _ } = useContext(AuthContext);
+
+ return (
+
@@ -123,6 +161,13 @@ const styles = StyleSheet.create({
textAlign: "left",
color: colors.secondary,
},
+ subText: {
+ color: colors.subText,
+ fontSize: 16,
+ alignSelf: "center",
+ fontWeight: "500",
+ paddingLeft: 16,
+ },
title: {
fontSize: 18,
fontWeight: "bold",