Deskripsi: - on klik pada background notification - hide and show notificationn foreground No Issues
17 lines
570 B
JavaScript
17 lines
570 B
JavaScript
// index.js
|
|
import 'expo-router/entry'; // ⬅️ wajib ada agar expo-router tetap bekerja
|
|
|
|
import messaging from '@react-native-firebase/messaging';
|
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
|
|
// ✅ Firebase background handler — wajib diletakkan DI SINI
|
|
messaging().setBackgroundMessageHandler(async remoteMessage => {
|
|
|
|
const screen = remoteMessage?.data?.category;
|
|
const content = remoteMessage?.data?.content;
|
|
|
|
if (screen && content) {
|
|
await AsyncStorage.setItem('navigateOnOpen', JSON.stringify({ screen, content }));
|
|
}
|
|
});
|