672d053ece
- Add new hook files for departure time, destination station, geocode, theme, walk route, and WienerLinien - Add navigation types for centralized route definitions - Update App.tsx to use ref for initialization logic - Update notification service to use stable exports from expo-notifications - Remove legacy notifications.ts and rename to expoNotifications.ts - Add ScrollView to several screens for better layout - Replace duplicated type definitions with imports from shared navigation types - Add useTheme to relevant screens - Remove notification handler duplication in App.tsx
32 lines
852 B
TypeScript
32 lines
852 B
TypeScript
import { useEffect, useRef } from 'react';
|
|
import * as Notifications from './src/services/expoNotifications';
|
|
import AppNavigator from './src/navigation/AppNavigator';
|
|
|
|
export default function App() {
|
|
const initRef = useRef(false);
|
|
|
|
useEffect(() => {
|
|
// Run initialization only once
|
|
if (initRef.current) return;
|
|
initRef.current = true;
|
|
|
|
(async () => {
|
|
// Request notification permissions
|
|
await Notifications.requestPermissionsAsync();
|
|
|
|
// Set up notification handler (called exactly once)
|
|
Notifications.setNotificationHandler({
|
|
handleNotification: async () => ({
|
|
shouldShowAlert: true,
|
|
shouldPlaySound: true,
|
|
shouldSetBadge: false,
|
|
shouldShowBanner: true,
|
|
shouldShowList: true,
|
|
}),
|
|
});
|
|
})();
|
|
}, []);
|
|
|
|
return <AppNavigator />;
|
|
}
|