diff --git a/src/app/components/ConfirmationModal.js b/src/app/components/ConfirmationModal.js index 9f97768..bb7727b 100644 --- a/src/app/components/ConfirmationModal.js +++ b/src/app/components/ConfirmationModal.js @@ -2,7 +2,7 @@ import React from "react"; import { Modal, StyleSheet, Text, TouchableOpacity, View } from "react-native"; import colors from "../config/colors"; import { dimensions } from "../config/dimensions"; -import { Ionicons } from "@expo/vector-icons"; +import { Ionicons, FontAwesome5 } from "@expo/vector-icons"; function Btn({ label, onPress, bgColor, txtColor, style={} }) { return ( @@ -30,6 +30,7 @@ export default function ConfirmationModal({ title = null, description = "", icon = null, + isNicknameConfirmation= false, }) { return ( )} - - {icon && ( + + {icon && !isNicknameConfirmation && ( )} + {icon && isNicknameConfirmation && ( + + + + )} {description} { return password !== confirmPassword; @@ -321,7 +324,6 @@ export default function RegisterScreen(props) { date.format("DD/MM/yyyy") === moment().format("DD/MM/yyyy") ? "" : date; const result = await signup({ ...form, dateofborn: formDate }); - // console.log(JSON.stringify(result)) switch (result.status) { case 200: @@ -371,6 +373,35 @@ export default function RegisterScreen(props) { return !inUse; }; + const copnfirmations = (form, actions) => { + console.log(form); + var current_mask = + form.number.length >= 11 ? "(99) 99999-9999" : "(99) 9999-9999"; + + const psw_match = comparePassword(form.password, form.confirmPassword); + if (psw_match) { + actions.setFieldError("confirmPassword", "As senhas não correspondem"); + scroll.scrollTo({ x: 0, y: 0, animated: true }); + } else { + fieldsAreNotInUse(form, actions).then((isNotUsed) => { + if (isNotUsed) { + setShowModal({ + show: true, + form: form, + message: + 'Você está cadastrando o apelido "' + + form.name + + '" e o número ' + mask(form.number, current_mask) + + '. Deseja continuar o cadastro?', + }); + } else { + console.log("scrolll"); + scroll.scrollTo({ x: 0, y: 0, animated: true }); + } + }); + } + }; + return ( setShowLog({ ...showLog, show: false })} /> + { + handleSubmit(showModal.form); + }} + onDecline={() => { + setShowModal({ ...showModal, show: false, message: "" }); + }} + /> +
{ - console.log(form); - const psw_match = comparePassword( - form.password, - form.confirmPassword - ); - - if (psw_match) { - actions.setFieldError( - "confirmPassword", - "As senhas não correspondem" - ); - scroll.scrollTo({ x: 0, y: 0, animated: true }); - } else { - fieldsAreNotInUse(form, actions).then((isNotUsed) => { - if (isNotUsed) { - handleSubmit(form); - } else { - console.log("scrolll"); - scroll.scrollTo({ x: 0, y: 0, animated: true }); - } - }); - } + copnfirmations(form, actions); }} validationSchema={validationSchema} > @@ -527,11 +552,13 @@ export default function RegisterScreen(props) { Nome da instituição - + - O nome da instituição é fornecido pelo Cemaden Educação + + O nome da instituição é fornecido pelo Cemaden Educação + Vínculo institucional: @@ -633,4 +660,4 @@ const styles = StyleSheet.create({ textAlign: "left", marginBottom: 24, }, -}); +});