import { useEffect } from 'react'; import { Stack } from 'expo-router'; import { StatusBar } from 'expo-status-bar'; import * as Notifications from 'expo-notifications'; import { GestureHandlerRootView } from 'react-native-gesture-handler'; import { KeyboardProvider } from 'react-native-keyboard-controller'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { SafeAreaProvider } from 'react-native-safe-area-context'; import { ActionSheetProvider } from '@expo/react-native-action-sheet'; import * as SplashScreen from 'expo-splash-screen'; import { useFonts, Nunito_400Regular, Nunito_600SemiBold, Nunito_700Bold, Nunito_800ExtraBold, } from '@expo-google-fonts/nunito'; import { useAuthStore } from '../stores/auth'; import { useThemeStore } from '../stores/theme'; import { useColors } from '../lib/theme'; import { useLanguageStore } from '../stores/language'; import { BrandSplash } from '../components/BrandSplash'; import { DeviceLimitReachedSheet } from '../components/DeviceLimitReachedSheet'; import '../lib/i18n'; // i18next-Init via Side-Effect import '../global.css'; SplashScreen.preventAutoHideAsync(); Notifications.setNotificationHandler({ handleNotification: async () => ({ shouldShowBanner: true, shouldShowList: true, shouldPlaySound: true, shouldSetBadge: false, }), }); const queryClient = new QueryClient({ defaultOptions: { queries: { retry: 2, staleTime: 1000 * 60, }, }, }); function RootLayoutInner() { const { loading, init } = useAuthStore(); const initTheme = useThemeStore((s) => s.init); const colorScheme = useThemeStore((s) => s.colorScheme); const initLanguage = useLanguageStore((s) => s.init); const colors = useColors(); const [fontsLoaded] = useFonts({ Nunito_400Regular, Nunito_600SemiBold, Nunito_700Bold, Nunito_800ExtraBold, }); useEffect(() => { init(); initTheme(); initLanguage(); }, []); useEffect(() => { if (fontsLoaded && !loading) { SplashScreen.hideAsync(); } }, [fontsLoaded, loading]); if (!fontsLoaded || loading) { return ; } return ( <> ); } export default function RootLayout() { return ( ); }