import React, { useEffect, useRef } from 'react'; import { NavigationContainer } from '@react-navigation/native'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import * as Notifications from 'expo-notifications'; import { RootNavigator } from './src/navigation/RootNavigator'; const queryClient = new QueryClient({ defaultOptions: { queries: { retry: 1, staleTime: 1000 * 60 * 5, // 5 minutes }, }, }); export default function App() { const notificationListener = useRef(); const responseListener = useRef(); useEffect(() => { // Handle notifications received while app is in foreground notificationListener.current = Notifications.addNotificationReceivedListener( (notification) => { console.log('Notification received:', notification); }, ); // Handle notification tap responseListener.current = Notifications.addNotificationResponseReceivedListener( (response) => { console.log('Notification tapped:', response); // TODO: navigate to relevant screen based on response.notification.request.content.data }, ); return () => { notificationListener.current?.remove(); responseListener.current?.remove(); }; }, []); return ( ); }