Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Fuzzyma opened this issue Feb 21, 2025 · 0 comments

Comments

@Fuzzyma
Copy link

Fuzzyma commented Feb 21, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant