59 lines
2.2 KiB
TypeScript
59 lines
2.2 KiB
TypeScript
import { QueryClientProvider } from "@tanstack/react-query";
|
|
import queryClient from "../utils/queryClient";
|
|
import { Stack } from "expo-router";
|
|
import { useFonts } from "expo-font";
|
|
import * as SplashScreen from "expo-splash-screen";
|
|
import { Provider as PaperProvider } from "react-native-paper";
|
|
import { INTER_FONTS, PAPER_THEME } from "common-ui";
|
|
import { LogBox } from "react-native";
|
|
import { useEffect } from "react";
|
|
import { StaffAuthProvider } from "@/components/context/staff-auth-context";
|
|
import { trpc, trpcClient } from "@/src/trpc-client";
|
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
import { RefreshProvider } from '../../../packages/ui/src/lib/refresh-context';
|
|
import Toast from "react-native-toast-message";
|
|
import { NotificationProvider } from "@/services/notif-service/notif-context";
|
|
import NotifChecker from "@/services/notif-service/notif-checker";
|
|
|
|
// Silence dev warnings/errors in LogBox. The "Open debugger to view warnings"
|
|
// toast overlays the bottom of the UI and intercepts taps (e.g. the Add Slot
|
|
// FAB), which breaks E2E flows.
|
|
if (__DEV__) {
|
|
LogBox.ignoreAllLogs(true);
|
|
}
|
|
|
|
SplashScreen.preventAutoHideAsync();
|
|
|
|
export default function Layout() {
|
|
const [fontsLoaded, fontError] = useFonts(INTER_FONTS);
|
|
|
|
useEffect(() => {
|
|
if (fontsLoaded || fontError) SplashScreen.hideAsync();
|
|
}, [fontsLoaded, fontError]);
|
|
|
|
if (!fontsLoaded && !fontError) return null;
|
|
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<trpc.Provider client={trpcClient} queryClient={queryClient}>
|
|
<StaffAuthProvider>
|
|
<NotificationProvider>
|
|
<PaperProvider theme={PAPER_THEME}>
|
|
<SafeAreaView
|
|
edges={['left', 'right', 'bottom']}
|
|
style={{ flex: 1, backgroundColor: '#fff' }}
|
|
testID="app-root"
|
|
>
|
|
<RefreshProvider queryClient={queryClient}>
|
|
<Stack screenOptions={{ headerShown: false }} />
|
|
</RefreshProvider>
|
|
</SafeAreaView>
|
|
</PaperProvider>
|
|
<NotifChecker />
|
|
<Toast />
|
|
</NotificationProvider>
|
|
</StaffAuthProvider>
|
|
</trpc.Provider>
|
|
</QueryClientProvider>
|
|
);
|
|
}
|