-
Notifications
You must be signed in to change notification settings - Fork 4
/
App.tsx
62 lines (61 loc) · 2.12 KB
/
App.tsx
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
import { NavigationContainer, DefaultTheme } from "@react-navigation/native";
import {RootRoute} from "./Route/RootRoute";
import { createStackNavigator } from "@react-navigation/stack";
import { Dimensions, ToastAndroid } from "react-native";
import ContextState from "./Context/ContextState";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet'
import { RouteOnboarding } from "./Route/OnboardingScreen/RouteOnboarding";
import { InitialScreen } from "./Route/InitialScreen";
import CodePush from "react-native-code-push";
import { useEffect} from "react";
const Stack = createStackNavigator()
let codePushOptions = { checkFrequency: CodePush.CheckFrequency.ON_APP_START };
function App(){
const width = Dimensions.get("window").width
const MyTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: '#6CC04A',
text: '#F4F5FC',
textSecondary: '#CCCCCC',
white : "white",
spacing : 10,
headingSize:width * 0.085,
fontSize:width * 0.045,
disabled:'rgb(131,131,131)',
background:'#101010',
},
};
useEffect(()=>{
// @ts-ignore
CodePush.notifyAppReady()
CodePush.checkForUpdate().then(update => {
if (update) {
ToastAndroid.showWithGravity(
`App Update Available and will be updated automatically`,
ToastAndroid.LONG,
ToastAndroid.CENTER,
);
CodePush.sync(
{ installMode: CodePush.InstallMode.IMMEDIATE },
);
}
});
},[])
return <GestureHandlerRootView style={{flex:1}}>
<ContextState>
<BottomSheetModalProvider>
<NavigationContainer theme={MyTheme}>
<Stack.Navigator screenOptions={{headerShown:false}}>
<Stack.Screen name="Initial" component={InitialScreen} />
<Stack.Screen name="Onboarding" component={RouteOnboarding} />
<Stack.Screen name="MainRoute" component={RootRoute} />
</Stack.Navigator>
</NavigationContainer>
</BottomSheetModalProvider>
</ContextState>
</GestureHandlerRootView>
}
export default CodePush(codePushOptions)(App)