From add9aade01840846c4ffcf188d6be491cf88d2fe Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Tue, 27 Feb 2018 16:22:46 -0500 Subject: [PATCH] add remote notif nav example --- Examples/simple-fcm-client/app/App.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Examples/simple-fcm-client/app/App.js b/Examples/simple-fcm-client/app/App.js index 7e6f5b8..d8cb98a 100644 --- a/Examples/simple-fcm-client/app/App.js +++ b/Examples/simple-fcm-client/app/App.js @@ -39,6 +39,11 @@ class MainPage extends Component { this.setState({ initNotif: notif }) + if(notif.targetScreen === 'detail'){ + setTimeout(()=>{ + this.props.navigation.navigate('Detail') + }, 500) + } }); try{ @@ -102,10 +107,11 @@ class MainPage extends Component { "data":{ "custom_notification": { "title": "Simple FCM Client", - "body": "This is a notification with only NOTIFICATION.", + "body": "Click me to go to detail", "sound": "default", "priority": "high", - "show_in_foreground": true + "show_in_foreground": true, + targetScreen: 'detail' } }, "priority": 10 @@ -115,9 +121,12 @@ class MainPage extends Component { "to": token, "notification":{ "title": "Simple FCM Client", - "body": "This is a notification with only NOTIFICATION.", + "body": "Click me to go to detail", "sound": "default" - }, + }, + data: { + targetScreen: 'detail' + }, "priority": 10 } } -- 2.26.2