react-native-calendars
react-native-calendars copied to clipboard
ExpandableCalendar error under React native 0.74
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
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' }) => { // ... };
@Inbal-Tish please help fix this problem,it is very easy
why no one fixes it?
you can refer to react-native-paper fix
https://github.com/callstack/react-native-paper/pull/4385/commits/6275a4e394c9416f3c35a3dfdddd81ab9ab948ed
+1
+1
in version 1.1305,very less issue has been fixed,too much problems are there,why no one care about that
Same here any fix?
@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!
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;
I have same issue
The issue still persists. Has anyone found a solution?
Still seeing this as well
Yeah me too..
Same here any fix?
so small issue,although it is ok in prod env,but it looks ugly,why no one care about that?
yeah, me too
PR open https://github.com/wix/react-native-calendars/pull/2480
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
