From 2c2dfba45357bbd205a59145ae55a2779c911ae0 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Fri, 14 Aug 2026 15:06:35 -0300 Subject: remake Signed-off-by: Lucas Faria Mendes --- src/app/register.tsx | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 src/app/register.tsx (limited to 'src/app/register.tsx') diff --git a/src/app/register.tsx b/src/app/register.tsx new file mode 100644 index 0000000..aac588d --- /dev/null +++ b/src/app/register.tsx @@ -0,0 +1,142 @@ +import React, { useState } from 'react'; +import { View, StyleSheet, Text, KeyboardAvoidingView, Platform, Alert, ScrollView } from 'react-native'; +import { Link, useRouter } from 'expo-router'; +import { useSafeAreaInsets } from 'react-native-safe-area-context'; +import Animated, { FadeInDown, FadeInUp } from 'react-native-reanimated'; +import * as LocalAuthentication from 'expo-local-authentication'; +import * as SecureStore from 'expo-secure-store'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Colors, Spacing, Typography } from '@/constants/theme'; +import { useAuth } from '@/contexts/AuthContext'; + +export default function RegisterScreen() { + const insets = useSafeAreaInsets(); + const router = useRouter(); + const { register } = useAuth(); + + const [name, setName] = useState(''); + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [isLoading, setIsLoading] = useState(false); + + async function handleRegister() { + if (!name || !email || !password) { + Alert.alert('Erro', 'Preencha todos os campos.'); + return; + } + try { + setIsLoading(true); + await register({ name: name.trim(), email: email.trim(), password }); + + const hasHardware = await LocalAuthentication.hasHardwareAsync(); + const isEnrolled = await LocalAuthentication.isEnrolledAsync(); + + if (hasHardware && isEnrolled) { + router.replace('/biometrics'); + } else { + router.replace('/'); + } + } catch (err: any) { + Alert.alert('Erro no cadastro', 'Verifique seus dados.'); + setIsLoading(false); + } + } + + return ( + + + + Criar Conta + Junte-se ao YABA e organize sua vida financeira. + + + + + + + +