From 8575c74faa3191b12d5989bda6a3713af3a6a5e5 Mon Sep 17 00:00:00 2001 From: GabrielTrettel Date: Thu, 23 Sep 2021 15:37:03 -0300 Subject: [PATCH] [not finished] Implementing some components of the registration screen --- src/app/screens/RegisterScreen.js | 303 +++++++++++++++++++++++------- 1 file changed, 234 insertions(+), 69 deletions(-) diff --git a/src/app/screens/RegisterScreen.js b/src/app/screens/RegisterScreen.js index 32002ff..9367143 100644 --- a/src/app/screens/RegisterScreen.js +++ b/src/app/screens/RegisterScreen.js @@ -8,10 +8,18 @@ import React, { useState } from "react"; import { StyleSheet, View, Text, TouchableNativeFeedback } from "react-native"; import Screen from "../components/Screen"; import { dimensions } from "../config/dimensions"; +import { + FontAwesome5, + FontAwesome, + MaterialCommunityIcons, +} from "@expo/vector-icons"; import colors from "../config/colors"; import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; -import assets from "../config/assets"; import * as Yup from "yup"; +import FormDatePicker from "../components/forms/FormDatePicker"; +import moment from "moment"; +import { Shadow } from "react-native-shadow-2"; +import SearchablePicker from "../components/SearchablePicker"; const phoneRegex = RegExp( /^\(?[\(]?([0-9]{2})?\)?[)\b]?([0-9]{4,5})[-. ]?([0-9]{4})$/ @@ -32,9 +40,96 @@ const validationSchema = Yup.object().shape({ .required("A senha é obrigatória") .min(8, "Senha muito curta, minimo 8 caracteres") .matches(/[a-zA-Z]/, "A senha só pode conter letras"), + state: Yup.string().required("O estado é obrigatório"), }); +function LocalDatePicker({ date, setDate, _moment }) { + const formatDate = () => date.format("DD/MM/YYYY"); + + return ( + + setDate(value)} + minimumDate={new Date(moment().subtract(110, "year"))} + date={date} + > + + + + + {date != _moment + ? formatDate() + : "Selecione a data de nascimento"} + + + + + + + ); +} + +function GenderPicker({ value, setValue }) { + const [items, setItems] = useState([ + { value: "Feminino", label: "Feminino" }, + { value: "Masculino", label: "Masculino" }, + { value: "Prefiro não dizer", label: "Prefiro não dizer" }, + ]); + return ( + + ); +} + +function StatePicker({ value, setValue }) { + const [items, setItems] = useState([{value: "a", label: "a"}]); + return ( + + ); +} + export default function RegisterScreen(props) { + const [gender, setGender] = useState(""); + const [state, setState] = useState("") + + const _moment = moment(); + const [date, setDate] = useState(_moment); const [singUpFailed, setSingUpFailed] = useState(false); const comparePassword = (password, confirmPassword) => { @@ -53,6 +148,8 @@ export default function RegisterScreen(props) { number: "", password: "", confirmPassword: "", + state: "", + gender: "", }} onSubmit={({ name, number, password, confirmPassword }) => { comparePassword(password, confirmPassword); @@ -61,78 +158,133 @@ export default function RegisterScreen(props) { validationSchema={validationSchema} > - - + Apelido de usuário* + + + + + + + Número do telefone:* + + + + + + Senha:* + + + + + + Confirmar senha:* + + + + + - - - - - Nome Completo: - - - - Número do telefone: - - - - Senha: - - - - Confirmar senha: - - - Data de nascimento + + + + - Gênero: + + + + - { - props.navigation.goBack(); - }} - > - - Já tem uma conta? - Faça Login - - - - + Estado*: + + + + + + + + + + { + props.navigation.goBack(); + }} + > + + Já tem uma conta? + Faça Login + + + @@ -144,13 +296,26 @@ const styles = StyleSheet.create({ flex: 1, justifyContent: "center", textAlign: "center", - padding: 10, + paddingHorizontal: 10, }, labelStyle: { fontSize: dimensions.text.secondary, fontWeight: "bold", textAlign: "left", - color: colors.lightBlue, + color: colors.secondary, marginTop: 10, }, + iconField: { + width: "100%", + flex: 1, + alignItems: "center", + flexDirection: "row", + marginTop: 12, + marginBottom: 24, + }, + dateInput: { + paddingLeft: 12, + // flexDirection: "column", + // justifyContent: "center", + }, });