-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
76 lines (65 loc) · 2.2 KB
/
Copy pathindex.js
File metadata and controls
76 lines (65 loc) · 2.2 KB
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
// index.js
import { AppRegistry } from 'react-native';
import App from './App.tsx';
import { name as appName } from './app.json';
import { AuthProvider } from './src/AuthContext';
//import messaging from '@react-native-firebase/messaging';
//import notifee, { AndroidImportance } from '@notifee/react-native';
import { Buffer } from 'buffer';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import 'fast-text-encoding';
// 중복 폴리필 방지
// @ts-ignore
if (typeof global.Buffer === 'undefined') {
// @ts-ignore
global.Buffer = Buffer;
}
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: 1,
gcTime: 5 * 60 * 1000,
},
},
});
const Root = () => (
<QueryClientProvider client={queryClient}>
{/* <AuthProvider> */}
<App />
{/* </AuthProvider> */}
</QueryClientProvider>
);
// const Root = () => <App />;
// messaging().onNotificationOpenedApp(remoteMessage => {
// const route = remoteMessage?.data?.route;
// const id = remoteMessage?.data?.id;
// // 앱이 포그라운드로 올라왔을 때 네이게이트 (navigationRef는 App가 떠야 준비됨)
// setTimeout(() => navigateFromOutside(route, id ? { id } : undefined), 0);
// });
// // 2) 앱이 완전 종료 상태에서 탭 → getInitialNotification
// messaging()
// .getInitialNotification()
// .then(remoteMessage => {
// if (remoteMessage) {
// const route = remoteMessage?.data?.route;
// const id = remoteMessage?.data?.id;
// setTimeout(() => navigateFromOutside(route, id ? { id } : undefined), 0);
// }
// });
// messaging().setBackgroundMessageHandler(async remoteMessage => {
// // 채널이 없다면 만들어두기 (안전)
// await notifee.createChannel({
// id: 'default',
// name: 'General',
// importance: AndroidImportance.HIGH,
// sound: 'default',
// });
// const { title, body } = remoteMessage.notification ?? {};
// await notifee.displayNotification({
// title: title ?? '알림',
// body: body ?? '',
// android: { channelId: 'default', pressAction: { id: 'default' } },
// data: remoteMessage.data,
// });
// });
AppRegistry.registerComponent(appName, () => Root);