React Native Calendar Reminders
React Native Module for IOS Calendar Reminders
Install
npm install --save react-native-calendar-reminders
Link Library
react-native link react-native-calendar-reminders
plist - Usage Description
Setting up privacy usage descriptions may also be require depending on which iOS version is supported. This involves updating the Property List, Info.plist
, with the corresponding key for the EKEventStore api. Info.plist reference.
For updating the Info.plist
key/value via Xcode, add a Privacy - Reminders Usage Description
key with a usage description as the value.
Usage
Require the react-native-calendar-reminders
module.
;
- React-Native 0.40 and above use 1.1.0 and above
- React-Native 0.39 and below use 1.0.0 and below
Properties
Property | Value | Description |
---|---|---|
id | String (read only) | Unique id for the reminder. |
calendarId | String (write only) | Unique id for the calendar where the reminder will be saved. Defaults to the device's default calendar. |
title | String | The title for the reminder. |
startDate | Date | The start date of the reminder. |
dueDate | Date | The date by which the reminder should be completed. |
completionDate | Date (read only) | The date on which the reminder was completed. |
location | String | The location associated with the reminder. |
notes | String | The notes associated with the reminder. |
alarms | Array | The alarms associated with the reminder, as an array of alarm objects. |
recurrence | String | The simple recurrence frequency of the reminder ['daily', 'weekly', 'monthly', 'yearly']. |
recurrenceInterval | String | The interval between instances of this recurrence. For example, a weekly recurrence rule with an interval of 2 occurs every other week. Must be greater than 0. |
isCompleted | Bool | A Boolean value determining whether or not the reminder is marked completed. |
calendar | Object (read-only) | The calendar containing the reminder. |
authorizationStatus
Get authorization status for IOS EventStore.
RNCalendarReminders
Returns: Promise
- fulfilled: String -
denied
,restricted
,authorized
orundetermined
- rejected: Error
Example:
RNCalendarReminders ;
authorizeEventStore
Request authorization to IOS EventStore. Authorization must be granted before accessing calendar events.
RNCalendarReminders
Returns: Promise
- fulfilled: String -
denied
,restricted
,authorized
orundetermined
- rejected: Error
Example:
RNCalendarReminders ;
findReminderById
Find calendar reminder by id. Returns a promise fulfilled with found reminder.
RNCalendarReminders
Parameters:
- id: String - The reminder's unique id.
Returns: Promise
- fulfilled: Object | null - reminder.
- rejected: Error
Example:
RNCalendarReminders ;
fetchAllReminders
Find all reminders.
RNCalendarReminders
Returns: Promise
- fulfilled: Array - List of reminders
- rejected: Error
Example:
RNCalendarReminders ;
fetchCompletedReminders
Finds completed reminders in a set of calendars within an optional range.
RNCalendarReminders
Parameters:
- startDate: Date - The starting bound of the range to search.
- endDate: Date - The ending bound of the range to search.
Returns: Promise
- fulfilled: Array - List of completed reminders from range
- rejected: Error
Example:
RNCalendarReminders ;
fetchIncompleteReminders
Finds incomplete reminders in a set of calendars within an optional range.
RNCalendarReminders
Parameters:
- startDate: Date - The starting bound of the range to search.
- endDate: Date - The ending bound of the range to search.
Returns: Promise
- fulfilled: Array - List of incomplete reminders from range
- rejected: Error
Example:
RNCalendarReminders ;
saveReminder
Creates a new reminder.
RNCalendarReminders.saveReminder(title, settings);
Parameters:
- title: String - The title of the reminder.
- settings: Object - The settings for the reminder. See available properties above.
Returns: Promise
- fulfilled: String - ID of created reminder
- rejected: Error
Example:
RNCalendarReminders ;
Create reminder with alarms
Alarm options:
Property | Value | Description |
---|---|---|
date | Date or Number | If a Date is given, an alarm will be set with an absolute date. If a Number is given, an alarm will be set with a relative offset (in minutes) from the start date. |
structuredLocation | Object | The location to trigger an alarm. |
Alarm structuredLocation properties:
Property | Value | Description |
---|---|---|
title | String | The title of the location. |
proximity | String | A value indicating how a location-based alarm is triggered. Possible values: enter , leave , none . |
radius | Number | A minimum distance from the core location that would trigger the reminder's alarm. |
coords | Object | The geolocation coordinates, as an object with latitude and longitude properties |
Example with date:
RNCalendarReminders;
Example with structuredLocation:
RNCalendarReminders;
Example with recurrence:
RNCalendarReminders;
Example with recurrenceInterval:
RNCalendarReminders;
updateReminder
Updates an existing reminder.
RNCalendarReminders
Parameters:
- id: String - The unique ID of the reminder to edit.
- settings: Object - The settings for the reminder. See available properties above.
Returns: Promise
- fulfilled: String - ID of updated reminder
- rejected: Error
Example:
RNCalendarReminders ;
Or save save the reminder again with id property set in the optional settings.
Example:
RNCalendarReminders ;
addAlarms
Update reminder with alarms. This will overwrite any alarms already set on the reminder.
RNCalendarReminders
Parameters:
- id: String - The unique ID of the reminder to add alarms to.
- alarm: Objec - Alarm to add to reminder. See available alarm properties above.
Returns: Promise
- fulfilled: String - ID of reminder with alarms
- rejected: Error
RNCalendarReminders ;
addAlarm
Update reminder with added alarm
RNCalendarReminders
Parameters:
- id: String - The unique ID of the reminder to add alarms to.
- alarms: Array - List of alarms to add to reminder. See available alarm properties above.
Returns: Promise
- fulfilled: String - ID of reminder with alarms
- rejected: Error
RNCalendarReminders ;
removeReminder
Remove existing reminder
Parameters:
- id: String - The unique ID of the reminder to remove.
Returns: Promise
- fulfilled: Bool - True if successful
- rejected: Error
RNCalendarReminders ;
findCalendars
Finds all the calendars on the device.
RNCalendarReminders;
Returns: Promise
- fulfilled: Array - A list of known calendars on the device
- rejected: Error
Example:
RNCalendarEvents ;