-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.jsx
executable file
·67 lines (54 loc) · 2.54 KB
/
App.jsx
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 { StatusBar } from 'react-native'
import {useCallback, useEffect} from 'react'
import { Provider } from 'react-redux'
import Constants from 'expo-constants';
import 'react-native-gesture-handler'
import * as SplashScreen from 'expo-splash-screen';
import { useFonts, loadAsync } from 'expo-font'
import { Manjari_400Regular as Manjari, Manjari_700Bold as ManjariBold } from '@expo-google-fonts/manjari'
const statusBarHeight = Constants.statusBarHeight;
import FirebaseApp from '@react-native-firebase/app';
import FireStore from '@react-native-firebase/firestore';
import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import { PaperProvider } from 'react-native-paper'
import { useSafeAreaInsets, SafeAreaProvider } from 'react-native-safe-area-context'
import Store from './redux/store'
import HomeScreen from './screens/home/index'
import ExerciseScreen from './screens/home/exercises/exercises'
import ExerciseDetailScreen from './screens/home/exercises/exercise.detail'
import WorkoutsScreen from './screens/home/workouts';
import WorkoutScreen from './screens/home/workouts/workout'
import Config from './config'
const Stack = createStackNavigator();
const App = () => {
const [fontsLoaded, error] = useFonts({ Manjari, ManjariBold });
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
if(FirebaseApp.apps.length === 0) FirebaseApp.initializeApp(Config.firebaseConfig);
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<Provider store={Store}>
<PaperProvider>
<SafeAreaProvider onLayout={onLayoutRootView} style={{paddingTop: statusBarHeight}}>
<NavigationContainer>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen name="Home" options={{ headerShown: false }} component={HomeScreen} />
<Stack.Screen name="ExerciseList" options={{ headerShown: false }} component={ExerciseScreen} />
<Stack.Screen name="Exercise" options={{ headerShown: false }} component={ExerciseDetailScreen} />
<Stack.Screen name="Workouts" options={{ headerShown: false }} component={WorkoutsScreen} />
<Stack.Screen name="Workout" options={{ headerShown: false }} component={WorkoutScreen} />
</Stack.Navigator>
</NavigationContainer>
<StatusBar backgroundColor={'black'} />
</SafeAreaProvider>
</PaperProvider>
</Provider>
);
}
export default App;