-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path_layout.tsx
More file actions
67 lines (60 loc) · 1.78 KB
/
_layout.tsx
File metadata and controls
67 lines (60 loc) · 1.78 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { useFonts } from 'expo-font';
import { Stack } from 'expo-router';
import * as SplashScreen from 'expo-splash-screen';
import { useEffect } from 'react';
import { View } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import {
configureReanimatedLogger,
ReanimatedLogLevel,
} from 'react-native-reanimated';
import '@/global.css';
import { useScreenDimensions } from '@/hooks/useScreenDimensions';
// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();
// Disable reanimated warnings
configureReanimatedLogger({
level: ReanimatedLogLevel.warn,
strict: false,
});
export default function RootLayout() {
const { scale } = useScreenDimensions();
const [loaded, error] = useFonts({
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
});
useEffect(() => {
if (loaded || error) {
SplashScreen.hideAsync();
if (error) {
console.warn(`Error in loading fonts: ${error}`);
}
}
}, [loaded, error]);
if (!loaded && !error) {
return null;
}
return (
<View className="bg-[--color-background] flex-1">
<GestureHandlerRootView>
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
<Stack.Screen
name="about"
options={{
presentation: 'modal',
headerShown: false,
contentStyle: {
width: '70%',
maxHeight: '70%',
alignSelf: 'center',
marginTop: 50 * scale,
borderWidth: 2 * scale,
},
}}
/>
<Stack.Screen name="[...missing]" />
</Stack>
</GestureHandlerRootView>
</View>
);
}