jpush / jpush/jpush-react-native
clearNotificationById报错Value for nitificationId cannot be cast from String to Double
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 348
- PR merge metrics
- No merged PRs in 30d
Description
你的运行环境
- 插件版本:
"jcore-react-native": "^2.1.9",
"jpush-react-native": "^3.0.9", - react-native 版本:
"react": "18.2.0",
"react-native": "0.72.4",
期望效果
处理消息完毕之后,把通知栏目对应的消息去掉
实际效果
报错:Value for nitificationId cannot be cast from String to Double
消息过来
重现步骤
监听了addNotificationListener方法
this.notificationListener = result => {
console.log('notificationListener:' + JSON.stringify(result));
console.log('notificationListener:', result);
if (
result &&
result.extras &&
result.notificationEventType === 'notificationArrived'
) {
let extras = result.extras;
switch (extras.type) {
case 'sensitive':
console.log('授权通知', extras);
this.setState(
{
authInfo: {
...extras,
isVisible_out: true,
},
},
() => {
// JPush.clearAllNotifications();
console.log('JPush.clearNotificationById', result.messageID);
//报错:Value for nitificationId cannot be cast from String to Double
JPush.clearNotificationById({notificationId: result.messageID});
},
);
break;
default:
break;
}
}
};
JPush.addNotificationListener(this.notificationListener);
Debug logs
包括 Android 或 iOS 的日志:
//报错:Value for nitificationId cannot be cast from String to Double
JPush.clearNotificationById({notificationId: result.messageID});
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the clearNotificationById API and the Android/React Native bridge handling notificationId, then reproduce the error using React Native 0.72.4 and jpush-react-native 3.0.9 with result.messageID. Done means clearing a notification with the listener's messageID no longer raises the String-to-Double cast error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- api, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100