Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

React Native Calendar Components 🗓️ 📆

License

NotificationsYou must be signed in to change notification settings

wix/react-native-calendars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stand With Ukraine

React Native Calendars 🗓️ 📆

A declarative cross-platform React Native calendar component for iOS and Android.

VersionBuild status

This module includes information on how to use this customizableReact Native calendar component.

The package is compatible with bothAndroid andiOS


Official documentation

This README provides basic examples of how to get started withreact-native-calendars. For detailed information, refer to theofficial documentation site.

Features ✨

  • Pure JS. No Native code required
  • Date marking - dot, multi-dot, period, multi-period and custom marking
  • Customization of style, content (days, months, etc) and dates
  • Detailed documentation and examples
  • Swipeable calendar with flexible custom rendering
  • Scrolling to today, selecting dates, and more
  • Allowing or blocking certain dates
  • Accessibility support
  • Automatic date formatting for different locales

Try it out ⚡

You can run a sample module using these steps:

$ git clone git@github.com:wix/react-native-calendars.git$ cd react-native-calendars$ yarn install$ cd ios && pod install && cd ..$ react-native run-ios

You can check example screens source code inexample module screens

This project is compatible with Expo/CRNA (without ejecting), and the examples have beenpublished on Expo

Getting Started 🔧

Here's how to get started with react-native-calendars in your React Native project:

Install the package:

$ yarn add react-native-calendars

RN Calendars is implemented in JavaScript, so no native module linking is required.

Usage 🚀

Basic usage examples of the library

For detailed information on using this component, see theofficial documentation site

Importing theCalendar component

import{Calendar,CalendarList,Agenda}from'react-native-calendars';

Use theCalendar component in your app:

<CalendaronDayPress={day=>{console.log('selected day',day);}}/>

Some Code Examples

Here are a few code snippets that demonstrate how to use some of the key features of react-native-calendars:

Creating a basic calendar with default settings:

importReact,{useState}from'react';import{Calendar,LocaleConfig}from'react-native-calendars';constApp=()=>{const[selected,setSelected]=useState('');return(<CalendaronDayPress={day=>{setSelected(day.dateString);}}markedDates={{[selected]:{selected:true,disableTouchEvent:true,selectedDotColor:'orange'}}}/>);};exportdefaultApp;

Customize the appearance of the calendar:

<Calendar// Customize the appearance of the calendarstyle={{borderWidth:1,borderColor:'gray',height:350}}// Specify the current datecurrent={'2012-03-01'}// Callback that gets called when the user selects a dayonDayPress={day=>{console.log('selected day',day);}}// Mark specific dates as markedmarkedDates={{'2012-03-01':{selected:true,marked:true,selectedColor:'blue'},'2012-03-02':{marked:true},'2012-03-03':{selected:true,marked:true,selectedColor:'blue'}}}/>

Configuring the locale:

import{LocaleConfig}from'react-native-calendars';importReact,{useState}from'react';import{Calendar,LocaleConfig}from'react-native-calendars';LocaleConfig.locales['fr']={monthNames:['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],monthNamesShort:['Janv.','Févr.','Mars','Avril','Mai','Juin','Juil.','Août','Sept.','Oct.','Nov.','Déc.'],dayNames:['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],dayNamesShort:['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],today:"Aujourd'hui"};LocaleConfig.defaultLocale='fr';constApp=()=>{const[selected,setSelected]=useState('');return(<CalendaronDayPress={day=>{setSelected(day.dateString);}}markedDates={{[selected]:{selected:true,disableTouchEvent:true,selectedDotColor:'orange'}}}/>);};exportdefaultApp;

Adding a global theme to the calendar:

<Calendarstyle={{borderWidth:1,borderColor:'gray',height:350,}}theme={{backgroundColor:'#ffffff',calendarBackground:'#ffffff',textSectionTitleColor:'#b6c1cd',selectedDayBackgroundColor:'#00adf5',selectedDayTextColor:'#ffffff',todayTextColor:'#00adf5',dayTextColor:'#2d4150',textDisabledColor:'#dd99ee'}}/>

Customized Calendar Examples

Calendar

Dot marking

Multi-Dot marking

Period Marking

Multi-Period marking

Custom marking

Date loading indicator

Scrollable semi-infinite calendar

Horizontal calendar

Agenda


Authors

See also the list ofcontributors who participated in this project.

Contributing

We welcome contributions to react-native-calendars.

If you have an idea for a new feature or have discovered a bug, please open an issue.

Pleaseyarn test andyarn lint before pushing changes.

Don't forget to add atitle and adescription explaining the issue you're trying to solve and your proposed solution.

Screenshots and Gifs are VERY helpful to add to the PR for reviews.

Please DO NOT format the files - we're trying to keep a unified syntax and keep the reviewing process fast and simple.

License

React Native Calendars is MIT licensed


[8]ページ先頭

©2009-2025 Movatter.jp