Socket
Book a DemoInstallSign in
Socket

@sunsama/event-calendar

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sunsama/event-calendar

Event calendar.

latest
Source
npmnpm
Version
0.11.3
Version published
Maintainers
0
Created
Source

Event Calendar

Overview

The Sunsama Event Calendar library is a React Native component designed to display and manage calendar events. It supports multiple calendars, real-time updates, and intuitive gestures for a seamless user experience.

We use this library in the Sunsama mobile app to display and manage events across multiple calendars. It is designed to be highly customizable and easy to integrate into any React Native project.

Features

  • Displays events in a day-view layout.
  • Supports multiple calendars.
  • Gesture-based event interactions.
  • Animated UI with react-native-reanimated.
  • Compatible with react-native-gesture-handler.
  • Customizable event styling.
  • Editable events with restrictions.
  • Timezone support.
  • Zoom and drag interactions.
  • Supports Expo Go and bare React Native projects.

Screenshots

iOS

Event Calendar iOS

Android

Event Calendar Android

Installation

To install the library, add it to your project using:

npm install @sunsama/event-calendar
# or
yarn add @sunsama/event-calendar

Ensure the following dependencies are also installed:

npm install react-native-reanimated react-native-gesture-handler

Usage

For a full implementation example, refer to the example app included in the repository.

Gestures

The Event Calendar component supports the following gestures:

  • Double tap: Resets the zoom level to the default zoom value.
  • Pinch: Zooms in and out of the calendar.
  • Drag: Moves the calendar vertically.
  • Tap event: Opens the event details view.
  • Hold & Drag: Create a new event.

Edit mode:

  • Hold & Drag event: Moves event to different times, starts edit mode.
  • Hold & Drag event edges: When in edit mode, resizes event.
  • Tap event: Stops edit mode.

Props

PropTypeRequiredDefaultDescription
eventsCalendarEvent[]YesList of event objects.
dayDateStringYesThe current date of the calendar in ISO string.
renderEventFunctionYesCustom renderer for event components.
onCreateEventFunctionNoCallback triggered when a new event is created.
onPressEventFunctionNoCallback triggered when an event is pressed.
userCalendarIdStringNoThe primary calendar ID for event sorting.
timeFormatStringNoHH:mmDefines the time format used in the calendar. See moment.js documentation for examples.
showTimeIndicatorBooleanNoFalseDisplays a line showing the current time.
canCreateEventsBooleanNoTrueAllows users to create new events.
canEditEventFunction or BooleanNoTrueDetermines if an event is editable. You can supply a function to do this deterministically.
maxAllDayEventsNumberNo2Sets the maximum number of all-day events displayed before showing a 'show more' option.
timezoneStringNoUTCDefines the timezone for event times.
renderDragBarsObjectNoCustom drag handles for resizing events.
onEventEditFunctionNoCallback triggered when an event is edited.
themeObjectNoAllows overriding default calendar themes.
initialZoomLevelNumberNo0.8Defines the initial zoom level of the calendar.
defaultZoomLevelNumberNo0.8Defines the default zoom level of the calendar. This is used to determine the zoom level when you double-tap the calendar and the height of all-day events.
minZoomLevelNumberNo0.54Defines the minimum zoom level of the calendar.
maxZoomLevelNumberNo3Defines the maximum zoom level of the calendar.
renderNewEventContainerFunctionNoCustom UI for new event creation. If none supplied it will show a semi-transparent bar you can theme.
fiveMinuteIntervalBooleanNoFalseEnsures event snapping to 5-minute increments.
updateLocalStateAfterEditBooleanNoTrueOptimistically updates local state after event editing.
extraTimedComponentsFunctionNoAllows rendering extra components in the calendar. These will be rendered before all the timed events.
onZoomChangeFunctionNoCallback triggered when the zoom level changes.
onScrollFunctionNoCallback returning the current Y position the user has scrolled to.
initialEventEditStringNoThe ID of the event that should be in edit mode when the calendar is first rendered.

Methods

The Event Calendar component exposes the following methods through the reference:

MethodDescription
scrollToTimeScrolls the calendar to the specified time (in minutes since midnight).
scrollToOffsetScrolls the calendar to the specified Y position (useful in combination with onScroll).
startEditModeStarts the edit mode for the specified event.
endEditModeEnds the edit mode for the currently edited event.
setZoomLevelSets the zoom level of the calendar.

Dependencies

Ensure you have the following dependencies installed for proper functionality:

  • react-native-reanimated
  • react-native-gesture-handler
  • react-native-safe-area-context

Limitations

This library has been made specifically for the Sunsama mobile app and therefore it is very opinionated. This results in some limitations: We only support features that are used in the Sunsama app. If you need a feature that is not supported, you can create a PR but we won't add new features unless it brings value to the Sunsama app. We do fix bugs, however.

License

This project is licensed under the MIT License.

Keywords

react-native

FAQs

Package last updated on 04 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.