react-native-phone-input
react-native-phone-input copied to clipboard
Cannot remove multi-digit country codes with delete key, with autoformat

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
Same happening with RN 0.60.1. Removing "autoFormat" fixed the issue.
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.