import { supabase } from '@/lib/supabase'; import { router } from 'expo-router'; import { useState } from 'react'; import { Alert, Keyboard, KeyboardAvoidingView, Platform, Pressable, ScrollView, Text, TextInput, TouchableWithoutFeedback, View, } from 'react-native'; export default function CreateUser() { const [email, SetEmail] = useState(''); const [password, SetPassword] = useState(''); const [isLoading, SetIsLoading] = useState(false); const SignUp = async () => { if (email.trim() === '' || password.trim() === '') { Alert.alert('All fields are required!'); return; } SetIsLoading(true); const { data, error } = await supabase.auth.signUp({ email: email.trim(), password, }); SetIsLoading(false); if (error) { Alert.alert(error.message, 'User could not be created, please try again'); return; } if (!data.session) { Alert.alert( 'Check your email', 'Your account was created. Please confirm your email before signing in.' ); router.replace('/login'); return; } router.replace('/'); }; const inputClassName = 'rounded-2xl border border-app-border bg-app-subtle px-4 py-3 text-base text-text-main'; return ( Study Sprint Organize subjects, assignments, and tasks in one calm workflow. Create account Start your next study sprint. Email Password {isLoading ? 'Creating account...' : 'Create account'} router.push('/login')} > Already have an account? Log in ); }