-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
80 lines (69 loc) · 2.79 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
const { useCallback } = require('react');
const SplashScreen = require('expo-splash-screen');
const { StatusBar } = require('expo-status-bar');
const { ThemeProvider } = require('styled-components');
const { NavigationContainer } = require('@react-navigation/native');
const { createStackNavigator } = require('@react-navigation/stack');
const ReactRedux = require('react-redux');
const MiddleEnd = require('strange-middle-end');
const Eva = require('@eva-design/eva');
const { GestureHandlerRootView } = require('react-native-gesture-handler');
const { ApplicationProvider } = require('@ui-kitten/components');
const M = require('middle-end');
const Theme = require('theme');
const Routes = require('routes');
const {
useFonts,
OpenSans_400Regular,
OpenSans_400Regular_Italic,
OpenSans_700Bold,
OpenSans_700Bold_Italic
} = require('@expo-google-fonts/open-sans');
SplashScreen.preventAutoHideAsync();
const middleEnd = M.create({
logErrors: process.env.NODE_ENV !== 'test'
}).initialize();
const Stack = createStackNavigator();
module.exports = function App() {
const [fontsLoaded] = useFonts({
OpenSans_400Regular,
OpenSans_400Regular_Italic,
OpenSans_700Bold,
OpenSans_700Bold_Italic
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<GestureHandlerRootView style={{ flex: 1 }} onLayout={onLayoutRootView}>
<ThemeProvider theme={Theme}>
<ApplicationProvider {...Eva} theme={{ ...Eva.light, ...Theme }}>
<MiddleEnd.Provider middleEnd={middleEnd}>
<ReactRedux.Provider store={middleEnd.store}>
<NavigationContainer>
<Stack.Navigator>
{Routes.map(({ path, component, options }) => {
return (
<Stack.Screen
key={path}
name={path}
component={component}
options={options}
/>
);
})}
</Stack.Navigator>
</NavigationContainer>
<StatusBar style="auto" />
</ReactRedux.Provider>
</MiddleEnd.Provider>
</ApplicationProvider>
</ThemeProvider>
</GestureHandlerRootView>
);
};