From 1a43450ada0d3d1e4d01c0ed4fbbcfca1400f75e Mon Sep 17 00:00:00 2001 From: analuizaff Date: Wed, 24 Mar 2021 00:03:40 -0300 Subject: [PATCH 1/3] updating placeholder on the register screen --- src/app/screens/RegisterScreen.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/screens/RegisterScreen.js b/src/app/screens/RegisterScreen.js index 503d9c5..32002ff 100644 --- a/src/app/screens/RegisterScreen.js +++ b/src/app/screens/RegisterScreen.js @@ -40,7 +40,6 @@ export default function RegisterScreen(props) { const comparePassword = (password, confirmPassword) => { if (password !== confirmPassword) { setSingUpFailed(true); - console.log("Senhas Diferentes"); } else { setSingUpFailed(false); } @@ -85,12 +84,12 @@ export default function RegisterScreen(props) { /> - Número de telefone: + Número do telefone: @@ -99,7 +98,7 @@ export default function RegisterScreen(props) { maxLength={12} name="password" numberOfLines={1} - placeholder="Nome Completo" + placeholder="Senha" /> @@ -108,7 +107,7 @@ export default function RegisterScreen(props) { maxLength={12} name="confirmPassword" numberOfLines={1} - placeholder="Nome Completo" + placeholder="Repetir a senha" /> Date: Thu, 25 Mar 2021 16:07:46 -0300 Subject: [PATCH 2/3] school picker for pluviometer register screen --- src/app/components/SchoolPicker.js | 127 +++++++++++++++++++++++++++++ src/package-lock.json | 5 ++ src/package.json | 1 + 3 files changed, 133 insertions(+) create mode 100644 src/app/components/SchoolPicker.js diff --git a/src/app/components/SchoolPicker.js b/src/app/components/SchoolPicker.js new file mode 100644 index 0000000..e4e6673 --- /dev/null +++ b/src/app/components/SchoolPicker.js @@ -0,0 +1,127 @@ +import React, { useContext, useState, Component, Fragment } from "react"; +import { StyleSheet, Text, View, PixelRatio, Picker } from "react-native"; + +import { MaterialIcons } from "@expo/vector-icons"; +import { FontAwesome5 } from '@expo/vector-icons'; +import colors from "../config/colors"; +import { dimensions } from "../config/dimensions"; +import Screen from "./Screen"; +import SearchableDropdown from 'react-native-searchable-dropdown'; + +const items = [ + { + id: 1, + name: 'JavaScript', + }, + { + id: 2, + name: 'Java', + }, + { + id: 3, + name: 'Ruby', + }, + { + id: 4, + name: 'React Native', + }, + { + id: 5, + name: 'PHP', + }, + { + id: 6, + name: 'Python', + }, +]; + +function SchoolPicker() { + const [selectedItems, setSelectedItems] = useState(null); + console.log(selectedItems); + + + return ( + + + + + + + + { + setSelectedItems(item) + }} + containerStyle={{ padding: 5 }} + itemStyle={{ + padding: 10, + marginTop: 2, + backgroundColor: '#ddd', + borderColor: '#bbb', + borderWidth: 1, + borderRadius: 5, + }} itemTextStyle={{ color: '#222' }} + itemsContainerStyle={{ maxHeight: 140 }} + items={items} + chip={true} + resetValue={false} + textInputProps={ + { + placeholder: "Escola onde você estuda...", + underlineColorAndroid: "transparent", + style: { + padding: 12, + borderWidth: 1, + borderColor: '#ccc', + borderRadius: 5, + }, + onTextChange: text => console.log(text) + } + } + listProps={ + { + nestedScrollEnabled: false, + + } + } + /> + + + + + + ); +} + +const styles = StyleSheet.create({ + location: { + flex: 1, + width: "100%", + flexDirection: "row", + alignItems: "center", + justifyContent: "space-between", + // backgroundColor: colors.secondary, + }, + adressText: { + flex: 1, + textAlign: "center", + }, + mapIcon: { + backgroundColor: colors.primary, + padding: 8, + width: 20, + alignItems: "center", + borderRadius: 5, + flex: 0.10, + }, +}); + +export default SchoolPicker; diff --git a/src/package-lock.json b/src/package-lock.json index 7649869..f69f45e 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -14844,6 +14844,11 @@ "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-2.10.1.tgz", "integrity": "sha512-Z2kKSk4AwWRQNCBmTjViuBQK0/Lx0jc25TZptn/2gKYUCOuVRvCekoA26u0Tsb3BIQ8tWDsZW14OwDlFUXW1aw==" }, + "react-native-searchable-dropdown": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/react-native-searchable-dropdown/-/react-native-searchable-dropdown-1.1.3.tgz", + "integrity": "sha512-ip6YwjKED/h27oRQGN3f62usFMj5IfS6tr/zZWfQItCAV/XAq5E9P0Exvg/86gSlcGJnnZdoixK+PS1sElxcyA==" + }, "react-native-simple-dialogs": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/react-native-simple-dialogs/-/react-native-simple-dialogs-1.4.0.tgz", diff --git a/src/package.json b/src/package.json index fda1664..814c181 100644 --- a/src/package.json +++ b/src/package.json @@ -45,6 +45,7 @@ "react-native-reanimated": "~1.13.0", "react-native-safe-area-context": "3.1.4", "react-native-screens": "~2.10.1", + "react-native-searchable-dropdown": "^1.1.3", "react-native-simple-dialogs": "^1.4.0", "react-native-svg": "^12.1.0", "react-native-svg-uri": "^1.2.3", From e052787b8a7d7e4473c7f53ab286f62a0d82a922 Mon Sep 17 00:00:00 2001 From: analuizaff Date: Thu, 25 Mar 2021 17:37:58 -0300 Subject: [PATCH 3/3] creating pluviometer register screen --- src/app/components/SchoolPicker.js | 9 +- src/app/screens/PluviometerRegisterScreen.js | 123 +++++++++++++++++++ 2 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 src/app/screens/PluviometerRegisterScreen.js diff --git a/src/app/components/SchoolPicker.js b/src/app/components/SchoolPicker.js index e4e6673..9f02085 100644 --- a/src/app/components/SchoolPicker.js +++ b/src/app/components/SchoolPicker.js @@ -69,7 +69,6 @@ function SchoolPicker() { borderWidth: 1, borderRadius: 5, }} itemTextStyle={{ color: '#222' }} - itemsContainerStyle={{ maxHeight: 140 }} items={items} chip={true} resetValue={false} @@ -103,16 +102,16 @@ function SchoolPicker() { const styles = StyleSheet.create({ location: { - flex: 1, + //flex: 1, width: "100%", flexDirection: "row", - alignItems: "center", + alignItems: "flex-start", justifyContent: "space-between", // backgroundColor: colors.secondary, }, adressText: { - flex: 1, - textAlign: "center", + flex: 0.90, + paddingLeft: 5, }, mapIcon: { backgroundColor: colors.primary, diff --git a/src/app/screens/PluviometerRegisterScreen.js b/src/app/screens/PluviometerRegisterScreen.js new file mode 100644 index 0000000..ef05e92 --- /dev/null +++ b/src/app/screens/PluviometerRegisterScreen.js @@ -0,0 +1,123 @@ +import React, { useState, useContext, useEffect } from "react"; +import { StyleSheet, Text, View, ScrollView, PixelRatio, SafeAreaView } from "react-native"; +import * as Yup from "yup"; +import { + Form, + FormField, + FormPicker as Picker, + 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 SchoolPicker from "../components/SchoolPicker"; + + +const dims = scaleDimsFromWidth(85, 85, 25); + +function PluviometerRegisterScreen(props) { + const context = useContext(EventLocationContext); + + const amount = 2; + + useEffect(() => { + context.defaultLocation(); + }, []); + const location = context.eventCoordinates; + const address = context.eventLocation; + + const [dateTime, setDateTime] = useState(moment()); + const [time, setTime] = useState(moment()); + + return ( + +
+ + + + + Cadastro do Pluviômetro + + {/*Data da coleta:*/} + + + Data do cadastro: + + setDateTime(value)} + onTimeChange={(value) => setTime(value)} + /> + + {/*Local do evento:*/} + + + Endereço do pluviômetro: + props.navigation.navigate("FormMap")} + > + + + + + + Escola: + + + + + +
+
+ ); +} + +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, + }, +}); + +export default PluviometerRegisterScreen;