### Install and Build react-native-big-calendar with Bun Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/CONTRIBUTING.md Installs project dependencies, runs post-installation scripts, and builds the project using Bun. This is the initial setup step for development. ```shell bun install bun run postinstall ``` ```shell bun run build ``` ```shell bun run test ``` -------------------------------- ### Setting up Development Environment for React Native Big Calendar Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/README.md This section outlines the steps required to set up the development environment for contributing to or running the demo of react-native-big-calendar. It includes commands for installing dependencies using `bun` and starting the development server for the Expo demo. ```sh bun install bun sync-demo cd expo-demo bun install cd expo-demo bun start # In the root directory, after modifying library code: bun sync-demo ``` -------------------------------- ### Install react-native-web for Web Usage Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/README.md Installs the react-native-web package, which is necessary for using react-native-big-calendar on web platforms. This enables cross-platform compatibility. ```bash npm install react-native-web ``` -------------------------------- ### Internationalization (I18n) Setup for React Native Big Calendar Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/README.md This example shows how to configure the calendar for different languages using the `locale` prop and importing the corresponding day.js locale file. It demonstrates setting the locale to Japanese ('ja') and provides a link to the day.js locale repository for other available language files. ```typescript import 'dayjs/locale/ja' ``` -------------------------------- ### Install react-native-big-calendar using npm Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/README.md Installs the 'next' beta version of react-native-big-calendar using npm. This version includes swipe animations. For a stable release, use 'react-native-big-calendar' without '@next'. ```bash npm install --save react-native-big-calendar@next ``` -------------------------------- ### Install Peer Dependencies for react-native-big-calendar Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/README.md Installs essential peer dependencies required for react-native-big-calendar to function correctly. These include React, React Native, and gesture handler libraries. ```bash npm install react react-native react-native-gesture-handler react-native-infinite-pager react-native-reanimated ``` -------------------------------- ### Install react-native-big-calendar using Yarn Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/README.md Installs the 'next' beta version of react-native-big-calendar using Yarn. This version includes swipe animations. For a stable release, use 'react-native-big-calendar' without '@next'. ```bash yarn add react-native-big-calendar@next ``` -------------------------------- ### Install TypeScript Types for React and React Native Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/README.md Installs development dependencies for TypeScript types, ensuring proper type checking for React and React Native when using TypeScript with react-native-big-calendar. ```bash npm install --save-dev @types/react @types/react-native ``` -------------------------------- ### Format All-Day Event Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/README.md Demonstrates the correct format for all-day events. All-day events must have their start and end times set to 00:00:00 on the respective dates. This ensures the calendar correctly identifies and displays them. ```typescript { title: 'all day event', start: "2021-12-24T00:00:00.000Z", end: "2021-12-24T00:00:00.000Z", // same date as `start` } ``` -------------------------------- ### Apply Custom Theme to Calendar using Theme Prop Source: https://context7.com/acro5piano/react-native-big-calendar/llms.txt This example shows how to deeply customize the appearance of the `react-native-big-calendar` using the `theme` prop. The theme object allows modification of colors, typography, and event overlapping styles, inspired by Material UI. The `PartialTheme` type should be used for defining the theme object. ```tsx import { Calendar, PartialTheme } from 'react-native-big-calendar' import { View } from 'react-native' function ThemedCalendar() { const darkTheme: PartialTheme = { palette: { primary: { main: '#6366f1', contrastText: '#ffffff', }, nowIndicator: '#ef4444', gray: { '100': '#1f2937', '200': '#374151', '300': '#4b5563', '500': '#9ca3af', '800': '#e5e7eb', }, moreLabel: '#d1d5db', }, typography: { fontFamily: 'System', xs: { fontSize: 10 }, sm: { fontSize: 12 }, xl: { fontSize: 22, fontWeight: 'bold' }, moreLabel: { fontSize: 11, fontWeight: 'bold' }, }, eventCellOverlappings: [ { main: '#8b5cf6', contrastText: '#fff' }, { main: '#ec4899', contrastText: '#fff' }, { main: '#14b8a6', contrastText: '#fff' }, ], isRTL: false, } const events = [ { title: 'Dark Theme Event', start: new Date(2024, 5, 15, 10, 0), end: new Date(2024, 5, 15, 12, 0), }, ] return ( ) } ``` -------------------------------- ### Customizing Calendar Theme with React Native Big Calendar Source: https://github.com/acro5piano/react-native-big-calendar/blob/main/README.md This section explains how to customize the appearance of the calendar using the `theme` prop. It defines the structure of the `ThemeInterface`, including `palette` and `typography` options, and provides an example of a `darkTheme` object. The `theme` prop accepts an object conforming to this interface to alter colors and text styles. ```typescript export interface Palette { main: string contrastText: string } export type Typography = Pick< TextStyle, | 'fontFamily' | 'fontWeight' | 'fontSize' | 'lineHeight' | 'letterSpacing' | 'textAlign' > export interface ThemeInterface { palette: { primary: Palette nowIndicator: string gray: { 100: string 200: string 300: string 500: string 800: string } moreLabel: string } isRTL: boolean typography: { fontFamily?: string xs: Typography sm: Typography xl: Typography moreLabel: Typography } eventCellOverlappings: readonly Palette[] moreLabel: TextStyle } const darkTheme = { palette: { primary: { main: '#6185d0', contrastText: '#000', }, gray: { '100': '#333', '200': '#666', '300': '#888', '500': '#aaa', '800': '#ccc', }, }, } ``` -------------------------------- ### Configure Month View in react-native-big-calendar Source: https://context7.com/acro5piano/react-native-big-calendar/llms.txt Configure the month view of the calendar using props like `showAdjacentMonths`, `showSixWeeks`, `maxVisibleEventCount`, and `moreLabel`. This example demonstrates how to set these properties to control the display of events and the overall month layout. It also includes a handler for when the 'more' label is pressed. ```tsx import { Calendar, ICalendarEventBase } from 'react-native-big-calendar' import dayjs from 'dayjs' function MonthViewCalendar() { const events: ICalendarEventBase[] = [ // Multiple events on the same day to demonstrate overflow { title: 'Event 1', start: dayjs().toDate(), end: dayjs().add(1, 'hour').toDate() }, { title: 'Event 2', start: dayjs().toDate(), end: dayjs().add(1, 'hour').toDate() }, { title: 'Event 3', start: dayjs().toDate(), end: dayjs().add(1, 'hour').toDate() }, { title: 'Event 4', start: dayjs().toDate(), end: dayjs().add(1, 'hour').toDate() }, { title: 'Event 5', start: dayjs().toDate(), end: dayjs().add(1, 'hour').toDate() }, ] const handleMorePress = (events: ICalendarEventBase[]) => { console.log('More events:', events.map(e => e.title)) } return ( ) } ``` -------------------------------- ### Display All-Day Events in React Native Big Calendar Source: https://context7.com/acro5piano/react-native-big-calendar/llms.txt Demonstrates how to display all-day events in react-native-big-calendar. All-day events are identified by start and end times set to midnight (00:00:00). These events appear in a separate header section above the main time grid. The example utilizes the `showAllDayEventCell` prop to enable this feature and `allDayEventCellStyle` for customization. ```tsx import { Calendar } from 'react-native-big-calendar' import dayjs from 'dayjs' function AllDayEventsCalendar() { const monday = dayjs().day(1) const events = [ // Single day all-day event { title: 'Holiday', start: monday.set('hour', 0).set('minute', 0).toDate(), end: monday.set('hour', 0).set('minute', 0).toDate(), }, // Multi-day all-day event { title: 'Company Retreat', start: monday.set('hour', 0).set('minute', 0).toDate(), end: monday.add(3, 'day').set('hour', 0).set('minute', 0).toDate(), }, // Regular timed event { title: 'Morning Meeting', start: monday.set('hour', 9).set('minute', 0).toDate(), end: monday.set('hour', 10).set('minute', 0).toDate(), }, ] return ( ) } ``` -------------------------------- ### Configure Right-to-Left (RTL) Support for Calendar Source: https://context7.com/acro5piano/react-native-big-calendar/llms.txt This example demonstrates how to enable right-to-left (RTL) layout for the calendar, which is essential for languages like Hebrew or Arabic. It involves setting the `isRTL` prop to `true` and specifying the correct locale using the `locale` prop. Make sure the corresponding dayjs locale is imported. ```tsx import 'dayjs/locale/he' import { Calendar } from 'react-native-big-calendar' function RTLCalendar() { const events = [ { title: 'פגישת צוות', start: new Date(2024, 5, 15, 10, 0), end: new Date(2024, 5, 15, 11, 0), }, ] return ( ) } ``` -------------------------------- ### Enable Calendar Localization with Locale Prop and Dayjs Source: https://context7.com/acro5piano/react-native-big-calendar/llms.txt This code illustrates how to internationalize the calendar by setting the `locale` prop and importing the corresponding dayjs locale files. This changes day and month names, as well as date formatting according to the selected language. Ensure you have the necessary dayjs locale packages installed. ```tsx import 'dayjs/locale/ja' import 'dayjs/locale/de' import 'dayjs/locale/fr' import { Calendar } from 'react-native-big-calendar' import { useState } from 'react' function LocalizedCalendar() { const [locale, setLocale] = useState('en') const events = [ { title: 'International Meeting', start: new Date(2024, 5, 15, 10, 0), end: new Date(2024, 5, 15, 11, 0), }, ] return ( <>