Harish_Madugula
Harish_Madugula

Reputation: 337

Expo calendar Alarm usage

I’m trying to figure out how to use the alarms provided with the Expo Calendar.

Can anyone help me out with this?

Here's the alarm provided by Expo Calendar Expo Alarm

The events are being created fine but I want an alarm to trigger at a given time.

Is this possible?

Here's a reproducible Expo snack Expo Calendar Snack

thanks in advance

Upvotes: 1

Views: 2705

Answers (1)

Alex Wolski
Alex Wolski

Reputation: 177

The 'alarms' property is an array of Alarm objects This object is defined in Calendar.js:

type Alarm = {
    absoluteDate?: string, //iOS
    relativeOffset?: string,
    structuredLocation?: {
        //iOS
        title?: string,
        proximity?: string, // Proximity
        radius?: number,
        coords?: {
        latitude?: number,
        longitude?: number,
        },
    },
    method?: string, //Method, Android
};

So if you want to set the alarm on a specific date, you could do:

alarms: [ { absoluteDate: "2019-05-05T12:00:00:000Z" } ]

Or if you wanted it to be 15 minutes before:

alarms: [ { relativeOffset: -15 } ]

Upvotes: 2

Related Questions