Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 3113a3f

Browse files
committed
Changes in example Application.
1 parent 9c26a7b commit 3113a3f

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ PushNotification.configure({
212212
console.log("TOKEN:", token);
213213
},
214214

215-
// (required) Called when a remote is received in foreground or opened, or local notification is opened
215+
// (required) Called when a remote is received or opened, or local notification is opened
216216
onNotification: function (notification) {
217217
console.log("NOTIFICATION:", notification);
218218

example/App.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,10 @@ export default class App extends Component {
120120
}
121121

122122
onRegister(token) {
123-
//Alert.alert('Registered !', JSON.stringify(token));
124-
console.log(token);
125123
this.setState({registerToken: token.token, fcmRegistered: true});
126124
}
127125

128126
onNotif(notif) {
129-
console.log('onNotification', notif);
130127
Alert.alert(notif.title, notif.message);
131128
}
132129

example/NotifService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default class NotifService {
55
constructor(onRegister, onNotification) {
66
this.lastId = 0;
77

8-
NotificationHandler.onRegister(onRegister);
8+
NotificationHandler.attachRegister(onRegister);
99
NotificationHandler.attachNotification(onNotification);
1010

1111
// Clear badge number at start

example/NotificationHandler.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import PushNotification from 'react-native-push-notification';
22

33
class NotificationHandler {
44
onNotification(notification) {
5-
console.log(notification);
5+
console.log('NotificationHandler:', notification);
66

77
if (typeof this._onNotification === 'function') {
88
this._onNotification(notification);
99
}
1010
}
1111

1212
onRegister(token) {
13-
console.log(token);
13+
console.log('NotificationHandler:', token);
1414

1515
if (typeof this._onRegister === 'function') {
1616
this._onRegister(token);
@@ -30,10 +30,10 @@ const handler = new NotificationHandler();
3030

3131
PushNotification.configure({
3232
// (optional) Called when Token is generated (iOS and Android)
33-
onRegister: handler.onRegister.bind(handler), //this._onRegister.bind(this),
33+
onRegister: handler.onRegister.bind(handler),
3434

3535
// (required) Called when a remote or local notification is opened or received
36-
onNotification: handler.onNotification.bind(handler), //this._onNotification,
36+
onNotification: handler.onNotification.bind(handler),
3737

3838
// IOS ONLY (optional): default: all - Permissions to register.
3939
permissions: {

0 commit comments

Comments
 (0)