forked from wmcmahan/react-native-calendar-events
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.android.js
51 lines (38 loc) · 1.17 KB
/
index.android.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict'
import { NativeModules, processColor } from 'react-native'
var CalendarEvents = NativeModules.CalendarEvents
export default {
async authorizationStatus () {
return CalendarEvents.getCalendarPermissions()
},
async authorizeEventStore () {
return CalendarEvents.requestCalendarPermissions()
},
async fetchAllEvents (startDate, endDate, calendars = []) {
return CalendarEvents.findAllEvents(startDate, endDate, calendars)
},
async findCalendars () {
return CalendarEvents.findCalendars()
},
async saveCalendar (options = {}) {
return CalendarEvents.saveCalendar({
...options,
color: options.color ? processColor(options.color) : undefined,
});
},
async findEventById (id) {
return CalendarEvents.findById(id)
},
async saveEvent (title, details, options = {sync: false}) {
return CalendarEvents.saveEvent(title, details, options)
},
async removeEvent (id, options = {sync: false}) {
return CalendarEvents.removeEvent(id, options)
},
async uriForCalendar () {
return CalendarEvents.uriForCalendar()
},
openEventInCalendar (eventID) {
CalendarEvents.openEventInCalendar(eventID)
}
}