20 lines
730 B
JavaScript
20 lines
730 B
JavaScript
// index.js
|
|
import 'expo-router/entry'; // ⬅️ wajib ada agar expo-router tetap bekerja
|
|
|
|
import { getApp } from '@react-native-firebase/app';
|
|
import { getMessaging, setBackgroundMessageHandler } from '@react-native-firebase/messaging';
|
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
|
|
// ✅ Ambil instance messaging modular
|
|
const mess = getMessaging(getApp());
|
|
|
|
// ✅ Firebase background handler — wajib diletakkan DI SINI
|
|
setBackgroundMessageHandler(mess, async remoteMessage => {
|
|
const screen = remoteMessage?.data?.category;
|
|
const content = remoteMessage?.data?.content;
|
|
|
|
if (screen && content) {
|
|
await AsyncStorage.setItem('navigateOnOpen', JSON.stringify({ screen, content }));
|
|
}
|
|
});
|