From 51ea457d2773ac188a0e77f06aa82bf785ae2ccd Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Mon, 12 Feb 2018 16:31:33 -0500 Subject: [PATCH] add dismiss button --- Examples/simple-fcm-client/app/App.js | 2 +- Examples/simple-fcm-client/app/Listeners.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Examples/simple-fcm-client/app/App.js b/Examples/simple-fcm-client/app/App.js index 3fcac7a..058fcbf 100644 --- a/Examples/simple-fcm-client/app/App.js +++ b/Examples/simple-fcm-client/app/App.js @@ -183,7 +183,7 @@ export default class App extends Component { this.showLocalNotificationWithAction(token)} style={styles.button}> - Show Local Notification with Action + Show Local Notification with Action (iOS) this.scheduleLocalNotification()} style={styles.button}> diff --git a/Examples/simple-fcm-client/app/Listeners.js b/Examples/simple-fcm-client/app/Listeners.js index 866a5bf..25acd5c 100644 --- a/Examples/simple-fcm-client/app/Listeners.js +++ b/Examples/simple-fcm-client/app/Listeners.js @@ -26,6 +26,9 @@ export function registerAppListener(){ if(notif._actionIdentifier === 'com.myidentifi.fcm.text.reply'){ alert("User replied: "+notif._userText); } + if(notif._actionIdentifier === 'com.myidentifi.fcm.text.dismiss'){ + alert("User clicked Dismiss"); + } } if(Platform.OS ==='ios'){ @@ -74,6 +77,12 @@ FCM.setNotificationCategories([ textInputPlaceholder: 'Say something', intentIdentifiers: [], options: NotificationActionOption.AuthenticationRequired + }, + { + type: NotificationActionType.Default, + id: 'com.myidentifi.fcm.text.dismiss', + title: 'Dismiss', + intentIdentifiers: [] } ], options: [NotificationCategoryOption.CustomDismissAction, NotificationCategoryOption.PreviewsShowTitle] -- 2.26.2