Skip to content
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

Cannot remove multi-digit country codes with delete key, with autoformat #108

Open
ziaulrehman40 opened this issue Jul 2, 2019 · 2 comments

Comments

@ziaulrehman40
Copy link

Screen Recording 2019-07-02 at 12 19 AM

As seen in this gif, i am actually trying to delete digits from country code when country code is multi digit, it does not seem to be able to remove them. But works fine with single digit country codes.

This issue only appears when auto-format is enabled, and i seem to be able to select the country code with double tap and can remove it than, but not normally.

I am testing on iOS simulator(iphone Xs max) as i am still in dev mode.
Version of library: 0.2.2
RN: 0.59.9

@m4manjesh
Copy link

Same happening with RN 0.60.1. Removing "autoFormat" fixed the issue.

@KawaljeetSBagga
Copy link

Hey guys. I know I am pretty late here but I recently started using this library and I also faced the same issue and I resolved this with a simple listener on onChangePhoneNumber, simply create a boolean state and check the length of your text and toggle auto formatting accordingly.
Refer below:

const [autoFormatPhoneNumber, setAutoFormatPhoneNumber] = useState(true);
<PhoneInput
textStyle={{color: 'black', fontSize: 17}}
ref={phoneNumber}
onChangePhoneNumber={text =>
text.length < 5
? setAutoFormatPhoneNumber(false)
: setAutoFormatPhoneNumber(true)}
autoFormat={autoFormatPhoneNumber}
/>

Hope this helps someone.

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

3 participants