Skip to content

Instantly share code, notes, and snippets.

@aloukissas
Created January 23, 2019 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aloukissas/d1f38263327be7133bc7ed345acbb1ec to your computer and use it in GitHub Desktop.
Save aloukissas/d1f38263327be7133bc7ed345acbb1ec to your computer and use it in GitHub Desktop.
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