import React, {useState} from 'react'; import {Pressable, StyleSheet, Text, TextInput, View} from 'react-native'; import useAuthHook from '../../hooks/useAuthHook'; import Screen from '../layout/Screen'; import {Button, ButtonTray} from '../UI/Button'; const RegisterScreen = ({navigation}) => { const { username, email, password, confirmPassword, accountType, error, isLoading, setUsername, setEmail, setPassword, setConfirmPassword, setAccountType, register, } = useAuthHook(); const [submitting, setSubmitting] = useState(false); const handleRegister = async () => { setSubmitting(true); const user = await register(); setSubmitting(false); if (!user) return; if (user.IsAcceptedAdmin) { navigation.reset({index: 0, routes: [{name: 'Admin'}]}); return; } navigation.reset({index: 0, routes: [{name: 'Game'}]}); }; return ( Create Account setAccountType('Individual')} disabled={isLoading} > Individual setAccountType('Business/School')} disabled={isLoading} > Business {error ? {error} : null}