upd: push notification on background
Deskripsi: - on klik pada background notification - hide and show notificationn foreground No Issues
This commit is contained in:
16
index.js
Normal file
16
index.js
Normal 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 }));
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user