You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import React, { useEffect, useState } from 'react'; import {Button, Text, View} from 'react-native'; import ELogo from '@components/ELogo'; import { useAuthState } from '@components/AuthProvider'; import { Redirect, useRouter } from 'expo-router'; import auth from '@react-native-firebase/auth';
export default function LoginScreen(props:any) { const [user, _, setLoginState, init] = useAuthState(); const [redirect, setRedirect] = useState(false); const router = useRouter(); useEffect(() => { if (!init) { if (user === null) setRedirect(true); } }, [init]) if (redirect) { return <Redirect href="auth/login" /> } return ( <> <View style={{ flex: 1, rowGap: 24, flexDirection: 'column', paddingTop: 345, }}> <ELogo /> <Text style={{color: 'white'}}>{JSON.stringify(user)} , {JSON.stringify(init)}</Text> <Button title="Signout" onPress={async ()=> {await auth().signOut(); router.replace("auth/login")}} /> </View> </> ); }
|