forked from techx/notreal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
54 lines (45 loc) · 1.74 KB
/
App.js
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
import { useCallback } from 'react';
import { View } from 'react-native';
import * as SplashScreen from 'expo-splash-screen';
import { useFonts } from 'expo-font';
import { Manrope_800ExtraBold, Manrope_700Bold, Manrope_500Medium } from '@expo-google-fonts/manrope'
import { createNativeStackNavigator } from '@react-navigation/native-stack'
import { NavigationContainer } from '@react-navigation/native';
import PostsProvider from './contexts/posts'
import ProfileProvider from './contexts/profile'
import Header from './components/Header';
import MainScreen from './navigation/MainScreen';
import CameraScreen from './navigation/CameraScreen'
import InitialScreen from './navigation/InitialScreen';
const Stack = createNativeStackNavigator();
SplashScreen.preventAutoHideAsync();
export default function App() {
const [fontsLoaded] = useFonts({
Manrope_500Medium,
Manrope_700Bold,
Manrope_800ExtraBold
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<View style={{ flex: 1 }} onLayout={onLayoutRootView}>
<ProfileProvider>
<PostsProvider>
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen options={{ header: () => <Header partial /> }} name="Initial" component={InitialScreen} />
<Stack.Screen options={{ header: () => <Header /> }} name="Main" component={MainScreen} />
<Stack.Screen options={{ header: () => <Header partial darkMode /> }} name="Camera" component={CameraScreen} />
</Stack.Navigator>
</NavigationContainer>
</PostsProvider>
</ProfileProvider>
</View>
);
}