-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
91 lines (85 loc) · 2.99 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
81
82
83
84
85
86
87
88
89
90
91
import "react-native-gesture-handler";
import { AppRegistry, StyleSheet } from "react-native";
import { Provider } from "react-redux";
import store from "./store";
import SplashScreen from "./screens/splash/SplashScreen";
import LoginScreen from "./screens/auth/LoginScreen";
import WelcomeScreen from "./screens/home/WelcomeScreen";
import AlertScreen from "./screens/home/AlertScreen";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import { SafeAreaProvider } from "react-native-safe-area-context";
import * as BackgroundFetch from "expo-background-fetch";
// import backgroundFetchTask from "./backgroundTasks"; // Import background tasks definition
// import { useEffect } from "react";
// import * as Notifications from 'expo-notifications';
import Toast from "react-native-toast-message";
export default function App() {
const Stack = createStackNavigator();
// useEffect(() => {
// registerBackgroundFetchAsync();
// return () => {
// // unregisterBackgroundFetchAsync();
// };
// }, []);
// const registerBackgroundFetchAsync = async () => {
// try {
// await BackgroundFetch.registerTaskAsync(backgroundFetchTask, {
// minimumInterval: 1,
// stopOnTerminate: false,
// startOnBoot: true,
// });
// console.log("Background fetch registered successfully");
// } catch (error) {
// console.error("Error registering background fetch:", error);
// }
// };
// const unregisterBackgroundFetchAsync = async () => {
// try {
// await BackgroundFetch.unregisterTaskAsync(backgroundFetchTask);
// console.log("Background fetch unregistered successfully");
// } catch (error) {
// console.error("Error unregistering background fetch:", error);
// }
// };
return (
<Provider store={store}>
<NavigationContainer>
<SafeAreaProvider>
<Stack.Navigator initialRouteName="SplashScreen">
<Stack.Screen
name="SplashScreen"
component={SplashScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="LoginScreen"
component={LoginScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="WelcomeScreen"
component={WelcomeScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="AlertScreen"
component={AlertScreen}
options={{ headerShown: false }}
/>
</Stack.Navigator>
<Toast />
</SafeAreaProvider>
</NavigationContainer>
</Provider>
);
}
// Notifications.setNotificationHandler({
// handleNotification: async () => ({
// shouldShowAlert: true,
// shouldPlaySound: false,
// shouldSetBadge: false,
// }),
// });
const styles = StyleSheet.create({});
AppRegistry.registerComponent("MyApp", () => App);