stephy / CalendarPicker

CalendarPicker Component for React Native
787 stars 369 forks source link

Warning: Invalid argument supplied to oneOfType. Expected an array of check functions, but received undefined at index 0 #253

Closed MaliahRajan closed 3 years ago

MaliahRajan commented 3 years ago

Version : "react-native-calendar-picker": "7.0.2"

Error : node_modules\react-native-calendar-picker\CalendarPicker\DaysGridView.js+254

DaysGridView.propTypes = { styles: PropTypes.shape(), month: PropTypes.number.isRequired, year: PropTypes.number.isRequired, onPressDay: PropTypes.func, startFromMonday: PropTypes.bool, **selectedDayStyle: ViewPropTypes.style,** selectedRangeStartStyle: ViewPropTypes.style, selectedRangeStyle: ViewPropTypes.style, selectedRangeEndStyle: ViewPropTypes.style, todayTextStyle: Text.propTypes.style, customDatesStyles: PropTypes.oneOfType([ PropTypes.func, PropTypes.arrayOf(PropTypes.shape({ date: PropTypes.oneOfType([ PropTypes.string, PropTypes.instanceOf(Date), PropTypes.instanceOf(moment) ]), containerStyle: ViewPropTypes.style, style: ViewPropTypes.style, textStyle: Text.propTypes.style, })), ]), disabledDates: PropTypes.oneOfType([PropTypes.array, PropTypes.func]), disabledDatesTextStyle: Text.propTypes.style, minRangeDuration: PropTypes.oneOfType([PropTypes.array, PropTypes.number]), maxRangeDuration: PropTypes.oneOfType([PropTypes.array, PropTypes.number]), };

Margaferrez commented 3 years ago

That was introduced by a PR I did to fix a previous warning, I'm preparing a fix for that.

JhonMyHW commented 3 years ago

Yep, I arrived here seeking for this too. Thanks Marga!

rubend151 commented 3 years ago

m preparing a fix for that.

Did you fix that? I'm receiving the same error

Margaferrez commented 3 years ago

I fixed it in that PR: https://github.com/stephy/CalendarPicker/pull/254 , it haven't been merged yet

peacechen commented 3 years ago

Thanks @Margaferrez for the PR. I commented on it and was waiting for a response, but you had already adjusted it. There was a minor issue that I fixed in the PR. It is published as 7.0.4.

MaliahRajan commented 3 years ago

Still same error after 7.0.4

[Fri Dec 11 2020 12:44:28.691]  ERROR    Warning: Invalid argument supplied to oneOfType. Expected an array of check functions, but received undefined at index 0.
[Fri Dec 11 2020 12:44:28.698]  ERROR    Warning: Invalid argument supplied to oneOfType. Expected an array of check functions, but received undefined at index 0.
[Fri Dec 11 2020 12:44:28.700]  ERROR    Warning: Invalid argument supplied to oneOfType. Expected an array of check functions, but received undefined at index 0.
[Fri Dec 11 2020 12:44:28.702]  ERROR    Warning: Invalid argument supplied to oneOfType. Expected an array of check functions, but received undefined at index 0.
MaliahRajan commented 3 years ago

Changes in CalendarPicker/DaysGridView.js was not merged. Adding patch solved for now. Hope it will be added to repo.


From 1b37cd4db0435a6ff3b7298e594126f8be40677f Mon Sep 17 00:00:00 2001
From: Marga <margaferrez@gmail.com>
Date: Thu, 12 Nov 2020 16:52:01 +0100
Subject: [PATCH] initialize selected...Style variables and remove the
 undefined type option in the proptypes

---
 CalendarPicker/DaysGridView.js | 8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/node_modules/react-native-calendar-picker/CalendarPicker/DaysGridView.js b/node_modules/react-native-calendar-picker/CalendarPicker/DaysGridView.js
index 4589a15..234e488 100644
--- a/node_modules/react-native-calendar-picker/CalendarPicker/DaysGridView.js
+++ b/node_modules/react-native-calendar-picker/CalendarPicker/DaysGridView.js
@@ -251,10 +251,10 @@ DaysGridView.propTypes = {
   year: PropTypes.number.isRequired,
   onPressDay: PropTypes.func,
   startFromMonday: PropTypes.bool,
-  selectedDayStyle: PropTypes.oneOfType([PropTypes.undefined, ViewPropTypes.style]),
-  selectedRangeStartStyle: PropTypes.oneOfType([PropTypes.undefined, ViewPropTypes.style]),
-  selectedRangeStyle: PropTypes.oneOfType([PropTypes.undefined, ViewPropTypes.style]),
-  selectedRangeEndStyle: PropTypes.oneOfType([PropTypes.undefined, ViewPropTypes.style]),
+  selectedDayStyle: ViewPropTypes,
+  selectedRangeStartStyle: ViewPropTypes,
+  selectedRangeStyle: ViewPropTypes,
+  selectedRangeEndStyle: ViewPropTypes,
   todayTextStyle: Text.propTypes.style,
   selectedDayTextStyle: Text.propTypes.style,
   customDatesStyles: PropTypes.oneOfType([
peacechen commented 3 years ago

Thanks for testing and reporting. I will publish 7.0.5 shortly.

Your PR had a duplicate key that was flagged by the linter. Is the Git hook running on your system? It should lint on every commit.

nehalahmed929 commented 3 years ago

hi , i have same issue. could you please specify the version without this warning? or if i use the latest version can this warning create any issue in production?

peacechen commented 3 years ago

Does 7.0.5 work properly for you @nehalahmed929 ?

peacechen commented 3 years ago

Closing due to inactivity. If this is still a problem, please re-open or create a new issue.

rubend151 commented 3 years ago

I installed version 7.0.5 but I keep receiving the same warnings

peacechen commented 3 years ago

Please try the latest version 7.0.8

rsarv3006 commented 3 years ago

Good Morning, I am receiving the same error message using version 7.0.9.

OS: Linux npm version: 6.14.10 expo-cli: 4.0.12 iOS version: 14.3

Thank you!