upd: push notification on background

Deskripsi:
- on klik pada background notification
- hide and show notificationn foreground

No Issues
This commit is contained in:
2025-08-07 16:25:45 +08:00
parent 9cb848ddd2
commit 7555ece0fa
6 changed files with 49 additions and 35 deletions

16
index.js Normal file
View File

@@ -0,0 +1,16 @@
// 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 }));
}
});