@@ -3,7 +3,7 @@ import {StyleSheet, View, ScrollView, Text, TouchableOpacity} from 'react-native
3
3
import { Calendar , CalendarUtils } from 'react-native-calendars' ;
4
4
import testIDs from '../testIDs' ;
5
5
6
- const INITIAL_DATE = '2022-07 -06' ;
6
+ const INITIAL_DATE = '2024-11 -06' ;
7
7
8
8
const CalendarScreen = ( ) => {
9
9
const [ selected , setSelected ] = useState ( INITIAL_DATE ) ;
@@ -37,7 +37,7 @@ const CalendarScreen = () => {
37
37
const renderCalendarWithSelectableDate = ( ) => {
38
38
return (
39
39
< Fragment >
40
- < Text style = { styles . text } > Calendar with selectable date</ Text >
40
+ < Text style = { styles . text } > Selectable date</ Text >
41
41
< Calendar
42
42
testID = { testIDs . calendars . FIRST }
43
43
enableSwipeMonths
@@ -50,19 +50,19 @@ const CalendarScreen = () => {
50
50
) ;
51
51
} ;
52
52
53
- const renderCalendarWithWeekNumbers = ( ) => {
53
+ const renderCalendarWithWeekNumbersAndSpinner = ( ) => {
54
54
return (
55
55
< Fragment >
56
- < Text style = { styles . text } > Calendar with week numbers </ Text >
57
- < Calendar style = { styles . calendar } hideExtraDays showWeekNumbers />
56
+ < Text style = { styles . text } > Week numbers and spinner </ Text >
57
+ < Calendar style = { styles . calendar } hideExtraDays showWeekNumbers displayLoadingIndicator />
58
58
</ Fragment >
59
59
) ;
60
60
} ;
61
61
62
62
const renderCalendarWithMinAndMaxDates = ( ) => {
63
63
return (
64
64
< Fragment >
65
- < Text style = { styles . text } > Calendar with min and max dates</ Text >
65
+ < Text style = { styles . text } > Min and max dates</ Text >
66
66
< Calendar
67
67
style = { styles . calendar }
68
68
hideExtraDays
@@ -78,7 +78,7 @@ const CalendarScreen = () => {
78
78
const renderCalendarWithMarkedDatesAndHiddenArrows = ( ) => {
79
79
return (
80
80
< Fragment >
81
- < Text style = { styles . text } > Calendar with marked dates and hidden arrows</ Text >
81
+ < Text style = { styles . text } > Marked dates and hidden arrows</ Text >
82
82
< Calendar
83
83
style = { styles . calendar }
84
84
current = { INITIAL_DATE }
@@ -92,7 +92,6 @@ const CalendarScreen = () => {
92
92
[ getDate ( 10 ) ] : { disabled : true , activeOpacity : 0 , disableTouchEvent : false }
93
93
} }
94
94
hideArrows = { true }
95
- // disabledByDefault={true}
96
95
/>
97
96
</ Fragment >
98
97
) ;
@@ -101,7 +100,7 @@ const CalendarScreen = () => {
101
100
const renderCalendarWithMultiDotMarking = ( ) => {
102
101
return (
103
102
< Fragment >
104
- < Text style = { styles . text } > Calendar with multi -dot marking</ Text >
103
+ < Text style = { styles . text } > Multi -dot marking</ Text >
105
104
< Calendar
106
105
style = { styles . calendar }
107
106
current = { INITIAL_DATE }
@@ -127,20 +126,19 @@ const CalendarScreen = () => {
127
126
) ;
128
127
} ;
129
128
130
- const renderCalendarWithPeriodMarkingAndSpinner = ( ) => {
129
+ const renderCalendarWithThemeAndDisabledDays = ( ) => {
131
130
return (
132
131
< Fragment >
133
- < Text style = { styles . text } > Calendar with period marking and spinner </ Text >
132
+ < Text style = { styles . text } > Custom theme and disabled Wednesdays </ Text >
134
133
< Calendar
135
134
// style={styles.calendar}
136
135
current = { INITIAL_DATE }
137
136
minDate = { getDate ( - 5 ) }
138
137
displayLoadingIndicator
139
- markingType = { 'period' }
140
138
theme = { {
141
139
calendarBackground : '#333248' ,
142
140
textSectionTitleColor : 'white' ,
143
- textSectionTitleDisabledColor : 'gray ' ,
141
+ textSectionTitleDisabledColor : 'pink ' ,
144
142
dayTextColor : 'red' ,
145
143
todayTextColor : 'white' ,
146
144
selectedDayTextColor : 'white' ,
@@ -162,6 +160,7 @@ const CalendarScreen = () => {
162
160
}
163
161
}
164
162
} }
163
+ markingType = { 'period' }
165
164
markedDates = { {
166
165
[ getDate ( - 2 ) ] : { disabled : true } ,
167
166
[ getDate ( 1 ) ] : { textColor : 'pink' } ,
@@ -173,6 +172,11 @@ const CalendarScreen = () => {
173
172
[ getDate ( 26 ) ] : { color : 'gray' } ,
174
173
[ getDate ( 27 ) ] : { endingDay : true , color : 'gray' }
175
174
} }
175
+ firstDay = { 1 }
176
+ disabledDaysIndexes = { [ 1 ] }
177
+ disabledByWeekDays = { [ 1 ] }
178
+ disableAllTouchEventsForDisabledDays
179
+ onDayPress = { ( day ) => console . warn ( `${ day . dateString } pressed` ) }
176
180
/>
177
181
</ Fragment >
178
182
) ;
@@ -181,7 +185,7 @@ const CalendarScreen = () => {
181
185
const renderCalendarWithPeriodMarkingAndDotMarking = ( ) => {
182
186
return (
183
187
< Fragment >
184
- < Text style = { styles . text } > Calendar with period marking and dot marking</ Text >
188
+ < Text style = { styles . text } > Marking and dot marking</ Text >
185
189
< Calendar
186
190
current = { INITIAL_DATE }
187
191
minDate = { getDate ( - 14 ) }
@@ -198,7 +202,7 @@ const CalendarScreen = () => {
198
202
}
199
203
} ,
200
204
[ getDate ( 11 ) ] : { color : '#70d7c7' , textColor : 'white' , marked : true , dotColor : 'white' } ,
201
- [ getDate ( 12 ) ] : { color : '#70d7c7' , inactive : true } ,
205
+ [ getDate ( 12 ) ] : { color : '#70d7c7' , inactive : true , marked : true } ,
202
206
[ getDate ( 13 ) ] : {
203
207
endingDay : true ,
204
208
color : '#50cebb' ,
@@ -211,10 +215,10 @@ const CalendarScreen = () => {
211
215
} ,
212
216
[ getDate ( 25 ) ] : { inactive : true , disableTouchEvent : true }
213
217
} }
214
- disabledDaysIndexes = { [ 0 , 6 ] }
215
218
theme = { {
216
219
textInactiveColor : '#a68a9f' ,
217
- textSectionTitleDisabledColor : 'grey' ,
220
+ inactiveDotColor : '#a68a9f'
221
+ , textSectionTitleDisabledColor : 'grey' ,
218
222
textSectionTitleColor : '#319e8e' ,
219
223
arrowColor : '#319e8e'
220
224
} }
@@ -227,7 +231,7 @@ const CalendarScreen = () => {
227
231
const renderCalendarWithMultiPeriodMarking = ( ) => {
228
232
return (
229
233
< Fragment >
230
- < Text style = { styles . text } > Calendar with multi -period marking</ Text >
234
+ < Text style = { styles . text } > Multi -period marking</ Text >
231
235
< Calendar
232
236
style = { styles . calendar }
233
237
current = { INITIAL_DATE }
@@ -262,7 +266,7 @@ const CalendarScreen = () => {
262
266
const renderCalendarWithCustomMarkingType = ( ) => {
263
267
return (
264
268
< Fragment >
265
- < Text style = { styles . text } > Custom calendar with custom marking type</ Text >
269
+ < Text style = { styles . text } > Custom marking type</ Text >
266
270
< Calendar
267
271
style = { styles . calendar }
268
272
hideExtraDays
@@ -360,7 +364,7 @@ const CalendarScreen = () => {
360
364
const renderCalendarWithCustomDay = ( ) => {
361
365
return (
362
366
< Fragment >
363
- < Text style = { styles . text } > Calendar with custom day component</ Text >
367
+ < Text style = { styles . text } > Custom day component</ Text >
364
368
< Calendar
365
369
style = { [ styles . calendar , styles . customCalendar ] }
366
370
dayComponent = { ( { date, state} ) => {
@@ -416,7 +420,7 @@ const CalendarScreen = () => {
416
420
417
421
return (
418
422
< Fragment >
419
- < Text style = { styles . text } > Calendar with custom header title</ Text >
423
+ < Text style = { styles . text } > Custom header title</ Text >
420
424
< Calendar
421
425
style = { styles . calendar }
422
426
customHeaderTitle = { CustomHeaderTitle }
@@ -464,7 +468,7 @@ const CalendarScreen = () => {
464
468
465
469
return (
466
470
< Fragment >
467
- < Text style = { styles . text } > Calendar with custom header component</ Text >
471
+ < Text style = { styles . text } > Custom header component</ Text >
468
472
< Calendar
469
473
initialDate = { INITIAL_DATE }
470
474
testID = { testIDs . calendars . LAST }
@@ -478,7 +482,7 @@ const CalendarScreen = () => {
478
482
const renderCalendarWithInactiveDays = ( ) => {
479
483
return (
480
484
< Fragment >
481
- < Text style = { styles . text } > Calendar with inactive days</ Text >
485
+ < Text style = { styles . text } > Inactive days</ Text >
482
486
< Calendar
483
487
style = { styles . calendar }
484
488
disableAllTouchEventsForInactiveDays
@@ -500,15 +504,15 @@ const CalendarScreen = () => {
500
504
return (
501
505
< Fragment >
502
506
{ renderCalendarWithSelectableDate ( ) }
503
- { renderCalendarWithWeekNumbers ( ) }
507
+ { renderCalendarWithWeekNumbersAndSpinner ( ) }
504
508
{ renderCalendarWithMinAndMaxDates ( ) }
505
509
{ renderCalendarWithCustomDay ( ) }
506
510
{ renderCalendarWithInactiveDays ( ) }
507
511
{ renderCalendarWithCustomHeaderTitle ( ) }
508
512
{ renderCalendarWithCustomHeader ( ) }
509
513
{ renderCalendarWithMarkedDatesAndHiddenArrows ( ) }
510
514
{ renderCalendarWithMultiDotMarking ( ) }
511
- { renderCalendarWithPeriodMarkingAndSpinner ( ) }
515
+ { renderCalendarWithThemeAndDisabledDays ( ) }
512
516
{ renderCalendarWithPeriodMarkingAndDotMarking ( ) }
513
517
{ renderCalendarWithMultiPeriodMarking ( ) }
514
518
{ renderCalendarWithCustomMarkingType ( ) }
0 commit comments