Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wix/react-native-calendars into r…
Browse files Browse the repository at this point in the history
…elease
  • Loading branch information
Inbal-Tish committed Aug 23, 2021
2 parents 140fdd9 + e342c5f commit b9b07fa
Show file tree
Hide file tree
Showing 78 changed files with 2,537 additions and 1,708 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ module.exports = {
describe: true
},
extends: ['eslint:recommended'],
parser: 'babel-eslint',
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
experimentalObjectRestSpread: true,
jsx: true
},
sourceType: 'module'
},
plugins: ['react', 'react-native', 'jest'],
plugins: ['react', 'react-native', 'jest', '@typescript-eslint'],
rules: {
'react-native/no-inline-styles': 1,
'linebreak-style': ['error', 'unix'],
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,3 +702,20 @@
- TS - Fix build process (PR #1545).
- ExpandableCalendar - fix arrow press callbacks (PR #1489).
- README & ISSUE_TEMPLATE - edit.


## [1.1265.0] - 2021-8-23

## Changed
- Change import to require - solved "Cannot assign to read only property 'exports' of object '#<Object>'" (PR #1553).
- TS migration for all components.
- Upgrading to react-native 0.64.2.

## Added
- AgendaList - support offset scroll to section (PR #1526).
- AgendaList - allow passing 'onScrollToIndexFailed' (PR #1594).
- Day - support 'inactive' state and add 'disableAllTouchEventsForInactiveDays' prop (PR #1596).

## Fixed
- ExpandableCalendar - 'onDayPress' not called (PR #1584).
- Fixed issue with 'dateutils' export (PR #1548).
3 changes: 3 additions & 0 deletions _editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Windows files
[*.bat]
end_of_line = crlf
6 changes: 5 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false)

android {
ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion


compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -65,11 +68,12 @@ android {
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@

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

<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
2 changes: 0 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

</manifest>
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
Expand Down
7 changes: 4 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 19
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
supportLibVersion = "29.0.0"
RNNKotlinVersion = "1.3.72"
}
Expand All @@ -16,7 +17,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath("com.android.tools.build:gradle:4.1.0")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
3 changes: 3 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
android.useDeprecatedNdk=true
android.useAndroidX=true
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.75.1
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Mar 27 10:33:44 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ cd "$SAVED" >&-

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -130,6 +131,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`


# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Expand Down
19 changes: 4 additions & 15 deletions android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -57,7 +57,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -67,21 +67,9 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
Expand All @@ -93,8 +81,9 @@ set CMD_LINE_ARGS=%$

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
4 changes: 3 additions & 1 deletion example/.gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.pbxproj -text
# Windows files should use crlf line endings
# https://help.github.com/articles/dealing-with-line-endings/
*.bat text eol=crlf
2 changes: 1 addition & 1 deletion example/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false
inlineRequires: true
}
})
}
Expand Down
12 changes: 5 additions & 7 deletions example/src/screens/agenda.js → example/src/screens/agenda.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import React, {Component} from 'react';
import {Alert, StyleSheet, Text, View, TouchableOpacity} from 'react-native';
// @ts-expect-error
import {Agenda} from 'react-native-calendars';


const testIDs = require('../testIDs');

export default class AgendaScreen extends Component {
constructor(props) {
super(props);

this.state = {
items: {}
};
}
state = {
items: {}
};

render() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import _ from 'lodash';
import XDate from 'xdate';
import React, {useState, Fragment} from 'react';
import {StyleSheet, View, ScrollView, Text, TouchableOpacity, Switch} from 'react-native';
// @ts-expect-error
import {Calendar} from 'react-native-calendars';

const testIDs = require('../testIDs');
Expand All @@ -19,19 +18,6 @@ const CalendarsScreen = () => {
setSelected(day.dateString);
};

const getDisabledDates = (startDate, endDate, daysToDisable) => {
const disabledDates = {};
const start = XDate(startDate);
const end = XDate(endDate);

for (let m = XDate(start); m.diffDays(end) <= 0; m.addDays(1)) {
if (_.includes(daysToDisable, m.weekday())) {
disabledDates[m.toString('YYYY-MM-DD')] = {disabled: true};
}
}
return disabledDates;
};

const renderCalendarWithSelectableDate = () => {
return (
<Fragment>
Expand Down Expand Up @@ -185,7 +171,6 @@ const CalendarsScreen = () => {
<Calendar
current={'2012-05-16'}
minDate={'2012-05-01'}
disabledDaysIndexes={[0, 6]}
markingType={'period'}
markedDates={{
'2012-05-15': {marked: true, dotColor: '#50cebb'},
Expand All @@ -209,7 +194,12 @@ const CalendarsScreen = () => {
borderBottomRightRadius: 5
}
},
...getDisabledDates('2012-05-01', '2012-05-30', [0, 6])
'2012-05-30': {disabled: true, disableTouchEvent: true}
}}
disabledDaysIndexes={[0, 6]}
theme={{
textSectionTitleDisabledColor: 'grey',
textSectionTitleColor: '#00BBF2'
}}
/>
</Fragment>
Expand Down Expand Up @@ -257,7 +247,6 @@ const CalendarsScreen = () => {
<Text style={styles.text}>Custom calendar with custom marking type</Text>
<Calendar
style={styles.calendar}
onDayLongPress={this.onDayLongPress}
hideExtraDays
current={'2018-03-01'}
minDate={'2018-03-01'}
Expand Down Expand Up @@ -393,6 +382,27 @@ const CalendarsScreen = () => {
);
};

const renderCalendarWithInactiveDays = () => {
return (
<Fragment>
<Text style={styles.text}>Calendar with inactive days</Text>
<Calendar
style={styles.calendar}
disableAllTouchEventsForInactiveDays
current={INITIAL_DATE}
markedDates={{
'2020-02-10': {
inactive: true
},
'2020-02-11': {
inactive: true
}
}}
/>
</Fragment>
);
};

const renderMarkedDatesExamples = () => {
return (
<Fragment>
Expand All @@ -414,6 +424,7 @@ const CalendarsScreen = () => {
{renderCalendarWithMinAndMaxDates()}
{renderCalendarWithCustomDay()}
{renderCalendarWithCustomHeader()}
{renderCalendarWithInactiveDays()}
</Fragment>
);
};
Expand All @@ -432,14 +443,8 @@ const CalendarsScreen = () => {
);
};

const initialNumToRender = 100; // Workaround for Detox 18 migration bug

return (
<ScrollView
showsVerticalScrollIndicator={false}
testID={testIDs.calendars.CONTAINER}
initialNumToRender={initialNumToRender}
>
<ScrollView showsVerticalScrollIndicator={false} testID={testIDs.calendars.CONTAINER}>
{renderSwitch()}
{showMarkedDatesExamples && renderMarkedDatesExamples()}
{!showMarkedDatesExamples && renderExamples()}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, {useState} from 'react';
import {StyleSheet, Text, View} from 'react-native';
// @ts-expect-error
import {CalendarList} from 'react-native-calendars';


const testIDs = require('../testIDs');
const RANGE = 24;
const initialDate = '2020-06-10';
Expand Down
Loading

0 comments on commit b9b07fa

Please sign in to comment.