71 lines
1.8 KiB
TypeScript
71 lines
1.8 KiB
TypeScript
import {
|
|
DarkTheme as NavigationDarkTheme,
|
|
DefaultTheme as NavigationDefaultTheme,
|
|
ThemeProvider,
|
|
} from "@react-navigation/native";
|
|
import { PaperProvider, adaptNavigationTheme } from "react-native-paper";
|
|
import { useFonts } from "expo-font";
|
|
import { Stack } from "expo-router";
|
|
import * as SplashScreen from "expo-splash-screen";
|
|
import { useEffect } from "react";
|
|
import "react-native-reanimated";
|
|
|
|
import { useColorScheme } from "@/hooks/useColorScheme";
|
|
|
|
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
|
SplashScreen.preventAutoHideAsync();
|
|
|
|
const linking = {
|
|
prefixes: [
|
|
/* your linking prefixes */
|
|
"musclecat://",
|
|
"https://musclecat.pi.korz.tech",
|
|
"https://musclecat.pi4.korz.tech",
|
|
],
|
|
config: {
|
|
/* configuration for matching screens with paths */
|
|
screens: {
|
|
Home: {
|
|
screens: {
|
|
List: "lists/:listId?",
|
|
Task: "tasks/:taskId",
|
|
},
|
|
},
|
|
History: "history",
|
|
Profile: "profile",
|
|
},
|
|
},
|
|
};
|
|
|
|
const { LightTheme, DarkTheme } = adaptNavigationTheme({
|
|
reactNavigationLight: NavigationDefaultTheme,
|
|
reactNavigationDark: NavigationDarkTheme,
|
|
});
|
|
|
|
export default function RootLayout() {
|
|
const colorScheme = useColorScheme();
|
|
const [loaded] = useFonts({
|
|
SpaceMono: require("../assets/fonts/SpaceMono-Regular.ttf"),
|
|
});
|
|
|
|
useEffect(() => {
|
|
if (loaded) {
|
|
SplashScreen.hideAsync();
|
|
}
|
|
}, [loaded]);
|
|
|
|
if (!loaded) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<PaperProvider>
|
|
<ThemeProvider value={colorScheme === "dark" ? DarkTheme : LightTheme}>
|
|
<Stack>
|
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
<Stack.Screen name="+not-found" />
|
|
</Stack>
|
|
</ThemeProvider>
|
|
</PaperProvider>
|
|
);
|
|
}
|