11# React Native Calendars ποΈ π
2+
23[ ![ Version] ( https://img.shields.io/npm/v/react-native-calendars.svg )] ( https://www.npmjs.com/package/react-native-calendars )
34[ ![ Build Status] ( https://travis-ci.org/wix/react-native-calendars.svg?branch=master )] ( https://travis-ci.org/wix/react-native-calendars )
45
@@ -56,19 +57,32 @@ Calendars can be localized by adding custom locales to `LocaleConfig` object:
5657import {LocaleConfig } from ' react-native-calendars' ;
5758
5859LocaleConfig .locales [' fr' ] = {
59- monthNames: [' Janvier' ,' FΓ©vrier' ,' Mars' ,' Avril' ,' Mai' ,' Juin' ,' Juillet' ,' AoΓ»t' ,' Septembre' ,' Octobre' ,' Novembre' ,' DΓ©cembre' ],
60- monthNamesShort: [' Janv.' ,' FΓ©vr.' ,' Mars' ,' Avril' ,' Mai' ,' Juin' ,' Juil.' ,' AoΓ»t' ,' Sept.' ,' Oct.' ,' Nov.' ,' DΓ©c.' ],
61- dayNames: [' Dimanche' ,' Lundi' ,' Mardi' ,' Mercredi' ,' Jeudi' ,' Vendredi' ,' Samedi' ],
62- dayNamesShort: [' Dim.' ,' Lun.' ,' Mar.' ,' Mer.' ,' Jeu.' ,' Ven.' ,' Sam.' ],
63- today: ' Aujourd\' hui'
60+ monthNames: [
61+ ' Janvier' ,
62+ ' FΓ©vrier' ,
63+ ' Mars' ,
64+ ' Avril' ,
65+ ' Mai' ,
66+ ' Juin' ,
67+ ' Juillet' ,
68+ ' AoΓ»t' ,
69+ ' Septembre' ,
70+ ' Octobre' ,
71+ ' Novembre' ,
72+ ' DΓ©cembre'
73+ ],
74+ monthNamesShort: [' Janv.' , ' FΓ©vr.' , ' Mars' , ' Avril' , ' Mai' , ' Juin' , ' Juil.' , ' AoΓ»t' , ' Sept.' , ' Oct.' , ' Nov.' , ' DΓ©c.' ],
75+ dayNames: [' Dimanche' , ' Lundi' , ' Mardi' , ' Mercredi' , ' Jeudi' , ' Vendredi' , ' Samedi' ],
76+ dayNamesShort: [' Dim.' , ' Lun.' , ' Mar.' , ' Mer.' , ' Jeu.' , ' Ven.' , ' Sam.' ],
77+ today: " Aujourd'hui"
6478};
6579LocaleConfig .defaultLocale = ' fr' ;
6680```
6781
6882### Calendar
6983
7084<kbd >
71- <img src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/calendar.gif?raw=true " >
85+ <img src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ calendar.gif?raw=true " >
7286</kbd >
7387
7488#### Basic parameters
@@ -82,17 +96,23 @@ LocaleConfig.defaultLocale = 'fr';
8296 // Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined
8397 maxDate= {' 2012-05-30' }
8498 // Handler which gets executed on day press. Default = undefined
85- onDayPress= {(day ) => {console .log (' selected day' , day)}}
99+ onDayPress= {day => {
100+ console .log (' selected day' , day);
101+ }}
86102 // Handler which gets executed on day long press. Default = undefined
87- onDayLongPress= {(day ) => {console .log (' selected day' , day)}}
103+ onDayLongPress= {day => {
104+ console .log (' selected day' , day);
105+ }}
88106 // Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting
89107 monthFormat= {' yyyy MM' }
90108 // Handler which gets executed when visible month changes in calendar. Default = undefined
91- onMonthChange= {(month ) => {console .log (' month changed' , month)}}
109+ onMonthChange= {month => {
110+ console .log (' month changed' , month);
111+ }}
92112 // Hide month navigation arrows. Default = false
93113 hideArrows= {true }
94114 // Replace default arrows with custom ones (direction can be 'left' or 'right')
95- renderArrow= {( direction ) => ( < Arrow/ > ) }
115+ renderArrow= {direction => < Arrow / > }
96116 // Do not show days of other months in month page. Default = false
97117 hideExtraDays= {true }
98118 // If hideArrows = false and hideExtraDays = false do not switch month when tapping on greyed out
@@ -115,7 +135,9 @@ LocaleConfig.defaultLocale = 'fr';
115135 // Disable all touch events for disabled days. can be override with disableTouchEvent in markedDates
116136 disableAllTouchEventsForDisabledDays= {true }
117137 // Replace default month and year title with custom one. the function receive a date as parameter
118- renderHeader= {(date ) => {/* Return JSX*/ }}
138+ renderHeader= {date => {
139+ /* Return JSX*/
140+ }}
119141 // Enable the option to swipe between months. Default = false
120142 enableSwipeMonths= {true }
121143/ >
@@ -128,7 +150,7 @@ LocaleConfig.defaultLocale = 'fr';
128150Dot marking
129151
130152<kbd >
131- <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/marking1.png?raw=true " >
153+ <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ marking1.png?raw=true " >
132154</kbd >
133155<p ></p >
134156
@@ -149,7 +171,7 @@ You can customize a dot color for each day independently.
149171Multi-Dot marking
150172
151173<kbd >
152- <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/marking4.png?raw=true " >
174+ <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ marking4.png?raw=true " >
153175</kbd >
154176<p ></p >
155177
@@ -167,17 +189,17 @@ const workout = {key: 'workout', color: 'green'};
167189 ' 2017-10-25' : {dots: [vacation, massage, workout], selected: true , selectedColor: ' red' },
168190 ' 2017-10-26' : {dots: [massage, workout], disabled: true }
169191 }}
170- / >
192+ / > ;
171193```
172194
173195Period marking
174196
175197<kbd >
176- <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/marking2.png?raw=true " >
198+ <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ marking2.png?raw=true " >
177199</kbd >
178200
179201<kbd >
180- <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/marking3.png?raw=true " >
202+ <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ marking3.png?raw=true " >
181203</kbd >
182204<p ></p >
183205
@@ -196,15 +218,15 @@ Period marking
196218Multi-period marking
197219
198220<kbd >
199- <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/marking6.png?raw=true " >
221+ <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ marking6.png?raw=true " >
200222</kbd >
201223<p ></p >
202224
203225** CAUTION** : This marking is only fully supported by the ` <Calendar/> ` component because it expands its height. Usage with ` <CalendarList/> ` might lead to overflow issues.
204226
205227``` javascript
206228< Calendar
207- markingType= ' multi-period'
229+ markingType= " multi-period"
208230 markedDates= {{
209231 ' 2017-12-14' : {
210232 periods: [
@@ -227,7 +249,7 @@ Multi-period marking
227249Custom marking allows you to customize each marker with custom styles.
228250
229251<kbd >
230- <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/custom .png?raw=true " >
252+ <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking5 .png?raw=true " >
231253</kbd >
232254<p ></p >
233255
@@ -262,6 +284,7 @@ Custom marking allows you to customize each marker with custom styles.
262284```
263285
264286** NEW!** While we still don't support multi marking type, we add the possibility to combine between ` period ` and ` simple ` .
287+
265288``` javascript
266289< Calendar
267290 markingType= {' period' }
@@ -276,8 +299,9 @@ Custom marking allows you to customize each marker with custom styles.
276299 }}
277300/ >
278301```
302+
279303<kbd >
280- <img height =350 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/multi-marking.png?raw=true " >
304+ <img height =350 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ multi-marking.png?raw=true " >
281305</kbd >
282306<p ></p >
283307
@@ -286,7 +310,7 @@ Keep in mind that different marking types are not compatible. You can use just o
286310#### Displaying data loading indicator
287311
288312<kbd >
289- <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/loader.png?raw=true " >
313+ <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ loader.png?raw=true " >
290314</kbd >
291315<p ></p >
292316
@@ -331,7 +355,9 @@ The loading indicator next to the month name will be displayed if `<Calendar/>`
331355 }}
332356/ >
333357```
358+
334359#### Customize days titles with disabled styling
360+
335361``` javascript
336362< Calendar
337363 theme= {{
@@ -385,7 +411,7 @@ theme={{
385411```
386412
387413<kbd >
388- <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/day-header-style.png?raw=true " >
414+ <img height =50 src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ day-header-style.png?raw=true " >
389415</kbd >
390416<p ></p >
391417
@@ -401,9 +427,7 @@ If you need custom functionality not supported by current day component implemen
401427 dayComponent= {({date, state}) => {
402428 return (
403429 < View>
404- < Text style= {{textAlign: ' center' , color: state === ' disabled' ? ' gray' : ' black' }}>
405- {date .day }
406- < / Text >
430+ < Text style= {{textAlign: ' center' , color: state === ' disabled' ? ' gray' : ' black' }}> {date .day }< / Text >
407431 < / View>
408432 );
409433 }}
@@ -412,9 +436,9 @@ If you need custom functionality not supported by current day component implemen
412436
413437The ` dayComponent ` prop has to receive a RN component or a function that receive props. The ` dayComponent ` will receive such props:
414438
415- * state - disabled if the day should be disabled (this is decided by base calendar component).
416- * marking - ` markedDates ` value for this day.
417- * date - the date object representing this day.
439+ - state - disabled if the day should be disabled (this is decided by base calendar component).
440+ - marking - ` markedDates ` value for this day.
441+ - date - the date object representing this day.
418442
419443** Tip** : Don't forget to implement ` shouldComponentUpdate() ` for your custom day component to make the calendar perform better
420444
@@ -423,7 +447,7 @@ If you implement an awesome day component please make a PR so that other people
423447### CalendarList
424448
425449<kbd >
426- <img src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/calendar-list.gif?raw=true " >
450+ <img src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ calendar-list.gif?raw=true " >
427451</kbd >
428452<p ></p >
429453
@@ -448,7 +472,7 @@ If you implement an awesome day component please make a PR so that other people
448472#### Horizontal CalendarList
449473
450474<kbd >
451- <img src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/horizontal-calendar-list.gif?raw=true " >
475+ <img src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ horizontal-calendar-list.gif?raw=true " >
452476</kbd >
453477<p ></p >
454478
@@ -468,8 +492,9 @@ You can also make the `CalendarList` scroll horizontally. To do that you need to
468492```
469493
470494### Agenda
495+
471496<kbd >
472- <img src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/agenda.gif?raw=true " >
497+ <img src =" https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/ agenda.gif?raw=true " >
473498</kbd >
474499<p ></p >
475500
@@ -487,13 +512,21 @@ An advanced `Agenda` component that can display interactive listings for calenda
487512 ' 2012-05-25' : [{name: ' item 3 - any js object' }, {name: ' any js object' }]
488513 }}
489514 // Callback that gets called when items for a certain month should be loaded (month became visible)
490- loadItemsForMonth= {(month ) => {console .log (' trigger items loading' )}}
515+ loadItemsForMonth= {month => {
516+ console .log (' trigger items loading' );
517+ }}
491518 // Callback that fires when the calendar is opened or closed
492- onCalendarToggled= {(calendarOpened ) => {console .log (calendarOpened)}}
519+ onCalendarToggled= {calendarOpened => {
520+ console .log (calendarOpened);
521+ }}
493522 // Callback that gets called on day press
494- onDayPress= {(day ) => {console .log (' day pressed' )}}
523+ onDayPress= {day => {
524+ console .log (' day pressed' );
525+ }}
495526 // Callback that gets called when day changes while scrolling agenda list
496- onDayChange= {(day ) => {console .log (' day changed' )}}
527+ onDayChange= {day => {
528+ console .log (' day changed' );
529+ }}
497530 // Initially selected day
498531 selected= {' 2012-05-16' }
499532 // Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined
@@ -505,17 +538,29 @@ An advanced `Agenda` component that can display interactive listings for calenda
505538 // Max amount of months allowed to scroll to the future. Default = 50
506539 futureScrollRange= {50 }
507540 // Specify how each item should be rendered in agenda
508- renderItem= {(item , firstItemInDay ) => {return (< View / > );}}
541+ renderItem= {(item , firstItemInDay ) => {
542+ return < View / > ;
543+ }}
509544 // Specify how each date should be rendered. day can be undefined if the item is not first in that day
510- renderDay= {(day , item ) => {return (< View / > );}}
545+ renderDay= {(day , item ) => {
546+ return < View / > ;
547+ }}
511548 // Specify how empty date content with no items should be rendered
512- renderEmptyDate= {() => {return (< View / > );}}
549+ renderEmptyDate= {() => {
550+ return < View / > ;
551+ }}
513552 // Specify how agenda knob should look like
514- renderKnob= {() => {return (< View / > );}}
553+ renderKnob= {() => {
554+ return < View / > ;
555+ }}
515556 // Specify what should be rendered instead of ActivityIndicator
516- renderEmptyData = {() => {return (< View / > );}}
557+ renderEmptyData= {() => {
558+ return < View / > ;
559+ }}
517560 // Specify your item comparison function for increased performance
518- rowHasChanged= {(r1 , r2 ) => {return r1 .text !== r2 .text }}
561+ rowHasChanged= {(r1 , r2 ) => {
562+ return r1 .text !== r2 .text ;
563+ }}
519564 // Hide knob button. Default = false
520565 hideKnob= {true }
521566 // When `true` and `hideKnob` prop is `false`, the knob will always be visible and the user will be able to drag the knob up and close the calendar. Default = false
@@ -549,15 +594,15 @@ An advanced `Agenda` component that can display interactive listings for calenda
549594
550595## Authors
551596
552- * [ Tautvilas Mecinskas] ( https://github.com/tautvilas/ ) - Initial code - [ @tautvilas ] ( https://twitter.com/Tautvilas )
553- * Katrin Zotchev - Initial design - [ @katrin_zot] ( https://twitter.com/katrin_zot )
597+ - [ Tautvilas Mecinskas] ( https://github.com/tautvilas/ ) - Initial code - [ @tautvilas ] ( https://twitter.com/Tautvilas )
598+ - Katrin Zotchev - Initial design - [ @katrin_zot] ( https://twitter.com/katrin_zot )
554599
555600See also the list of [ contributors] ( https://github.com/wix/react-native-calendar-components/contributors ) who participated in this project.
556601
557602## Contributing
558603
559604Pull requests are most welcome!
560605Please ` npm run test ` and ` npm run lint ` before push.
561- Don't forget to add a ** title** and a ** description** that explain the issue you're trying to solve and your suggested solution.
606+ Don't forget to add a ** title** and a ** description** that explain the issue you're trying to solve and your suggested solution.
562607Screenshots and gifs are VERY helpful.
563608Please do NOT format the files as we are trying to keep a unified syntax and the reviewing process fast and simple.
0 commit comments