Files
mobile-darmasaba/index.js
amaliadwiy 7555ece0fa upd: push notification on background
Deskripsi:
- on klik pada background notification
- hide and show notificationn foreground

No Issues
2025-08-07 16:25:45 +08:00

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 }));
}
});