Skip to content

Commit 6bb7e62

Browse files
committed
Merge branch 'wix-master'
2 parents 281c9d6 + 0acaac6 commit 6bb7e62

File tree

92 files changed

+3982
-2214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+3982
-2214
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ module.exports = {
1010
describe: true
1111
},
1212
extends: ['eslint:recommended'],
13-
parser: 'babel-eslint',
13+
parser: '@typescript-eslint/parser',
1414
parserOptions: {
1515
ecmaFeatures: {
1616
experimentalObjectRestSpread: true,
1717
jsx: true
1818
},
1919
sourceType: 'module'
2020
},
21-
plugins: ['react', 'react-native', 'jest'],
21+
plugins: ['react', 'react-native', 'jest', '@typescript-eslint'],
2222
rules: {
2323
'react-native/no-inline-styles': 1,
2424
'linebreak-style': ['error', 'unix'],

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,9 @@ demo/
256256
# eslint-rules/
257257
scripts/
258258

259+
# Typescript
260+
# ignore the .ts files
261+
*.ts
262+
*.tsx
263+
# include the .d.ts files
264+
!*.d.ts

CHANGELOG.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,11 +675,73 @@
675675
### Changed
676676
- AgendaList - Remove arrow function from 'onScrollToIndexFailed' and omit 'context' passed to SectionList.
677677

678-
## [1.1263.0] - 2021-x-x
678+
## [1.1263.0] - 2021-6-3
679679

680680
## Changed
681681
- Files formatting (PR #1513).
682682
- ExpandableCalendar demo - improving 'renderItem' example.
683683

684684
## Fixed
685685
- Day - passed props for custom 'dayComponent'.
686+
- WeekCalendar - update marking on disabled day press.
687+
688+
## [1.1264.0] - 2021-6-27
689+
690+
## Added
691+
- WeekCalendar - adding presenter and unit tests (PR #1499).
692+
- CalendarContextProvider - adding presenter and unit tests (PR #1503).
693+
- Release snapshot versions (PR #1536 and PR #1538).
694+
- Typescript setup and DayBasic migration to TS (PR #1539).
695+
- Agenda - 'showClosingKnob' prop to use knob for closing the calendar (PR #1430).
696+
697+
## Changed
698+
- Updating Cocoapods version to 1.10.1.
699+
700+
## Fixed
701+
- Timeline - fix event height and top calculations (PR #1498).
702+
- TS - Fix build process (PR #1545).
703+
- ExpandableCalendar - fix arrow press callbacks (PR #1489).
704+
- README & ISSUE_TEMPLATE - edit.
705+
706+
707+
## [1.1265.0] - 2021-8-23
708+
709+
## Changed
710+
- Change import to require - solved "Cannot assign to read only property 'exports' of object '#<Object>'" (PR #1553).
711+
- TS migration for all Calendars components.
712+
- Upgrading to react-native 0.64.2.
713+
714+
## Added
715+
- AgendaList - support offset scroll to section (PR #1526).
716+
- AgendaList - allow passing 'onScrollToIndexFailed' (PR #1594).
717+
- Day - support 'inactive' state and add 'disableAllTouchEventsForInactiveDays' prop (PR #1596).
718+
719+
## Fixed
720+
- ExpandableCalendar - 'onDayPress' not called (PR #1584).
721+
- Fixed issue with 'dateutils' export (PR #1548).
722+
723+
## [1.1266.0] - 2021-8-24
724+
725+
## Changed
726+
- Disabling Detox e2e tests.
727+
728+
## [1.1267.0] - 2021-10-5
729+
730+
## Fixed
731+
- CalendarListItem - height issue (PR #1614).
732+
- README - links for typescript (PR #1611).
733+
- lodash - change imports to make it tree-shakeable (PR #1613).
734+
- ExpandableCalendar - 'today' button bug (PR #1627).
735+
- CalendarHeader - 'renderHeader' updates.
736+
- Calendar - 'customHeader' ref.
737+
- CalendarList - fix types.
738+
739+
## Added
740+
- Calendar - 'allowSelectionOutOfRange' prop (PR #1618).
741+
- AgendaList - 'scrollToNextEvent' prop (PR #1636).
742+
- Number localization (PR #1369).
743+
- TS types release.
744+
745+
## Changed
746+
- Use modern export keyword (PR #1615).
747+
- Remove global and move types to types.ts.

ISSUE_TEMPLATE.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Please make our job easier by filling this template out to completion. If you're
22

33
## Description
44

5-
1-2 sentences describing the problem you're having or the feature you'd like to request
5+
1-2 sentences describing the problem you're having or the feature you'd like to request.
66

77
## Expected Behavior
88

@@ -27,10 +27,14 @@ Please run these commands in the project folder and fill in their results:
2727

2828
Also specify:
2929

30-
1. Phone/emulator/simulator & version:
30+
1. Device/emulator/simulator & OS version:
3131

3232
## Reproducible Demo
3333

3434
Please provide a minimized reproducible demonstration of the problem you're reporting.
3535

3636
Issues that come with minimal repro's are resolved much more quickly than issues where a maintainer has to reproduce themselves.
37+
38+
## Screenshots
39+
40+
Screenshots or gifs of the issue and the suggested fix will help us move faster with the review process.

README.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ All parameters for components are optional. By default the month of current loca
3636

3737
Event handler callbacks are called with `calendar objects` like this:
3838

39-
```javasctipt
39+
```javascript
4040
{
4141
day: 1, // day of month (1-31)
4242
month: 1, // month of year (1-12)
@@ -46,7 +46,7 @@ Event handler callbacks are called with `calendar objects` like this:
4646
}
4747
```
4848

49-
Parameters that require date types accept `YYYY-MM-DD` formated `date-strings`, JavaScript date objects, `calendar objects` and `UTC timestamps`.
49+
Parameters that require date types accept `YYYY-MM-DD` formatted `date-strings`, JavaScript date objects, `calendar objects` and `UTC timestamps`.
5050

5151
Calendars can be localized by adding custom locales to `LocaleConfig` object:
5252

@@ -93,10 +93,10 @@ LocaleConfig.defaultLocale = 'fr';
9393
renderArrow={(direction) => (<Arrow/>)}
9494
// Do not show days of other months in month page. Default = false
9595
hideExtraDays={true}
96-
// If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out
96+
// If hideArrows = false and hideExtraDays = false do not switch month when tapping on greyed out
9797
// day from another month that is visible in calendar page. Default = false
9898
disableMonthChange={true}
99-
// If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
99+
// If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday
100100
firstDay={1}
101101
// Hide day names. Default = false
102102
hideDayNames={true}
@@ -112,7 +112,7 @@ LocaleConfig.defaultLocale = 'fr';
112112
disableArrowRight={true}
113113
// Disable all touch events for disabled days. can be override with disableTouchEvent in markedDates
114114
disableAllTouchEventsForDisabledDays={true}
115-
// Replace default month and year title with custom one. the function receive a date as parameter.
115+
// Replace default month and year title with custom one. the function receive a date as parameter
116116
renderHeader={(date) => {/*Return JSX*/}}
117117
// Enable the option to swipe between months. Default = false
118118
enableSwipeMonths={true}
@@ -151,20 +151,20 @@ Multi-Dot marking
151151
</kbd>
152152
<p></p>
153153

154-
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.
154+
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.
155155
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.
156156

157157
```javascript
158-
const vacation = {key:'vacation', color: 'red', selectedDotColor: 'blue'};
159-
const massage = {key:'massage', color: 'blue', selectedDotColor: 'blue'};
160-
const workout = {key:'workout', color: 'green'};
158+
const vacation = {key: 'vacation', color: 'red', selectedDotColor: 'blue'};
159+
const massage = {key: 'massage', color: 'blue', selectedDotColor: 'blue'};
160+
const workout = {key: 'workout', color: 'green'};
161161

162162
<Calendar
163+
markingType={'multi-dot'}
163164
markedDates={{
164165
'2017-10-25': {dots: [vacation, massage, workout], selected: true, selectedColor: 'red'},
165166
'2017-10-26': {dots: [massage, workout], disabled: true}
166167
}}
167-
markingType={'multi-dot'}
168168
/>
169169
```
170170

@@ -181,15 +181,13 @@ Period marking
181181

182182
```javascript
183183
<Calendar
184-
// Collection of dates that have to be colored in a special way. Default = {}
184+
markingType={'period'}
185185
markedDates={{
186186
'2012-05-20': {textColor: 'green'},
187187
'2012-05-22': {startingDay: true, color: 'green'},
188188
'2012-05-23': {selected: true, endingDay: true, color: 'green', textColor: 'gray'},
189189
'2012-05-04': {disabled: true, startingDay: true, color: 'green', endingDay: true}
190190
}}
191-
// Date marking style [simple/period/multi-dot/custom]. Default = 'simple'
192-
markingType={'period'}
193191
/>
194192
```
195193

@@ -204,6 +202,7 @@ Multi-period marking
204202

205203
```javascript
206204
<Calendar
205+
markingType='multi-period'
207206
markedDates={{
208207
'2017-12-14': {
209208
periods: [
@@ -220,8 +219,6 @@ Multi-period marking
220219
]
221220
}
222221
}}
223-
// Date marking style [simple/period/multi-dot/custom]. Default = 'simple'
224-
markingType='multi-period'
225222
/>
226223
```
227224

@@ -234,7 +231,6 @@ Custom marking allows you to customize each marker with custom styles.
234231

235232
```javascript
236233
<Calendar
237-
// Date marking style [simple/period/multi-dot/single]. Default = 'simple'
238234
markingType={'custom'}
239235
markedDates={{
240236
'2018-03-28': {
@@ -274,7 +270,7 @@ Custom marking allows you to customize each marker with custom styles.
274270
'2012-05-22': {color: '#70d7c7', textColor: 'white'},
275271
'2012-05-23': {color: '#70d7c7', textColor: 'white', marked: true, dotColor: 'white'},
276272
'2012-05-24': {color: '#70d7c7', textColor: 'white'},
277-
'2012-05-25': {endingDay: true, color: '#50cebb', textColor: 'white'},
273+
'2012-05-25': {endingDay: true, color: '#50cebb', textColor: 'white'}
278274
}}
279275
/>
280276
```
@@ -336,25 +332,25 @@ The loading indicator next to the month name will be displayed if `<Calendar/>`
336332
#### Customize days titles with disabled styling
337333
```javascript
338334
<Calendar
339-
theme={{
340-
textSectionTitleDisabledColor: '#d9e1e8'
341-
}}
342-
disabledDaysIndexes={[0, 6]}
343-
markedDates={{
335+
theme={{
336+
textSectionTitleDisabledColor: '#d9e1e8'
337+
}}
338+
markedDates={{
344339
...this.getDisabledDates('2012-05-01', '2012-05-30', [0, 6])
345-
}}
340+
}}
341+
disabledDaysIndexes={[0, 6]}
346342
/>
347343
```
348344

349345
#### Advanced styling
350346

351-
If you want to have complete control over the calendar styles you can do it by overriding default `style.js` files. For example, if you want to override `<CalendarHeader/>` style first you have to find stylesheet id for this file:
347+
If you want to have complete control over the calendar styles you can do it by overriding default `style.ts` files. For example, if you want to override `<CalendarHeader/>` style first you have to find stylesheet id for this file:
352348

353-
https://github.com/wix/react-native-calendars/blob/master/src/calendar/header/style.js#L4
349+
https://github.com/wix/react-native-calendars/blob/master/src/calendar/header/style.ts#L60
354350

355351
In this case it is `stylesheet.calendar.header`. Next you can add overriding stylesheet to your theme with this id.
356352

357-
https://github.com/wix/react-native-calendars/blob/master/example/src/screens/calendars.js#L56
353+
https://github.com/wix/react-native-calendars/blob/master/example/src/screens/calendars.tsx#L142
358354

359355
```javascript
360356
theme={{
@@ -493,9 +489,9 @@ An advanced `Agenda` component that can display interactive listings for calenda
493489
// Callback that fires when the calendar is opened or closed
494490
onCalendarToggled={(calendarOpened) => {console.log(calendarOpened)}}
495491
// Callback that gets called on day press
496-
onDayPress={(day)=>{console.log('day pressed')}}
492+
onDayPress={(day) => {console.log('day pressed')}}
497493
// Callback that gets called when day changes while scrolling agenda list
498-
onDayChange={(day)=>{console.log('day changed')}}
494+
onDayChange={(day) => {console.log('day changed')}}
499495
// Initially selected day
500496
selected={'2012-05-16'}
501497
// Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined
@@ -508,7 +504,7 @@ An advanced `Agenda` component that can display interactive listings for calenda
508504
futureScrollRange={50}
509505
// Specify how each item should be rendered in agenda
510506
renderItem={(item, firstItemInDay) => {return (<View />);}}
511-
// Specify how each date should be rendered. day can be undefined if the item is not first in that day.
507+
// Specify how each date should be rendered. day can be undefined if the item is not first in that day
512508
renderDay={(day, item) => {return (<View />);}}
513509
// Specify how empty date content with no items should be rendered
514510
renderEmptyDate={() => {return (<View />);}}
@@ -520,6 +516,8 @@ An advanced `Agenda` component that can display interactive listings for calenda
520516
rowHasChanged={(r1, r2) => {return r1.text !== r2.text}}
521517
// Hide knob button. Default = false
522518
hideKnob={true}
519+
// 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
520+
showClosingKnob={false}
523521
// By default, agenda dates are marked if they have at least one item, but you can override this if needed
524522
markedDates={{
525523
'2012-05-16': {selected: true, marked: true},
@@ -528,11 +526,11 @@ An advanced `Agenda` component that can display interactive listings for calenda
528526
}}
529527
// If disabledByDefault={true} dates flagged as not disabled will be enabled. Default = false
530528
disabledByDefault={true}
531-
// If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make sure to also set the refreshing prop correctly.
529+
// If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make sure to also set the refreshing prop correctly
532530
onRefresh={() => console.log('refreshing...')}
533531
// Set this true while waiting for new data from a refresh
534532
refreshing={false}
535-
// Add a custom RefreshControl component, used to provide pull-to-refresh functionality for the ScrollView.
533+
// Add a custom RefreshControl component, used to provide pull-to-refresh functionality for the ScrollView
536534
refreshControl={null}
537535
// Agenda theme
538536
theme={{
@@ -556,6 +554,8 @@ See also the list of [contributors](https://github.com/wix/react-native-calendar
556554

557555
## Contributing
558556

559-
Pull requests are most welcome!
557+
Pull requests are most welcome!
560558
Please `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. Screenshots and gifs are very helpful.
559+
Don't forget to add a **title** and a **description** that explain the issue you're trying to solve and your suggested solution.
560+
Screenshots and gifs are VERY helpful.
561+
Please do NOT format the files as we are trying to keep a unified syntax and the reviewing process fast and simple.

_editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Windows files
2+
[*.bat]
3+
end_of_line = crlf

android/app/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ def jscFlavor = 'org.webkit:android-jsc:+'
1616
def enableHermes = project.ext.react.get("enableHermes", false)
1717

1818
android {
19+
ndkVersion rootProject.ext.ndkVersion
20+
1921
compileSdkVersion rootProject.ext.compileSdkVersion
2022
buildToolsVersion rootProject.ext.buildToolsVersion
2123

24+
2225
compileOptions {
2326
sourceCompatibility JavaVersion.VERSION_1_8
2427
targetCompatibility JavaVersion.VERSION_1_8
@@ -65,11 +68,12 @@ android {
6568
variant.outputs.each { output ->
6669
// For each separate APK per architecture, set a unique version code as described here:
6770
// https://developer.android.com/studio/build/configure-apk-splits.html
71+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
6872
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
6973
def abi = output.getFilter(OutputFile.ABI)
7074
if (abi != null) { // null for the universal-debug, universal-release variants
7175
output.versionCodeOverride =
72-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
76+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
7377
}
7478
}
7579
}

android/app/src/debug/AndroidManifest.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
66

7-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
7+
<application
8+
android:usesCleartextTraffic="true"
9+
tools:targetApi="28"
10+
tools:ignore="GoogleAppIndexingWarning">
11+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
12+
</application>
813
</manifest>

android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,5 @@
2121
<category android:name="android.intent.category.LAUNCHER" />
2222
</intent-filter>
2323
</activity>
24-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
2524
</application>
26-
2725
</manifest>

android/app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
4+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
55
<!-- Customize your theme here. -->
66
<item name="android:textColor">#000000</item>
77
</style>

0 commit comments

Comments
 (0)