Skip to content

archriss/react-native-calendarevents-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-calendarevents-android

Add events to user's calendar on Android.

Getting started

Manual install

  1. npm install react-native-calendarevents-android --save
  2. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add com.exilz.calendarevents.CalendarEventsPackage; to the imports at the top of the file
  • Add new CalendarEventsPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-calendarevents-android'
    project(':react-native-calendarevents-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-calendarevents-android')
  1. Insert the following lines inside the dependencies block in android/app/build.gradle:
    compile project(':react-native-calendarevents-android')
  1. Add permissions in your AndroidManifest.xml
    <uses-permission android:name="android.permission.READ_CALENDAR" />
    <uses-permission android:name="android.permission.WRITE_CALENDAR" />

Usage

Example

import AndroidCalendarEvents from 'react-native-calendarevents-android';

AndroidCalendarEvents.addEvent(
    {
        title: 'Event title',
        startDate: Date.now(),
        endDate: Date.now() + 3600 * 1000,
        description: 'Event description',
        location: 'Paris, France'
    },
    (success) => console.log(success),
    (error) => console.log(error)
);

Methods

addEvent(options)

Open calendar event dialog

Supported options:

Name Type Description
title string Event title (required)
startDate number Start date in milliseconds from epoch (required)
endDate number End date in milliseconds from epoch (optional)
description string Description to be pre-filled (optional)
location string Location to be pre-filled and looked for by Google (optional)

Android calendar react native events

About

Add events to Android's calendar with React Native

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published