wix / react-native-calendars

React Native Calendar Components 🗓️ 📆
MIT License
9.59k stars 2.96k forks source link

Fix for "Cannot read property 'style' of undefined" #2553

Open ore-codes opened 1 week ago

ore-codes commented 1 week ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-calendars@1.22.0 for the project I'm working on.

After upgrading to Expo SDK 52 with Bridgeless mode. All the calendars were broken

Warning: TypeError: Cannot read property 'style' of undefined

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-calendars/src/agenda/index.js b/node_modules/react-native-calendars/src/agenda/index.js
index 8451908..3aad17a 100644
--- a/node_modules/react-native-calendars/src/agenda/index.js
+++ b/node_modules/react-native-calendars/src/agenda/index.js
@@ -28,7 +28,7 @@ export default class AgendaView extends Component {
     theme: PropTypes.object,

     // agenda container style
-    style: viewPropTypes.style,
+    style: PropTypes.style,

     // the list of items that have to be displayed in agenda. If you want to render item as empty date
     // the value of date key has to be an empty array []. If there exists no value for date key it is
diff --git a/node_modules/react-native-calendars/src/calendar/index.js b/node_modules/react-native-calendars/src/calendar/index.js
index 61b7a21..a2ead8d 100644
--- a/node_modules/react-native-calendars/src/calendar/index.js
+++ b/node_modules/react-native-calendars/src/calendar/index.js
@@ -30,7 +30,7 @@ class Calendar extends Component {
     markedDates: PropTypes.object,

     // Specify style for calendar container element. Default = {}
-    style: viewPropTypes.style,
+    style: PropTypes.style,
     // Initially visible month. Default = Date()
     current: PropTypes.any,
     // Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined

This issue body was partially generated by patch-package.