react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

ExpandableCalendar error under React native 0.74

Open zkteco-home opened this issue 1 year ago • 19 comments

today i upgraded my app to react native 0.74 and i got the following error:

ERROR Warning: ExpandableCalendar: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

This warning message indicates that your code is using a deprecated way of setting default values for props in React functional components

### Tasks
### Tasks

zkteco-home avatar Apr 23 '24 22:04 zkteco-home

JavaScript // Before (using defaultProps) const MyComponent = ({ prop1, prop2 }) => { prop1 = prop1 || 'default value 1'; prop2 = prop2 || 'default value 2'; // ... };

MyComponent.defaultProps = { prop1: 'default value 1', prop2: 'default value 2', };

// After (using JavaScript default parameters) const MyComponent = ({ prop1 = 'default value 1', prop2 = 'default value 2' }) => { // ... };

zkteco-home avatar Apr 23 '24 22:04 zkteco-home

@Inbal-Tish please help fix this problem,it is very easy

zkteco-home avatar Apr 24 '24 13:04 zkteco-home

image

zkteco-home avatar Apr 24 '24 17:04 zkteco-home

why no one fixes it?

zkteco-home avatar Apr 26 '24 12:04 zkteco-home

you can refer to react-native-paper fix
https://github.com/callstack/react-native-paper/pull/4385/commits/6275a4e394c9416f3c35a3dfdddd81ab9ab948ed

zkteco-home avatar Apr 26 '24 14:04 zkteco-home

+1

henry-north-loop avatar May 09 '24 14:05 henry-north-loop

+1

tsuyoshily avatar May 15 '24 13:05 tsuyoshily

in version 1.1305,very less issue has been fixed,too much problems are there,why no one care about that

zkteco-home avatar May 15 '24 19:05 zkteco-home

image

Same here any fix?

Kiran178 avatar May 28 '24 09:05 Kiran178

@zkteco-home , same error message, so the error is in defaultProps in ExpandableCalendar? since there is no new commit, how to avoid the error message locally? thanks!

saaspeter avatar Jul 11 '24 15:07 saaspeter

diff --git a/node_modules/react-native-calendars/src/expandableCalendar/index.js b/node_modules/react-native-calendars/src/expandableCalendar/index.js
index 4fb12b0..cfaad3f 100644
--- a/node_modules/react-native-calendars/src/expandableCalendar/index.js
+++ b/node_modules/react-native-calendars/src/expandableCalendar/index.js
@@ -409,15 +409,4 @@ const ExpandableCalendar = (props) => {
 };
 export default ExpandableCalendar;
 ExpandableCalendar.displayName = 'ExpandableCalendar';
-ExpandableCalendar.defaultProps = {
-    horizontal: true,
-    initialPosition: Positions.CLOSED,
-    firstDay: 0,
-    leftArrowImageSource: LEFT_ARROW,
-    rightArrowImageSource: RIGHT_ARROW,
-    allowShadow: true,
-    openThreshold: PAN_GESTURE_THRESHOLD,
-    closeThreshold: PAN_GESTURE_THRESHOLD,
-    closeOnDayPress: true
-};
 ExpandableCalendar.positions = Positions;

shuo-hiwintech avatar Jul 22 '24 09:07 shuo-hiwintech

I have same issue

komirellipavan avatar Jul 23 '24 03:07 komirellipavan

The issue still persists. Has anyone found a solution?

adarshiremath avatar Aug 08 '24 01:08 adarshiremath

Still seeing this as well

oogunjob avatar Aug 31 '24 21:08 oogunjob

Yeah me too..

fexxdev avatar Sep 02 '24 10:09 fexxdev

Same here any fix?

teracityyazilim avatar Sep 19 '24 14:09 teracityyazilim

so small issue,although it is ok in prod env,but it looks ugly,why no one care about that?

zkteco-home avatar Sep 20 '24 16:09 zkteco-home

yeah, me too

huhu415 avatar Oct 16 '24 12:10 huhu415

PR open https://github.com/wix/react-native-calendars/pull/2480

edgarroman avatar Oct 19 '24 20:10 edgarroman

Maybe someone doesn't want add a patch for this. I just add a simple temporary fix to avoid this warning:

// @ts-ignore fix for defaultProps warning: https://github.com/wix/react-native-calendars/issues/2455
ExpandableCalendar.defaultProps = undefined

debugtheworldbot avatar Oct 21 '24 11:10 debugtheworldbot