ide / react-native-button

A button for React apps
MIT License
773 stars 129 forks source link

update PropTypes Deprecated #97

Open AngelRamirezMetodika opened 1 year ago

AngelRamirezMetodika commented 1 year ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

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

Error: Invariant Violation: ViewPropTypes has been removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-button/Button.js b/node_modules/react-native-button/Button.js
index fb7cf46..7ef770d 100644
--- a/node_modules/react-native-button/Button.js
+++ b/node_modules/react-native-button/Button.js
@@ -5,8 +5,8 @@ import {
   Text,
   TouchableOpacity,
   View,
-  ViewPropTypes,
 } from 'react-native';
+import { TextPropTypes, ViewPropTypes } from 'deprecated-react-native-prop-types';

 import coalesceNonElementChildren from './coalesceNonElementChildren';

@@ -16,12 +16,12 @@ export default class Button extends Component {
   static propTypes = {
     ...TouchableOpacity.propTypes,
     accessibilityLabel: PropTypes.string,
-    allowFontScaling: Text.propTypes.allowFontScaling,
+    allowFontScaling: TextPropTypes.allowFontScaling,
     containerStyle: ViewPropTypes.style,
     disabledContainerStyle: ViewPropTypes.style,
     disabled: PropTypes.bool,
-    style: Text.propTypes.style,
-    styleDisabled: Text.propTypes.style,
+    style: TextPropTypes.style,
+    styleDisabled: TextPropTypes.style,
     childGroupStyle: ViewPropTypes.style,
   };

This issue body was partially generated by patch-package.