2024-02-16 22:51:50 +01:00
|
|
|
import { useFonts } from "expo-font"
|
|
|
|
import { Stack } from "expo-router"
|
|
|
|
import * as SplashScreen from "expo-splash-screen"
|
|
|
|
import { useEffect } from "react"
|
2024-02-23 15:31:43 +01:00
|
|
|
import {
|
|
|
|
MD3LightTheme as DefaultTheme,
|
|
|
|
PaperProvider,
|
|
|
|
} from "react-native-paper"
|
|
|
|
import { StatusBar } from "expo-status-bar"
|
2024-02-16 22:51:50 +01:00
|
|
|
|
2024-03-16 00:36:44 +01:00
|
|
|
import CanterburyFont from "../presentation/assets/fonts/Canterbury.ttf"
|
|
|
|
import GeoramFont from "../presentation/assets/fonts/Georama-Black.ttf"
|
|
|
|
import SpaceMonoFont from "../presentation/assets/fonts/SpaceMono-Regular.ttf"
|
|
|
|
import { HabitsTrackerProvider } from "@/presentation/react/contexts/HabitsTracker"
|
2024-02-16 22:51:50 +01:00
|
|
|
|
|
|
|
export { ErrorBoundary } from "expo-router"
|
|
|
|
|
|
|
|
export const unstableSettings = {
|
|
|
|
initialRouteName: "index",
|
|
|
|
}
|
|
|
|
|
|
|
|
SplashScreen.preventAutoHideAsync().catch((error) => {
|
|
|
|
console.error(error)
|
|
|
|
})
|
|
|
|
|
|
|
|
const RootLayout: React.FC = () => {
|
|
|
|
const [loaded, error] = useFonts({
|
|
|
|
Georama: GeoramFont,
|
|
|
|
SpaceMono: SpaceMonoFont,
|
|
|
|
Canterbury: CanterburyFont,
|
|
|
|
})
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (error != null) {
|
|
|
|
throw error
|
|
|
|
}
|
|
|
|
}, [error])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (loaded) {
|
|
|
|
SplashScreen.hideAsync().catch((error) => {
|
|
|
|
console.error(error)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}, [loaded])
|
|
|
|
|
|
|
|
if (!loaded) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-03-15 22:48:28 +01:00
|
|
|
<HabitsTrackerProvider>
|
|
|
|
<PaperProvider
|
|
|
|
theme={{
|
|
|
|
...DefaultTheme,
|
|
|
|
colors: {
|
|
|
|
...DefaultTheme.colors,
|
|
|
|
primary: "#f57c00",
|
|
|
|
secondary: "#fbc02d",
|
|
|
|
},
|
2024-02-23 15:31:43 +01:00
|
|
|
}}
|
|
|
|
>
|
2024-03-15 22:48:28 +01:00
|
|
|
<Stack
|
|
|
|
screenOptions={{
|
|
|
|
headerShown: false,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Stack.Screen name="(pages)" />
|
|
|
|
</Stack>
|
2024-02-23 15:31:43 +01:00
|
|
|
|
2024-03-15 22:48:28 +01:00
|
|
|
<StatusBar style="dark" />
|
|
|
|
</PaperProvider>
|
|
|
|
</HabitsTrackerProvider>
|
2024-02-16 22:51:50 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default RootLayout
|