import { LoadingSpinner } from '@/assets/components/LoadingSpinner'; import { useAuth } from '@/assets/contexts/useAuth'; import { type Href, router } from 'expo-router'; import { useEffect } from 'react'; import { View } from 'react-native'; import styles from '@/styles/screens/root/index.styles'; export default function Index() { const { isAuthenticated, isLoading } = useAuth(); useEffect(() => { if (!isLoading) { if (isAuthenticated) { // Se estiver autenticado, redirecionar para home router.replace('/home' as Href); } else { // Se não estiver autenticado, redirecionar para login router.replace('/login' as Href); } } }, [isAuthenticated, isLoading]); // Mostrar loading enquanto verifica autenticação return ( ); }