import React, { useState } from 'react'; import { View, TextInput, Button, StyleSheet } from 'react-native'; import { signInWithEmailAndPassword, createUserWithEmailAndPassword } from 'firebase/auth'; import { auth } from '../config/firebase'; import { useDispatch } from 'react-redux'; import { setUser } from '../store/authSlice'; function LoginScreen({ navigation }: any) { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const dispatch = useDispatch(); const handleLogin = async () => { try { const userCredential = await signInWithEmailAndPassword(auth, email, password); dispatch(setUser({ uid: userCredential.user.uid, email: userCredential.user.email! })); navigation.replace('Projects'); } catch (error: any) { alert(error.message); } }; const handleRegister = async () => { try { const userCredential = await createUserWithEmailAndPassword(auth, email, password); dispatch(setUser({ uid: userCredential.user.uid, email: userCredential.user.email! })); navigation.replace('Projects'); } catch (error: any) { alert(error.message); } }; return (