import { useEffect, useRef } from 'react'; import { Stack } from 'expo-router'; import { StatusBar } from 'expo-status-bar'; import { ImageBackground, StyleSheet, View } from 'react-native'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { GestureHandlerRootView } from 'react-native-gesture-handler'; import { SafeAreaProvider } from 'react-native-safe-area-context'; import { useAuthStore } from '../store/authStore'; import { registerForPushNotifications, addNotificationListener, addNotificationResponseListener } from '../services/notifications'; import { ThemeProvider, useThemeContext } from '../components/ThemeProvider'; const queryClient = new QueryClient(); function RootLayoutInner() { const { checkAuth } = useAuthStore(); const { colors, isDark } = useThemeContext(); const notificationListener = useRef>(); const responseListener = useRef>(); useEffect(() => { checkAuth(); registerForPushNotifications(); notificationListener.current = addNotificationListener((notification) => { console.log('Notification received:', notification); }); responseListener.current = addNotificationResponseListener((response) => { console.log('Notification clicked:', response); }); return () => { notificationListener.current?.remove(); responseListener.current?.remove(); }; }, []); return ( <> ); } export default function RootLayout() { return ( ); } const bgStyles = StyleSheet.create({ background: { flex: 1, }, backgroundImage: { opacity: 0.8, }, overlay: { ...StyleSheet.absoluteFillObject, backgroundColor: 'rgba(255, 252, 245, 0.2)', }, });