ttdung11t2 / react-native-confirmation-code-input

A react-native component to input confirmation code for both Android and IOS
MIT License
411 stars 346 forks source link

Undefined proptypes #105

Open raazatul7 opened 1 year ago

raazatul7 commented 1 year ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-confirmation-code-input@1.0.4 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-confirmation-code-input/components/ConfirmationCodeInput.js b/node_modules/react-native-confirmation-code-input/components/ConfirmationCodeInput.js
index 239c85a..a76a0d5 100644
--- a/node_modules/react-native-confirmation-code-input/components/ConfirmationCodeInput.js
+++ b/node_modules/react-native-confirmation-code-input/components/ConfirmationCodeInput.js
@@ -1,10 +1,15 @@
 import React, {Component} from 'react';
 import PropTypes from 'prop-types';
-import { View, TextInput, StyleSheet, Dimensions, ViewPropTypes } from 'react-native';
+import { View, TextInput, StyleSheet } from 'react-native';
 import _ from 'lodash';
+import {
+  ViewPropTypes,
+  TextInputPropTypes,
+} from "deprecated-react-native-prop-types";

 // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
 const viewPropTypes = ViewPropTypes || View.propTypes;
+const textInputPropTypes = TextInputPropTypes || TextInput.propTypes;

 export default class ConfirmationCodeInput extends Component {
   static propTypes = {
@@ -19,7 +24,7 @@ export default class ConfirmationCodeInput extends Component {
     inactiveColor: PropTypes.string,
     ignoreCase: PropTypes.bool,
     autoFocus: PropTypes.bool,
-    codeInputStyle: TextInput.propTypes.style,
+    codeInputStyle: textInputPropTypes.style,
     containerStyle: viewPropTypes.style,
     onFulfill: PropTypes.func,
   };

This issue body was partially generated by patch-package.

retyui commented 1 year ago

@raazatul7

Without this issue and with better maintainability, you can utilize a fork: https://github.com/retyui/react-native-confirmation-code-field