Skip to content

Event alarms

Will McMahan edited this page Mar 22, 2018 · 1 revision

Basic

Adding an alarm creates an alert for an upcoming event. This can be accomplished by adding the alarms property and assigning a time prior to the event.

RNCalendarEvents.saveEvent('Title of event', {
  startDate: '2016-08-19T19:26:00.000Z',
  endDate: '2017-08-19T19:26:00.000Z',
  alarms: [{
    date: '2016-08-19T19:21:00.000Z'
  }]
})

Geofencing (iOS only)

This allows for setting alarms based on entering or leaving a geographic location. While this is more appropriate for reminders, it still finds its uses - and cool.

  • title - The title of the location.
  • proximity - A value indicating how a location-based alarm is triggered. Possible values: enter, leave, none.
  • radius - A minimum distance from the core location that would trigger the calendar event's alarm.
  • coords - The geolocation coordinates, as an object with latitude and longitude properties
RNCalendarEvents.saveEvent('Title of event', {
  startDate: '2016-08-19T19:26:00.000Z',
  endDate: '2017-08-19T19:26:00.000Z',
  alarms: [{
    structuredLocation: {
      title: 'Title',
      proximity: 'enter',
      radius: 500,
      coords: {
        latitude: 30.0000,
        longitude: 97.0000
      }
    }
  }]
})
Clone this wiki locally