This package has been deprecated in favor to useCalendar Hook
This package will help you to ask permissions to access to calendar and reminders, create new calendar, add events to calendar and delete that one by calendarId.
$ npm install expo-calendar-helper
or
$ yarn add expo-calendar-helper
import { askPermissionsAsync, newCalendar } from 'expo-calendar-helper';
createCalendar = async () => {
const status = await askPermissionsAsync();
if (status) {
newCalendar('MAZINGER Z','lightgreen', 'mazingerSecureStore');
} else {
alert(
'The app need permissions to access to calendar.'
);
}
};
return granted string if you gave permissions to access calendar, return null if you not.
- calendarTitle: Calendar title
- calendarColor: Calendar color
- nameCalendarStore: name to save in the mobile using SecureStore inside "nameCalendarStore" is stored the calendarId, you can get it using SecureStore.getItemAsync()
import { addEventsToCalendar } from 'expo-calendar-helper';
addEvent = (nameCalendarStore, eventTitle, startDate, endDate) => {
try {
addEventsToCalendar(nameCalendarStore, eventTitle, startDate, endDate);
} catch (e) {
console.log(e.message);
}
};
this receive four parameters:
- nameCalendarStore: name to load the calendarId from the mobile using SecureStore saved in the mobile created using newCalendar()
- eventTitle: event title
- eventStartDate: event start date
- eventEndDate: event end date
import { deleteCalendarId } from 'expo-calendar-helper';
deleteCalendarId(nameCalendarStore);
this receive one parameter:
- nameCalendarStore: name to load the calendarId from the mobile using SecureStore saved in the mobile created using newCalendar()
for helping me create a new calendar on iOS.
for sharing how to create an event on iOS.
for develop a great framework to work with react native.
This project is licensed under MIT license.