npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rn-calendar-event

v1.0.0

Published

readonly android calendar and events apiicalendar apicalendar api

Downloads

0

Readme

rn-calendar-event

A React Native Turbo Module for accessing Android Calendar Provider calendars and events.

Android only.

Features

  • Request calendar permissions
  • Get all calendars
  • Get a calendar by ID
  • Get all events
  • Get events within a date range
  • Filter events by calendar IDs
  • Get an event by ID

Installation

npm install rn-calendar-event

Usage

import * as NativeCalendarEvent from 'rn-calendar-event';

Request Permission

Before accessing calendars or events, request the required Android calendar permissions:

const granted = await NativeCalendarEvent.requestCalendarPermission();

console.log('Permission granted:', granted);

Get All Calendars

const calendars = await NativeCalendarEvent.getAllCalendars();

console.log(calendars);

Get Calendar by ID

const calendar = await NativeCalendarEvent.getCalendarById('1');

if (calendar) {
  console.log(calendar.title);
}

Returns null when the calendar cannot be found.

Get All Events

const events = await NativeCalendarEvent.getAllEvents();

console.log(events);

Get Events by Date Range

startDate and endDate must be ISO 8601 date strings.

const events = await NativeCalendarEvent.getAllEventsByRange(
  '2026-08-01T00:00:00.000Z',
  '2026-08-31T23:59:59.999Z',
  ['1', '2'],
);

console.log(events);

Pass an empty array to query events from all calendars:

const events = await NativeCalendarEvent.getAllEventsByRange(
  '2026-08-01T00:00:00.000Z',
  '2026-08-31T23:59:59.999Z',
  [],
);

Get Event by ID

const event = await NativeCalendarEvent.getEventById('123');

if (event) {
  console.log(event.title);
}

Returns null when the event cannot be found.

API

requestPermission()

requestPermission(): Promise<boolean>;

Requests the Android calendar permissions required by the library.

getAllCalendars()

getAllCalendars(): Promise<Calendar[]>;

Returns all calendars available through the Android Calendar Provider.

getCalendarById()

getCalendarById(calendarId: string): Promise<Calendar | null>;

Returns a calendar by its ID.

getAllEvents()

getAllEvents(): Promise<Event[]>;

Returns all events available through the Android Calendar Provider.

getAllEventsByRange()

getAllEventsByRange(
  startDate: string,
  endDate: string,
  calendarIds: Array<string>,
): Promise<Event[]>;

Returns events within the specified date range.

  • startDate — UTC ISO 8601 start date
  • endDate — UTC ISO 8601 end date
  • calendarIds — calendar IDs to query; use [] for all calendars

Example:

const events = await NativeCalendarEvent.getAllEventsByRange(
  new Date('2026-08-01T00:00:00.000Z').toISOString(),
  new Date('2026-08-31T23:59:59.999Z').toISOString(),
  ['1', '2'],
);

getEventById()

getEventById(eventId: string): Promise<Event | null>;

Returns an event by its ID.

Types

Calendar

export interface Calendar {
  /** Unique calendar ID. */
  id: string;

  /** The calendar's title. */
  title: string;

  /** The calendar's type. */
  type: string;

  /** The source object representing the account to which this calendar belongs. */
  source: string;

  /** Indicates if the calendar is assigned as primary. */
  isPrimary: boolean;

  /** Indicates if the calendar allows events to be written, edited or removed. */
  allowsModifications: boolean;

  /** The color assigned to the calendar represented as a hex value. */
  color: string;

  /** The event availability settings supported by the calendar. */
  allowedAvailabilities: string[];
}

Event

export interface Event {
  id: string;

  /** The title for the calendar event. */
  title: string;

  /** The start date of the calendar event in ISO format. */
  startDate: string;

  /** The end date of the calendar event in ISO format. */
  endDate?: string;

  /** The ID of the calendar where the event belongs. */
  calendarId?: string;

  /** Indicates whether the event is an all-day event. */
  allDay?: boolean;

  /** The location associated with the calendar event. */
  location?: string;

  /** The simple recurrence frequency of the calendar event. */
  recurrence?: string;

  /** The event description. */
  description?: string;

  /** The availability of the event. */
  availability?: string;

  /** The original event ID. */
  originalId?: string;

  /** The synchronization ID. */
  syncId?: string;
}

Permissions

The library uses Android's Calendar Provider and requires calendar permissions.

Add the required permissions to AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />

Request permission before querying calendar data:

import * as NativeCalendarEvent from 'rn-calendar-event';

const granted = await NativeCalendarEvent.requestPermission();

if (!granted) {
  console.log('Calendar permission was not granted');
  return;
}

const calendars = await NativeCalendarEvent.getAllCalendars();
const events = await NativeCalendarEvent.getAllEvents();

Example

A simple calendar viewer:

import React, { useState } from 'react';
import { Button, Text, View } from 'react-native';
import * as NativeCalendarEvent from 'rn-calendar-event';

export default function App() {
  const [message, setMessage] = useState('');

  const loadCalendars = async () => {
    try {
      const granted = await NativeCalendarEvent.requestPermission();

      if (!granted) {
        setMessage('Calendar permission was not granted');
        return;
      }

      const calendars = await NativeCalendarEvent.getAllCalendars();

      setMessage(`Found ${calendars.length} calendars`);
    } catch (error) {
      setMessage(String(error));
    }
  };

  return (
    <View>
      <Button title="Load Calendars" onPress={loadCalendars} />
      <Text>{message}</Text>
    </View>
  );
}

Contributing

License

MIT


Made with create-react-native-library