简体   繁体   中英

react native firebase handle click action on push notification

I'm working on my react native application and i'm sending push notifications using firebase :

in my component i imported librairies :

import firebase from '@react-native-firebase/app'
import messaging from '@react-native-firebase/messaging'

I add native configuration to receive notification in foreground and background mode for IOS and Android.

Now i want to add a click action to redirect to specific component .

I use Postman to send POST request with custom data :

    {
 "to" : "ceWTvUKphPk:APA91bG6CMyiHZfNnpIs76QyThECegzztWe5hjp05jrKU8ImyWwarprqRYFlY3Hry_Xbv0EV0W76PEgHf7ssMzJbaTOzGvmoZthZnWOm9ZGcpwtZ0ubcHY-ps-9yl-sdM-aGrh1bGbrn",
 "notification" : {
 "body" : "un nouveau partage",
 "title" : "un partage de contact reçu",
 "priority" : "high",
 "vibration":true,
 "sound": "Enabled",
 "badge":1,
 "requireInteraction": true,
 "click_action": "ACTION",
 },
 "data" : {
 "body" : "nouvelle opportunité",
 "title" : "un nouveau partage"
 "content_available" : true,
 "priority" : "high",
 } 
}

How can i create a click action and handle this action for both IOS and Android

I think react native firebase cloud messaging don't support click action and we have to wait until the next update.

For more informations you can read this documentation :

react native notifee documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM