React native 世博会本地通知如何设置每天开始和重复的时间?

React native 世博会本地通知如何设置每天开始和重复的时间?,react-native,notifications,expo,local,React Native,Notifications,Expo,Local,我很难弄清楚世博会的最新版本,如何在一天中的特定时间设置本地通知,并使其每天重复 package.json中的相关部分 我可以使用此SIPET创建通知 函数启动至Row,但不可删除至RepeateeVryDay(){ 让明天=新的日期(); 明天.setDate(明天.getDate()+1); 明日,设定时间(20); 明天。设定分钟(0); 返回{ 内容:{ 标题:“学习v2的时间”, 身体:“今天别忘了学习!”, }, 触发器:明天, }; } 函数RepeatSevryday但不

我很难弄清楚世博会的最新版本,如何在一天中的特定时间设置本地通知,并使其每天重复

  • package.json中的相关部分
  • 我可以使用此SIPET创建通知
函数启动至Row,但不可删除至RepeateeVryDay(){
让明天=新的日期();
明天.setDate(明天.getDate()+1);
明日,设定时间(20);
明天。设定分钟(0);
返回{
内容:{
标题:“学习v2的时间”,
身体:“今天别忘了学习!”,
},
触发器:明天,
};
}
函数RepeatSevryday但不可能为SetTime(){
const secondsinaday=24*60*60;
返回{
内容:{
标题:“学习v2的时间”,
身体:“今天别忘了学习!”,
},
触发:{
秒:秒,
重复:是的,
},
};
}
  • 这是如何使用上或其他
Notifications.scheduleNotificationAsync(StartStoRowButNotableToRepeateeVryDay());
Notifications.scheduleNotificationAsync(RepeatSevrydayButNotableToSetTime());

如何使通知在明天某个特定时间开始并每天重复?

来自Notifications.types.d.ts

export interface DailyTriggerInput {
    channelId?: string;
    hour: number;
    minute: number;
    repeats: true;
}
您可以使用:

trigger: {
    hour: 19;
    minute: 45;
    repeats: true;
}
尝试如下:

const schedule = new Date();  
    
   schedule.setHours(19);
   schedule.setMinutes(45);

   Notifications.scheduleNotificationAsync({
     content: {
     title: "title txt",
     body: 'body text',
     },
     trigger:{
       schedule,
       repeats: true,
     });
const schedule = new Date();  
    
   schedule.setHours(19);
   schedule.setMinutes(45);

   Notifications.scheduleNotificationAsync({
     content: {
     title: "title txt",
     body: 'body text',
     },
     trigger:{
       schedule,
       repeats: true,
     });