Skip to content

propTypes issue with react-native 0.75.1 #284

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

Open
1pinkmann opened this issue Apr 24, 2025 · 1 comment
Open

propTypes issue with react-native 0.75.1 #284

1pinkmann opened this issue Apr 24, 2025 · 1 comment

Comments

@1pinkmann
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

react-native-material-* packages don't support react-native 0.75.1. The issue is that there is no more ViewPropTypes or prop types of a particular view components, like Text, in this react-native version. So I had to make all your components use only PropTypes.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-material-dropdown/src/components/dropdown/index.js b/node_modules/react-native-material-dropdown/src/components/dropdown/index.js
index b1e65a1..a39bb62 100644
--- a/node_modules/react-native-material-dropdown/src/components/dropdown/index.js
+++ b/node_modules/react-native-material-dropdown/src/components/dropdown/index.js
@@ -9,7 +9,6 @@ import {
   TouchableWithoutFeedback,
   Dimensions,
   Platform,
-  ViewPropTypes,
   I18nManager,
 } from 'react-native';
 import Ripple from 'react-native-material-ripple';
@@ -133,7 +132,7 @@ export default class Dropdown extends PureComponent {
     disabledItemColor: PropTypes.string,
     baseColor: PropTypes.string,
 
-    itemTextStyle: Text.propTypes.style,
+    itemTextStyle: PropTypes.string,
 
     itemCount: PropTypes.number,
     itemPadding: PropTypes.number,
@@ -146,9 +145,9 @@ export default class Dropdown extends PureComponent {
     renderBase: PropTypes.func,
     renderAccessory: PropTypes.func,
 
-    containerStyle: (ViewPropTypes || View.propTypes).style,
-    overlayStyle: (ViewPropTypes || View.propTypes).style,
-    pickerStyle: (ViewPropTypes || View.propTypes).style,
+    containerStyle: PropTypes.object,
+    overlayStyle: PropTypes.object,
+    pickerStyle: PropTypes.object,
 
     supportedOrientations: PropTypes.arrayOf(PropTypes.string),
 
@@ -610,12 +609,12 @@ export default class Dropdown extends PureComponent {
       label;
 
     let color = disabled?
-      disabledItemColor:
-      ~selected?
+      disabledItemColor :
+      ~selected ?
         index === selected?
           selectedItemColor:
           itemColor:
-        selectedItemColor;
+          itemColor;
 
     let textStyle = { color, fontSize };
 

This issue body was partially generated by patch-package.

@1pinkmann
Copy link
Author

-    itemTextStyle: Text.propTypes.style,
+    itemTextStyle: PropTypes.string,

UPDATE: there is a mistake.
itemTextStyle must be PropTypes.object

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