Skip to content

react-native-calendar-picker ERROR TypeError: Cannot read property 'style' of undefined, js engine: hermes #408

@Yesunerdene

Description

@Yesunerdene

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-calendar-picker@6.1.5 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-calendar-picker/CalendarPicker/DaysGridView.js b/node_modules/react-native-calendar-picker/CalendarPicker/DaysGridView.js
index 738a335..d9e6a6a 100644
--- a/node_modules/react-native-calendar-picker/CalendarPicker/DaysGridView.js
+++ b/node_modules/react-native-calendar-picker/CalendarPicker/DaysGridView.js
@@ -3,6 +3,7 @@ import uuid from 'uuid/v4';
 import {
   View,
   Text,
+  ViewStyle,
   ViewPropTypes as RNViewPropTypes,
 } from 'react-native';
 import PropTypes from 'prop-types';
@@ -11,7 +12,8 @@ import EmptyDay from './EmptyDay';
 import { Utils } from './Utils';
 import moment from 'moment';
 
-const ViewPropTypes = RNViewPropTypes || View.propTypes;
+// const ViewPropTypes = RNViewPropTypes || View.propTypes;
+const ViewPropTypes = ViewStyle || RNViewPropTypes || View.propTypes;
 
 export default function DaysGridView(props) {
   const {
@@ -183,11 +185,11 @@ DaysGridView.propTypes = {
   year: PropTypes.number.isRequired,
   onPressDay: PropTypes.func,
   startFromMonday: PropTypes.bool,
-  selectedDayStyle: ViewPropTypes.style,
-  selectedRangeStartStyle: ViewPropTypes.style,
-  selectedRangeStyle: ViewPropTypes.style,
-  selectedRangeEndStyle: ViewPropTypes.style,
-  todayTextStyle: Text.propTypes.style,
+  selectedDayStyle: ViewStyle,
+  selectedRangeStartStyle: ViewStyle,
+  selectedRangeStyle: ViewStyle,
+  selectedRangeEndStyle: ViewStyle,
+  todayTextStyle: PropTypes.style,
   customDatesStyles: PropTypes.oneOfType([
     PropTypes.func,
     PropTypes.arrayOf(PropTypes.shape({
@@ -196,13 +198,13 @@ DaysGridView.propTypes = {
         PropTypes.instanceOf(Date),
         PropTypes.instanceOf(moment)
       ]),
-      containerStyle: ViewPropTypes.style,
-      style: ViewPropTypes.style,
-      textStyle: Text.propTypes.style,
+      containerStyle: ViewStyle,
+      style: ViewStyle,
+      textStyle: PropTypes.style,
     })),
   ]),
   disabledDates: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
-  disabledDatesTextStyle: Text.propTypes.style,
+  disabledDatesTextStyle: PropTypes.style,
   minRangeDuration: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),
   maxRangeDuration: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),
 };
diff --git a/node_modules/react-native-calendar-picker/CalendarPicker/MonthsHeader.js b/node_modules/react-native-calendar-picker/CalendarPicker/MonthsHeader.js
index 0e3fad0..8213364 100644
--- a/node_modules/react-native-calendar-picker/CalendarPicker/MonthsHeader.js
+++ b/node_modules/react-native-calendar-picker/CalendarPicker/MonthsHeader.js
@@ -30,6 +30,6 @@ export default function MonthsHeader(props) {
 
 MonthsHeader.propTypes = {
   styles: PropTypes.shape(),
-  textStyle: Text.propTypes.style,
+  textStyle: PropTypes.style,
   title: PropTypes.string
 };
diff --git a/node_modules/react-native-calendar-picker/CalendarPicker/YearsHeader.js b/node_modules/react-native-calendar-picker/CalendarPicker/YearsHeader.js
index f80ecc9..30e3eaa 100644
--- a/node_modules/react-native-calendar-picker/CalendarPicker/YearsHeader.js
+++ b/node_modules/react-native-calendar-picker/CalendarPicker/YearsHeader.js
@@ -62,7 +62,7 @@ export default function YearsHeader(props) {
 
 YearsHeader.propTypes = {
   styles: PropTypes.shape(),
-  textStyle: Text.propTypes.style,
+  textStyle: PropTypes.style,
   title: PropTypes.string,
   onYearViewNext: PropTypes.func,
   onYearViewPrevious: PropTypes.func,

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions