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

key cant be spread into jsx and defaultProps is deprecated (expo, react-compiler)

Open Fuzzyma opened this issue 10 months ago • 3 comments

I am not sure whats triggering this (probably react-compiler) but it tells me, that I shouldnt spread key into an jsx element and that defaultProps is deprecated. I patched it by hand and used patch-package to generate a diff:

diff --git a/node_modules/react-native-calendars/src/expandableCalendar/index.js b/node_modules/react-native-calendars/src/expandableCalendar/index.js
index fe7025d..470dbfd 100644
--- a/node_modules/react-native-calendars/src/expandableCalendar/index.js
+++ b/node_modules/react-native-calendars/src/expandableCalendar/index.js
@@ -52,6 +52,7 @@ const headerStyleOverride = {
  * @example: https://github.com/wix/react-native-calendars/blob/master/example/src/screens/expandableCalendar.js
  */
 const ExpandableCalendar = (props) => {
+    props = Object.assign({}, defaultProps, props);
     const { date, setDate, numberOfDays, timelineLeftInset } = useContext(Context);
     const { 
     /** ExpandableCalendar props */
@@ -410,7 +411,7 @@ const ExpandableCalendar = (props) => {
 };
 export default ExpandableCalendar;
 ExpandableCalendar.displayName = 'ExpandableCalendar';
-ExpandableCalendar.defaultProps = {
+const defaultProps = {
     horizontal: true,
     initialPosition: Positions.CLOSED,
     firstDay: 0,
diff --git a/node_modules/react-native-calendars/src/timeline-list/index.js b/node_modules/react-native-calendars/src/timeline-list/index.js
index 372370c..b7dfa29 100644
--- a/node_modules/react-native-calendars/src/timeline-list/index.js
+++ b/node_modules/react-native-calendars/src/timeline-list/index.js
@@ -81,7 +81,7 @@ const TimelineList = (props) => {
             return renderItem(_timelineProps, { item, index, isCurrent, isInitialPage, isToday: _isToday });
         }
         return (<>
-          <Timeline {..._timelineProps}/>
+          <Timeline {..._timelineProps} key={item} />
           {/* NOTE: Keeping this for easy debugging */}
           {/* <Text style={{position: 'absolute'}}>{item}</Text>*/}
         </>);

This issue body was partially generated by patch-package.

Fuzzyma avatar Feb 21 '25 09:02 Fuzzyma

I am also seeing this warning.

trizzyanguizzy avatar Jun 14 '25 01:06 trizzyanguizzy