rili-live / react-native-phone-input

Phone input box for React Native
https://www.npmjs.com/package/react-native-phone-input
MIT License
44 stars 55 forks source link

Adding autoComplete support for iOS #58

Open spdrstar opened 1 year ago

spdrstar commented 1 year ago

Hi! ๐Ÿ‘‹

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

Today I used patch-package to patch react-native-phone-input@1.3.7 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-phone-input/dist/PhoneInput.js b/node_modules/react-native-phone-input/dist/PhoneInput.js
index 9d9180e..805da38 100644
--- a/node_modules/react-native-phone-input/dist/PhoneInput.js
+++ b/node_modules/react-native-phone-input/dist/PhoneInput.js
@@ -185,7 +185,7 @@ class PhoneInput extends react_1.default.Component {
             react_1.default.createElement(react_native_1.View, { style: { flex: 1, marginLeft: this.props.offset || 10 } },
                 react_1.default.createElement(TextComponent, Object.assign({ ref: (ref) => {
                         this.inputPhone = ref;
-                    }, accessibilityLabel: this.getAccessibilityLabel(), editable: !disabled, autoCorrect: false, style: [styles_1.default.text, this.props.textStyle], onChangeText: (text) => {
+                    }, accessibilityLabel: this.getAccessibilityLabel(), editable: !disabled, autoComplete: 'tel', autoCorrect: false, style: [styles_1.default.text, this.props.textStyle], onChangeText: (text) => {
                         this.onChangePhoneNumber(text);
                     }, keyboardType: "phone-pad", underlineColorAndroid: "rgba(0,0,0,0)", value: displayValue }, this.props.textProps))),
             react_1.default.createElement(CountryPicker_1.default, { ref: (ref) => {

This issue body was partially generated by patch-package.

rililive commented 1 year ago

Can you create a PR and explain what problem this solves? I can merge and publish an updated version