How to use the expo-notifications.cancelScheduledNotificationAsync function in expo-notifications

To help you get started, we’ve selected a few expo-notifications examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo / apps / notification-test-app / example / src / MainButtonGroup.tsx View on Github external
async function () {
                    let interval = 10 * 1000;
                    let id = await Notifications.scheduleNotificationWithTimerAsync(
                        createNotification(this.title),
                        {
                            interval,
                            repeat: false,
                        }
                    );
                    Notifications.cancelScheduledNotificationAsync(id);
                }
            ,
github expo / expo / apps / native-component-list / src / screens / NotificationScreen.tsx View on Github external
_scheduleLocalNotificationAndCancelAsync = async () => {
    await this._obtainUserFacingNotifPermissionsAsync();
    const notificationId = await Notifications.scheduleLocalNotificationAsync(
      {
        title: 'This notification should not appear',
        body: 'It should have been cancelled. :(',
        ios: {
          sound: true,
        },
      },
      {
        time: new Date().getTime() + 10000,
      }
    );
    await Notifications.cancelScheduledNotificationAsync(notificationId);
  }