首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >重复本地通知在react-native-push-notification中不起作用

重复本地通知在react-native-push-notification中不起作用
EN

Stack Overflow用户
提问于 2019-04-03 21:13:59
回答 1查看 942关注 0票数 1

我使用react-native-push-notification在我的react-native应用程序中显示本地通知。我想每周上午10点重复通知。我写了以下代码:

代码语言:javascript
复制
import PushNotification from 'react-native-push-notification';
import PushController from './Components/PushController';


export default class App extends Component {
  constructor(props) {
    super(props); 
    this.notify.bind(this);
  }

  notify = () => {
    PushNotification.localNotificationSchedule({
       message: 'You pushed a notification',
       repeatType: 'week',
       date: // what should I write here ...??? 
    });
  }

}

如何显示每周的通知。提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2020-02-27 20:40:18

只需在瞬间传递您选择的日期,如下所示

代码语言:javascript
复制
 notify = () => {
    PushNotification.localNotificationSchedule({
        message: 'You pushed a notification',
        repeatType: 'week',
        date: new Date(selected date and time)//Thu Feb 27 2020 18:22:00 GMT+0530 (India Standard Time)
   });
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55496102

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档