-
Notifications
You must be signed in to change notification settings - Fork 823
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
Allow to separate a PhoneNumber's country prefix from the rest #32
Comments
Your approach (having |
@sentiasa, @AliSoftware's UI approach for phone number entry is quite common and something PhoneNumberKit should support out-of-the-box. Some modifications to PhoneNumberTextField and the ParialFormatter are necessary to allow it to do partial formatting for international dialling with a locked country region. I'm hoping to push the modifications and an example app implementing this pattern next week. |
Re the UILabel application - I just pushed an update to the formatter that allows you to format parsed phone numbers while excluding the prefix: So for example:
|
@marmelroy That would be interesting to see an example app on using @AliSoftware 's UIPicker & flags approach |
Resolved by 40ff2f4 An example project will be added before this is packaged in a release... Basically, I added a withPrefix optional Bool on PhoneNumberTextField that works as expected. |
@marmelroy Please drop here a message too when the demo get added. Seeing flags with PhoneNumberKit would be very interesting to see.. Thanks.. |
It would be cool to be able to separate a PhoneNumber's intl prefix from the rest of the phone number, e.g. for a french phone number,
"0612345678"
would give the tuple("+33", "612345678")
This would have multiple applications and possibilities, one of them being to allow the user to select a country in one way, the UI then displaying the selected intl prefix, and let the user enter the rest of the phone number in a TextField then.
Application for
PhoneNumberTextField
One UI we want to implement is adding a
leftView
to thePhoneNumberTextField
containing anUIButton
. On tap, this will display aUIPickerView
to select the country, and upon selecting one will display e.g.🇫🇷 (+33)
in the button's title.Then the
PhoneNumberTextField
should be able to format the reminder of the phone number taking that fixed country prefix into accountApplication for
UILabel
In another place in our UI, we need to simply display the phone number, but we may still need to split it for display and layout purposes in two separate labels (e.g. one label in gray text containing the prefix "+33" and another label next to it in black containing the rest)
So this request of being able to split the PhoneNumber is not limited to
PhoneNumberTextField
, but should also be made accessible for other purposes and customization as well (maybe makefunc adjustedNationalNumber()
public instead of private to solve that?)The text was updated successfully, but these errors were encountered: