Skip to content

Commit f6dfb32

Browse files
committed
fix docs
1 parent 1a35e84 commit f6dfb32

File tree

6 files changed

+97
-86
lines changed

6 files changed

+97
-86
lines changed

README.md

Lines changed: 58 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,21 @@ The package is compatible with both **Android** and **iOS**
1515

1616
<br>
1717

18-
19-
> ### **Official documentation**
18+
> ### **Official documentation**
19+
>
2020
> This README provides basic examples of how to get started with `react-native-calendars`. For detailed information, refer to the [official documentation site](https://wix.github.io/react-native-calendars/docs/intro).
2121
22-
2322
## Features ✨
24-
* Pure JS. No Native code required
25-
* Date marking - dot, multi-dot, period, multi-period and custom marking
26-
* Customization of style, content (days, months, etc) and dates
27-
* Detailed documentation and examples
28-
* Swipeable calendar with flexible custom rendering
29-
* Scrolling to today, selecting dates, and more
30-
* Allowing or blocking certain dates
31-
* Accessibility support
32-
* Automatic date formatting for different locales
3323

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

3534
## Try it out ⚡
3635

@@ -52,63 +51,68 @@ You can check example screens source code in [example module screens](https://gi
5251

5352
This project is compatible with Expo/CRNA (without ejecting), and the examples have been [published on Expo](https://expo.io/@community/react-native-calendars-example)
5453

55-
5654
## Getting Started 🔧
5755

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

6058
### Install the package:
6159

6260
Using `npm`:
61+
6362
```
6463
$ npm install --save react-native-calendars
6564
```
6665

6766
Using `Yarn`:
67+
6868
```
6969
$ yarn add react-native-calendars
7070
```
7171

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

7474
## Usage 🚀
75+
7576
Basic usage examples of the library
7677

7778
##### **For detailed information on using this component, see the [official documentation site](https://wix.github.io/react-native-calendars/docs/intro)**
79+
7880
### Importing the `Calendar` component
7981

8082
```javascript
8183
import {`[Calendar](#calendar), [CalendarList](#calendarlist), [Agenda](#agenda)`} from 'react-native-calendars';
8284
```
85+
8386
### Use the `Calendar` component in your app:
8487

8588
```javascript
8689
<Calendar
87-
onDayPress={(day) => {console.log('selected day', day)}}
90+
onDayPress={day => {
91+
console.log('selected day', day);
92+
}}
8893
/>
8994
```
9095

91-
9296
## Some Code Examples
9397

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

97100
### Creating a basic calendar with default settings:
101+
98102
```javascript
99-
import React, { useState } from 'react';
100-
import { Calendar, LocaleConfig } from 'react-native-calendars';
103+
import React, {useState} from 'react';
104+
import {Calendar, LocaleConfig} from 'react-native-calendars';
101105

102106
const App = () => {
103107
const [selected, setSelected] = useState('');
104108

105109
return (
106110
<Calendar
107-
onDayPress={(day) => {
111+
onDayPress={day => {
108112
setSelected(day.dateString);
109113
}}
110114
markedDates={{
111-
[selected]: { selected: true, disableTouchEvent: true, selectedDotColor: 'orange' },
115+
[selected]: {selected: true, disableTouchEvent: true, selectedDotColor: 'orange'}
112116
}}
113117
/>
114118
);
@@ -118,6 +122,7 @@ export default App;
118122
```
119123

120124
### Customize the appearance of the calendar:
125+
121126
```javascript
122127
<Calendar
123128
// Customize the appearance of the calendar
@@ -129,21 +134,24 @@ export default App;
129134
// Specify the current date
130135
current={'2012-03-01'}
131136
// Callback that gets called when the user selects a day
132-
onDayPress={(day) => {console.log('selected day', day)}}
137+
onDayPress={day => {
138+
console.log('selected day', day);
139+
}}
133140
// Mark specific dates as marked
134141
markedDates={{
135142
'2012-03-01': {selected: true, marked: true, selectedColor: 'blue'},
136143
'2012-03-02': {marked: true},
137-
'2012-03-03': {selected: true, marked: true, selectedColor: 'blue'},
144+
'2012-03-03': {selected: true, marked: true, selectedColor: 'blue'}
138145
}}
139146
/>
140147
```
141148

142149
### Configuring the locale:
150+
143151
```javascript
144152
import {LocaleConfig} from 'react-native-calendars';
145-
import React, { useState } from 'react';
146-
import { Calendar, LocaleConfig } from 'react-native-calendars';
153+
import React, {useState} from 'react';
154+
import {Calendar, LocaleConfig} from 'react-native-calendars';
147155

148156
LocaleConfig.locales['fr'] = {
149157
monthNames: [
@@ -160,7 +168,20 @@ LocaleConfig.locales['fr'] = {
160168
'Novembre',
161169
'Décembre'
162170
],
163-
monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
171+
monthNames: [
172+
'Janvier',
173+
'Février',
174+
'Mars',
175+
'Avril',
176+
'Mai',
177+
'Juin',
178+
'Juillet',
179+
'Août',
180+
'Septembre',
181+
'Octobre',
182+
'Novembre',
183+
'Décembre'
184+
],
164185
monthNamesShort: ['Janv.', 'Févr.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Déc.'],
165186
dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
166187
dayNamesShort: ['Dim.', 'Lun.', 'Mar.', 'Mer.', 'Jeu.', 'Ven.', 'Sam.'],
@@ -174,11 +195,11 @@ const App = () => {
174195

175196
return (
176197
<Calendar
177-
onDayPress={(day) => {
198+
onDayPress={day => {
178199
setSelected(day.dateString);
179200
}}
180201
markedDates={{
181-
[selected]: { selected: true, disableTouchEvent: true, selectedDotColor: 'orange' },
202+
[selected]: {selected: true, disableTouchEvent: true, selectedDotColor: 'orange'}
182203
}}
183204
/>
184205
);
@@ -188,6 +209,7 @@ export default App;
188209
```
189210

190211
### Adding a global theme to the calendar:
212+
191213
```javascript
192214
import React, { useState } from 'react';
193215
import { Calendar, LocaleConfig } from 'react-native-calendars';
@@ -212,16 +234,16 @@ const App = () => {
212234
dayTextColor: '#2d4150',
213235
textDisabledColor: '#d9e
214236
```
237+
215238
## Customized Calendar Examples
216239
217240
### Calendar
218-
<img src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/calendar.gif?raw=true">
219-
220241
242+
<img src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/calendar.gif?raw=true">
221243
222244
### Dot marking
223245
224-
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking1.png?raw=true">
246+
<img height={50} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking1.png?raw=true">
225247
226248
### Multi-Dot marking
227249
@@ -259,7 +281,6 @@ const App = () => {
259281
260282
<img src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/agenda.gif?raw=true">
261283
262-
263284
<br>
264285
265286
## Authors
@@ -271,15 +292,15 @@ See also the list of [contributors](https://github.com/wix/react-native-calendar
271292
272293
## Contributing
273294
274-
We welcome contributions to react-native-calendars.
295+
We welcome contributions to react-native-calendars.
275296
276-
If you have an idea for a new feature or have discovered a bug, please open an issue.
297+
If you have an idea for a new feature or have discovered a bug, please open an issue.
277298
278-
Please `npm run test` and `npm run lint` before pushing changes.
299+
Please `npm run test` and `npm run lint` before pushing changes.
279300
280-
Don't forget to add a **title** and a **description** explaining the issue you're trying to solve and your proposed solution.
301+
Don't forget to add a **title** and a **description** explaining the issue you're trying to solve and your proposed solution.
281302
282-
Screenshots and Gifs are VERY helpful to add to the PR for reviews.
303+
Screenshots and Gifs are VERY helpful to add to the PR for reviews.
283304
284305
Please DO NOT format the files - we're trying to keep a unified syntax and keep the reviewing process fast and simple.
285306

docsRNC/docs/Agenda.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Agenda component
44
This component extends **[CalendarList](https://github.com/wix/react-native-calendars/blob/master/src/calendar-list/index.tsx), [FlatList](https://reactnative.dev/docs/flatlist)** props.
55
:::
66

7-
<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}><img style={{maxHeight: '420px'}} src={'https://github.com/wix/react-native-calendars/blob/master/demo/assets/agenda.gif?raw=true'}/>
8-
7+
<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}>
8+
<img style={{maxHeight: '420px'}} src={'https://github.com/wix/react-native-calendars/blob/master/demo/assets/agenda.gif?raw=true'}/>
99
</div>
1010

1111
## API
@@ -60,11 +60,11 @@ Whether to show items only for the selected date
6060
Replace default ActivityIndicator with a custom one
6161
<span style={{color: 'grey'}}>() => JSX.Element</span>
6262

63-
<br>
63+
<br/>
6464

6565
## Agenda Examples
6666

67-
<br>
67+
<br/>
6868

6969
```javascript
7070
<Agenda

docsRNC/docs/Calendar.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Calendar component
44
This component extends **[CalendarHeader](https://github.com/wix/react-native-calendars/blob/master/src/calendar/header/index.tsx), [BasicDay](https://github.com/wix/react-native-calendars/blob/master/src/calendar/day/basic/index.tsx)** props.
55
:::
66

7-
<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}><img style={{maxHeight: '420px'}} src={'https://github.com/wix/react-native-calendars/blob/master/demo/assets/calendar.gif?raw=true'}/>
8-
7+
<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}>
8+
<img style={{maxHeight: '420px'}} src={'https://github.com/wix/react-native-calendars/blob/master/demo/assets/calendar.gif?raw=true'}/>
99
</div>
1010

1111
## API
@@ -190,11 +190,11 @@ Whether to disable all touch events for disabled days (can be override with 'dis
190190
Whether to disable all touch events for inactive days (can be override with 'disableTouchEvent' in 'markedDates')
191191
<span style={{color: 'grey'}}>boolean</span>
192192

193-
<br>
193+
<br/>
194194

195195
## Calendar Examples
196196

197-
<br>
197+
<br/>
198198

199199
#### Basic parameters
200200

@@ -260,8 +260,7 @@ Whether to disable all touch events for inactive days (can be override with 'dis
260260

261261
Dot marking
262262

263-
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking1.png?raw=true">
264-
263+
<img height={50} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking1.png?raw=true"/>
265264

266265
```javascript
267266
<Calendar
@@ -279,8 +278,7 @@ You can customize a dot color for each day independently.
279278

280279
Multi-Dot marking
281280

282-
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking4.png?raw=true">
283-
281+
<img height={50} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking4.png?raw=true"/>
284282

285283
Use `markingType={'multi-dot'}` if you want to display more than one dot. Both the `<Calendar/>` and `<CalendarList/>` support multiple dots by using `dots` array in `markedDates` prop.
286284
The property `color` is mandatory while `key` and `selectedColor` are optional. If key is omitted then the array index is used as key. If `selectedColor` is omitted then `color` will be used for selected dates.
@@ -301,11 +299,9 @@ const workout = {key: 'workout', color: 'green'};
301299

302300
Period marking
303301

304-
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking2.png?raw=true">
305-
306-
307-
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking3.png?raw=true">
302+
<img height={50} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking2.png?raw=true"/>
308303

304+
<img height={50} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking3.png?raw=true"/>
309305

310306
```javascript
311307
<Calendar
@@ -321,8 +317,7 @@ Period marking
321317

322318
Multi-period marking
323319

324-
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking6.png?raw=true">
325-
320+
<img height={50} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking6.png?raw=true"/>
326321

327322
**CAUTION**: This marking is only fully supported by the `<Calendar/>` component because it expands its height. Usage with `<CalendarList/>` might lead to overflow issues.
328323

@@ -350,8 +345,7 @@ Multi-period marking
350345

351346
Custom marking allows you to customize each marker with custom styles.
352347

353-
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking5.png?raw=true">
354-
348+
<img height={50} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/marking5.png?raw=true"/>
355349

356350
```javascript
357351
<Calendar
@@ -400,14 +394,13 @@ Custom marking allows you to customize each marker with custom styles.
400394
/>
401395
```
402396

403-
<img height=350 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/multi-marking.png?raw=true">
397+
<img height={350} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/multi-marking.png?raw=true"/>
404398

405399
Keep in mind that different marking types are not compatible. You can use just one marking style for a calendar.
406400

407401
#### Displaying data loading indicator
408402

409-
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/loader.png?raw=true">
410-
403+
<img height={50} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/loader.png?raw=true"/>
411404

412405
The loading indicator next to the month name will be displayed if `<Calendar/>` has `displayLoadingIndicator` prop and the `markedDates` collection does not have a value for every day of the month in question. When you load data for days, just set `[]` or special marking value to all days in `markedDates` collection.
413406

@@ -505,8 +498,7 @@ theme={{
505498
}}
506499
```
507500

508-
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/day-header-style.png?raw=true">
509-
501+
<img height={50} src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/assets/day-header-style.png?raw=true"/>
510502

511503
**Disclaimer**: Issues that arise because something breaks after using stylesheet override will not be supported. Use this option at your own risk.
512504

@@ -536,4 +528,3 @@ The `dayComponent` prop has to receive a RN component or a function that receive
536528
**Tip**: Don't forget to implement `shouldComponentUpdate()` for your custom day component to make the calendar perform better
537529

538530
If you implement an awesome day component please make a PR so that other people could use it :)
539-

0 commit comments

Comments
 (0)