gabrieldonadel / rn-material-ui-textfield

Material UI textfield
https://www.npmjs.com/package/rn-material-ui-textfield
Other
37 stars 31 forks source link

ViewPropTypes and Text.propTypes on react native 0.69 #47

Closed anija closed 2 years ago

anija commented 2 years ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch rn-material-ui-textfield@1.0.6 for the project I'm working on.

With the new react native 0.69, the warning (https://github.com/gabrieldonadel/rn-material-ui-textfield/issues/45) has becoming an error, and also the use of Text.propTypes is not working anymore.

Here is the diff that solved my problem:

diff --git a/node_modules/rn-material-ui-textfield/src/components/affix/index.js b/node_modules/rn-material-ui-textfield/src/components/affix/index.js
index 44330d2..55c6cf4 100644
--- a/node_modules/rn-material-ui-textfield/src/components/affix/index.js
+++ b/node_modules/rn-material-ui-textfield/src/components/affix/index.js
@@ -11,7 +11,7 @@ export default class Affix extends PureComponent {

   static propTypes = {
     numberOfLines: PropTypes.number,
-    style: Text.propTypes.style,
+    //style: Text.propTypes.style,

     color: PropTypes.string.isRequired,
     fontSize: PropTypes.number.isRequired,
diff --git a/node_modules/rn-material-ui-textfield/src/components/counter/index.js b/node_modules/rn-material-ui-textfield/src/components/counter/index.js
index 679ca9c..41a49f8 100644
--- a/node_modules/rn-material-ui-textfield/src/components/counter/index.js
+++ b/node_modules/rn-material-ui-textfield/src/components/counter/index.js
@@ -12,7 +12,7 @@ export default class Counter extends PureComponent {
     baseColor: PropTypes.string.isRequired,
     errorColor: PropTypes.string.isRequired,

-    style: Text.propTypes.style,
+    //style: Text.propTypes.style,
   }

   render() {
diff --git a/node_modules/rn-material-ui-textfield/src/components/field/index.js b/node_modules/rn-material-ui-textfield/src/components/field/index.js
index 2056eba..0cc3cc0 100644
--- a/node_modules/rn-material-ui-textfield/src/components/field/index.js
+++ b/node_modules/rn-material-ui-textfield/src/components/field/index.js
@@ -1,6 +1,8 @@
 import PropTypes from 'prop-types'
 import React, { PureComponent } from 'react'
-import { View, Text, TextInput, Animated, StyleSheet, Platform, ViewPropTypes } from 'react-native'
+import { View, Text, TextInput, Animated, StyleSheet, Platform } from 'react-native'
+
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';

 import Line from '../line'
 import Label from '../label'
@@ -74,9 +76,9 @@ export default class TextField extends PureComponent {

     labelOffset: Label.propTypes.offset,

-    labelTextStyle: Text.propTypes.style,
-    titleTextStyle: Text.propTypes.style,
-    affixTextStyle: Text.propTypes.style,
+    //labelTextStyle: Text.propTypes.style,
+    //titleTextStyle: Text.propTypes.style,
+    //affixTextStyle: Text.propTypes.style,

     tintColor: PropTypes.string,
     textColor: PropTypes.string,
diff --git a/node_modules/rn-material-ui-textfield/src/components/helper/index.js b/node_modules/rn-material-ui-textfield/src/components/helper/index.js
index 486e367..0d80bb2 100644
--- a/node_modules/rn-material-ui-textfield/src/components/helper/index.js
+++ b/node_modules/rn-material-ui-textfield/src/components/helper/index.js
@@ -9,7 +9,7 @@ export default class Helper extends PureComponent {
     title: PropTypes.string,
     error: PropTypes.string,
     disabled: PropTypes.bool,
-    style: Text.propTypes.style,
+    //style: Text.propTypes.style,
     baseColor: PropTypes.string,
     errorColor: PropTypes.string,
     focusAnimation: PropTypes.instanceOf(Animated.Value),
diff --git a/node_modules/rn-material-ui-textfield/src/components/label/index.js b/node_modules/rn-material-ui-textfield/src/components/label/index.js
index a6bcbed..45c92ba 100644
--- a/node_modules/rn-material-ui-textfield/src/components/label/index.js
+++ b/node_modules/rn-material-ui-textfield/src/components/label/index.js
@@ -39,7 +39,7 @@ export default class Label extends PureComponent {
       y1: PropTypes.number,
     }),

-    style: Text.propTypes.style,
+    //style: Text.propTypes.style,
     label: PropTypes.string,
   }

This issue body was partially generated by patch-package.

imran1992 commented 2 years ago

Hi @anija You also need to patch this in

import { ViewPropTypes,TextInputPropTypes } from 'deprecated-react-native-prop-types'

---------------
  static propTypes = {
-    ...TextInput.propTypes,
+    ...TextInputPropTypes,

---------------
-    for (let key in TextInput.propTypes) {
+    for (let key in TextInputPropTypes) {
       if (key === 'defaultValue') {
         continue
       }

As React Native removed TextInput.propTypes. without it you can't change keyboardType.

gabrieldonadel commented 2 years ago

Hi @anija and @imran1992 thanks for your input. These changes were just included in the 1.0.7 release, please update the rn-material-ui-textfield version on your projects.