chronotruck / FlagPhoneNumber

A formatted phone number UITextField with country flag picker.
Apache License 2.0
437 stars 317 forks source link

Getting formatted phone number bug #191

Open brascene opened 2 years ago

brascene commented 2 years ago

Description After selecting the country and filling out the phone number, I'm unable to get formatted phone string value using phoneNumberTextField.getFormattedPhoneNumber(format: <FPNFormat>, I'm getting "+(null)(null)" with any format option.

To Reproduce Steps to reproduce the behaviour:

  1. Implement the basic version of the lib
  2. Select country
  3. Enter phone number
  4. Try to get formatted phone number using getFormattedPhoneNumber function

Expected behaviour I should get back the string with full phone number, with country code.

Device info:

Additional context Also, I get null for the getRawPhoneNumber() function. So I managed to resolve this with using the raw text property on the TextField, removing spaces and minus signs, and getting the country code with phoneNumberTextField.selectedCountry?.phoneCode.