Created
January 23, 2019 07:21
-
-
Save aloukissas/d1f38263327be7133bc7ed345acbb1ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends React.Component { | |
state = { | |
notification: "" | |
}; | |
registerForPushNotificationsAsync = async () => { | |
// Same as earlier | |
} | |
handleNotification = notification => { | |
this.setState({ notification }); | |
} | |
componentDidMount() { | |
this.registerForPushNotificationsAsync(); | |
this.notificationSubscription = Notifications.addListener(this.handleNotification); | |
} | |
render() { | |
// Display the notification in the view | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment