Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.