-
Notifications
You must be signed in to change notification settings - Fork 11
/
App.tsx
57 lines (57 loc) · 2.05 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
import { NavigationContainer, DefaultTheme } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { RootRoute } from "./Route/RootRoute";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { VideoPlayerScreen } from "./Route/Anime/VideoPlayerScreen";
import { InitialScreen } from "./Route/InitialRoute";
import { ContextState } from "./GlobalState/ContextState";
import CodePush from "react-native-code-push";
import { useEffect } from "react";
import { ToastAndroid } from "react-native";
import { RootRouteWithMangaHome } from "./Route/RootRouteWithMangaHome";
let codePushOptions = { checkFrequency: CodePush.CheckFrequency.ON_APP_START };
function App() {
const Stack = createNativeStackNavigator()
const MyTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: '#c3242b',
text: '#fbf4f4',
white : "white",
disabled: 'rgb(131,131,131)',
background:'black',
},
};
useEffect(()=>{
// @ts-ignore
CodePush.notifyAppReady()
CodePush.checkForUpdate().then(update => {
if (update) {
ToastAndroid.showWithGravity(
`App Update Available and app will be updated automatically`,
ToastAndroid.LONG,
ToastAndroid.CENTER,
);
CodePush.sync(
{ installMode: CodePush.InstallMode.IMMEDIATE },
);
}
});
},[])
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<ContextState>
<NavigationContainer theme={MyTheme}>
<Stack.Navigator screenOptions={{headerShown:false}}>
<Stack.Screen name="InitialRoute" component={InitialScreen} />
<Stack.Screen name="MainRoute" component={RootRoute} />
<Stack.Screen name="MainRouteWithManga" component={RootRouteWithMangaHome} />
<Stack.Screen name="VideoPlayer" component={VideoPlayerScreen} />
</Stack.Navigator>
</NavigationContainer>
</ContextState>
</GestureHandlerRootView>
);
}
export default CodePush(codePushOptions)(App)