This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
50 lines (43 loc) · 1.57 KB
/
index.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
/* eslint-disable no-console */
import AsyncStorage from "@react-native-async-storage/async-storage"
import { registerRootComponent } from 'expo';
import { DevMenu, isDevelopmentBuild } from "expo-dev-client";
import { setNotificationHandler } from "expo-notifications";
import { preventAutoHideAsync } from "expo-splash-screen";
import { LogBox } from "react-native";
import App from './App';
preventAutoHideAsync().catch(console.error);
LogBox.ignoreLogs(["'SplashScreen.show' has already been called for given view controller."]);
LogBox.ignoreLogs(["Constants.platform.ios.model has been deprecated in favor of expo-device's Device.modelName property. This API will be removed in SDK 45."]);
if (isDevelopmentBuild()) {
DevMenu.registerDevMenuItems([
{
name: "Clear AsyncStorage",
action: async () => {
await AsyncStorage.clear().catch(console.error);
alert("AsyncStorage cleared successfully");
}
},
{
name: "Print AsyncStorage",
action: async () => {
const keys = await AsyncStorage.getAllKeys().catch(console.error);
const values = await AsyncStorage.multiGet(keys).catch(console.error);
if (console.table) {
console.table(values);
} else {
console.log(values);
}
}
}
]);
}
// Configure the notifications handler to decide what to do when a notification is received if the app is open
setNotificationHandler({
handleNotification: () => ({
shouldShowAlert: true,
shouldPlaySound: false,
shouldSetBadge: false,
}),
});
registerRootComponent(App);