我正在构建一个提醒应用程序。我想在用户添加时间时安排本地通知。我正在使用 react-native-push-notification 包。它与本地通知一起工作得很好,但是当我想安排本地通知时,它不起作用。这是我安排本地通知的方法。
const localNotification = () => {
PushNotification.localNotificationSchedule({
channelId: "test-channel",
date: new Date(Date.now() + 10 * 1000),
autoCancel: true,
bigText:
'This is local schedule notification demo in React Native app. Only shown, when expanded.',
subText: 'Local Notification Demo',
title: 'Local Notification Title',
message: 'Expand me to see more',
// vibrate: true,
// vibration: 300,
// playSound: true,
// soundName: 'default',
actions: '["Yes", "No"]',
allowWhileIdle: true
})
console.log(new Date(Date.now() + 20 * 1000))
}
这是我的推送通知导入。
import PushNotification from 'react-native-push-notification'
请告诉我我做错了什么。并告诉我它的日期格式。我会很感激的。