當我點擊取消按鈕,它顯示「未定義不是一個對象」。代碼如下所示。反應本地AlertIOS回調
更新:
componentWillMount() {
PushNotificationIOS.addEventListener('notification', this._onRemoteNotification);
}
_onRemoteNotification(notification) {
AlertIOS.alert(
'Push Notification Received',
'Alert message: ' + notification.getMessage(),
[{
text: 'OK',
onPress: null,
},
{
text: 'Cancel',
onPress:()=>this.setState({key: value}),
},
]
);
}
}
你能告訴你如何調用這個警報在您的組件? – rclai
已更新。請檢查 – bns