import '../global.css';
import { Stack, Redirect } from 'expo-router';
import { useEffect } from 'react';
import { useAuthStore } from '~/store/authStore';
import { View, ActivityIndicator, LogBox } from 'react-native';
import { SafeAreaProvider, initialWindowMetrics } from 'react-native-safe-area-context';
import { ErrorBoundary } from '~/components/ErrorBoundary';
import { ThemeProvider } from '~/components/ThemeProvider';
import { ThemeWrapper } from '~/components/ThemeWrapper';
import 'react-native-reanimated';
// Configure Reanimated logger to reduce noise (if available)
try {
const Reanimated = require('react-native-reanimated');
if (Reanimated.configureReanimatedLogger) {
Reanimated.configureReanimatedLogger({
level: Reanimated.ReanimatedLogLevel?.warn,
strict: false,
});
}
} catch (e) {
console.warn('Reanimated logger configuration not available');
}
// Ignore known warnings from third-party libraries
LogBox.ignoreLogs([
'SafeAreaView has been deprecated',
'A UIRefreshControl received offscreen',
]);
export const unstable_settings = {
// Ensure that reloading on `/modal` keeps a back button present.
initialRouteName: '(tabs)',
};
export default function RootLayout() {
const { initialize, isInitialized, isLoading, user } = useAuthStore();
useEffect(() => {
initialize();
}, []);
if (!isInitialized || isLoading) {
return (
);
}
return (
{!user ? (
) : (
)}
);
}