Reputation: 113
I am trying to use Expo.Notifictions.addListener in my component (on iOS standalone build), but it doesn't fire although notifications are successfully received.
addListener() is placed inside componentDidMount()
function.
Expo.Notifications.addListener(this.handleNotification);
handleNotification = () => {
this.setState({
something: 3,
});
};
Upvotes: 2
Views: 3839
Reputation: 2128
You are not adding callback into ur addListener function.
componentDidMount(){
Notifications.addListener(notification => {
console.log(notification);
});
}
Upvotes: 2