Skip to main content
Version: 2.x

CalendarContainer

The CalendarContainer component is the main wrapper for the React Native Calendar Kit. It provides the necessary context and configuration for all child components, managing the overall state and behavior of the calendar.

Props

The CalendarContainer component accepts the following props:

Prop NameTypeDefaultDescription
calendarWidthnumber-Width of the calendar. If not provided, it uses the parent width.
themeobject-Custom theme object for styling the calendar.
hourWidthnumber60Width of the hour column.
firstDaynumber1First day of the week (0 for Sunday, 1 for Monday, etc.).
minDatestring2 years agoMinimum selectable date.
maxDatestring2 years from nowMaximum selectable date.
initialDatestringTodayInitial date to display.
initialLocalesobject-Initial locales for internationalization.
localestringenLocale string for date formatting.
isLoadingbooleanfalseWhether the calendar is in a loading state.
spaceFromTopnumber16Space from the top of the calendar.
spaceFromBottomnumber16Space from the bottom of the calendar.
startnumber0Start hour of the calendar (in minutes).
endnumber1440End hour of the calendar (in minutes).
timeIntervalnumber60Time interval between slots (in minutes).
maxTimeIntervalHeightnumber124Maximum height of a time interval.
minTimeIntervalHeightnumber60Minimum height of a time interval.
allowPinchToZoombooleanfalseWhether to allow pinch-to-zoom gesture.
initialTimeIntervalHeightnumber60Initial height of a time interval.
timeZonestring-Time zone for the calendar.
showWeekNumberbooleanfalseWhether to show week numbers.
onChangefunction-Callback when the visible range changes.
onDateChangedfunction-Callback when the selected date changes.
onPressBackgroundfunction-Callback when the background is pressed.
onPressDayNumberfunction-Callback when a day number is pressed.
onRefreshfunction-Callback for pull-to-refresh action.
unavailableHoursarray-Array of unavailable hours.
highlightDatesobject-Object defining dates to highlight.
eventsarray-Array of event objects to display.
onPressEventfunction-Callback when an event is pressed.
numberOfDaysnumber7Number of days to display.
scrollByDayboolean-Whether to scroll by day or week.
scrollToNowbooleantrueWhether to scroll to the current time on load.
useHapticbooleanfalseWhether to use haptic feedback.
dragStepnumber15Step size for dragging events (in minutes).
allowDragToEditbooleanfalseWhether to allow dragging to edit events.
onDragEventStartfunction-Callback when event dragging starts.
onDragEventEndfunction-Callback when event dragging ends.
onLongPressEventfunction-Callback for long press on an event.
selectedEventobject-Currently selected event.
pagesPerSidenumber2Number of pages to render on each side of the current page.
hideWeekDaysarray-Array of week days to hide (1-7 where 1 is Monday and 7 is Sunday).
allowDragToCreatebooleanfalseWhether to allow drag-to-create events.
defaultDurationnumber30Default duration for new events (in minutes).
onDragCreateEventStartfunction-Callback when drag-to-create starts.
onDragCreateEventEndfunction-Callback when drag-to-create ends.
useAllDayEventbooleantrueWhether to use all-day events.
rightEdgeSpacingnumber1Spacing from the right edge of events.
overlapEventsSpacingnumber1Spacing between overlapping events.
minRegularEventMinutesnumber1Minimum duration for regular events (in minutes).
onLoadfunction-Callback when the calendar finishes loading.
overlapTypestring-Type of event overlap handling.
minStartDifferencenumber-Minimum difference between event start times for overlap.
onLongPressBackgroundfunction-Callback for long press on the background.