-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
50 lines (43 loc) · 1.37 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import "./lib/unistyles";
import { QueryClientProvider } from "@tanstack/react-query";
import * as SplashScreen from "expo-splash-screen";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { PaperProvider } from "react-native-paper";
import {
SafeAreaProvider,
useSafeAreaInsets,
} from "react-native-safe-area-context";
import { Toaster } from "sonner-native";
import { AuthProvider, useAuth } from "./contexts/AuthContext";
import { useGlobalListeners } from "./hooks/useGlobalListeners";
import { useThemes } from "./hooks/useThemes";
import { Navigation } from "./lib/navigation";
import { queryClient } from "./lib/queryClient";
SplashScreen.preventAutoHideAsync();
function App() {
useGlobalListeners();
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<SafeAreaProvider>
<AuthProvider>
<QueryClientProvider client={queryClient}>
<AppContent />
</QueryClientProvider>
</AuthProvider>
</SafeAreaProvider>
</GestureHandlerRootView>
);
}
function AppContent() {
const { isLoading } = useAuth();
const { navigationTheme, paperTheme } = useThemes();
const insets = useSafeAreaInsets();
if (isLoading) return null;
return (
<PaperProvider theme={paperTheme}>
<Navigation theme={navigationTheme} onReady={SplashScreen.hideAsync} />
<Toaster offset={insets.top + 16} />
</PaperProvider>
);
}
export default App;