我正在使用react-native-push-notification庫推送通知到android。 我從GCM服務器獲取通知。 我得到了函數'onNotification'的作品,當我安慰它時,我在控制檯中看到消息通知。 如何呈現通知並向用戶顯示每個通知(包括按鈕)?我試圖通過狀態或調用函數保存已收到的通知,但它不起作用,似乎不知道外部函數。反應原生渲染推送通知android
這裏是代碼 -
componentDidMount(){
PushNotification.configure({
onNotification: function(notification) {
console.log('NOTIFICATION:', notification);
},
senderID: "********",
popInitialNotification: true,
});
}
render() {
return(
<View>
<Text>Notification</Text>
</View>
);
}
}
的感謝!