Bog*_*riu 2 notifications local react-native expo
我很难弄清楚最新版本的博览会如何在一天中的特定时间设置本地通知并使其每天重复。
"expo": "~40.0.0",
"expo-notifications": "~0.8.2",
Run Code Online (Sandbox Code Playgroud)
"expo": "~40.0.0",
"expo-notifications": "~0.8.2",
Run Code Online (Sandbox Code Playgroud)
function startsTomorowButNotAbleToRepeateEvryDay() {
let tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(20);
tomorrow.setMinutes(0);
return {
content: {
title: "Time to study v2",
body: "Don't forget to study today!",
},
trigger: tomorrow,
};
}
function repeatsEvryDayButNotPossibleToSetTime() {
const seccondsInADay = 24 * 60 * 60;
return {
content: {
title: "Time to study v2",
body: "Don't forget to study today!",
},
trigger: {
seconds: seccondsInADay,
repeats: true,
},
};
}
Run Code Online (Sandbox Code Playgroud)
如何使通知在明天的特定时间开始并每天重复?
小智 5
来自Notifications.types.d.ts
export interface DailyTriggerInput {
channelId?: string;
hour: number;
minute: number;
repeats: true;
}
Run Code Online (Sandbox Code Playgroud)
您可以使用:
trigger: {
hour: 19;
minute: 45;
repeats: true;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3663 次 |
| 最近记录: |