我尝试在我的组件中使用 Expo.Notifictions.addListener(在 iOS 独立版本上),但尽管成功接收到通知,但它不会触发。
addListener() 被放置在 componentDidMount()
函数中。
Expo.Notifications.addListener(this.handleNotification);
handleNotification = () => {
this.setState({
something: 3,
});
};
最佳答案
您没有将回调添加到您的 addListener 函数中。
componentDidMount(){
Notifications.addListener(notification => {
console.log(notification);
});
}
关于ios - Expo.Notifications.addListener() 未触发(iOS 独立应用程序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54360699/