upd
: notifikasi in app Deskripsi: - package baru - menampilkan notifikasi saat sedang membuka app NoIssues
This commit is contained in:
@@ -9,17 +9,26 @@ import HeaderRightProjectList from "@/components/project/headerProjectList";
|
||||
import { Headers } from "@/constants/Headers";
|
||||
import store from "@/lib/store";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import messaging from "@react-native-firebase/messaging";
|
||||
import { Redirect, router, Stack } from "expo-router";
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { useEffect } from "react";
|
||||
import { Alert, Text } from "react-native";
|
||||
import { Text } from "react-native";
|
||||
import { Easing, Notifier } from 'react-native-notifier';
|
||||
import { Provider } from "react-redux";
|
||||
import messaging from "@react-native-firebase/messaging";
|
||||
|
||||
export default function RootLayout() {
|
||||
useEffect(() => {
|
||||
const unsubscribe = messaging().onMessage(async remoteMessage => {
|
||||
Alert.alert('A new FCM message arrived!', JSON.stringify(remoteMessage));
|
||||
Notifier.showNotification({
|
||||
title: remoteMessage.notification?.title,
|
||||
description: remoteMessage.notification?.body,
|
||||
duration: 5000,
|
||||
animationDuration: 500,
|
||||
showEasing: Easing.ease,
|
||||
onPress: () => router.push('/notification'),
|
||||
hideOnPress: false,
|
||||
});
|
||||
});
|
||||
|
||||
return unsubscribe;
|
||||
|
||||
Reference in New Issue
Block a user