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

Provide a way to disable the phone formatting calls within the library; formatting functions are broken #57

Open
sorinmiroiu97 opened this issue Nov 2, 2020 · 0 comments

Comments

@sorinmiroiu97
Copy link

General Information

  • NKVPhonePicker Version:2.1.0

  • iOS Version(s):14.0

  • Swift Version:5.3

  • Device or Simulator:both and no all models

  • Did you check an example: yes

What happened?

Let's say you set (either on device or simulator) the flag for chile (using the figer taps, not programatically) and then you type in your number. It's perfect. Now let's say you go back and return to this screen, only this time the request provides you a phone number so you call the preFillText function which calls the setcode, set flag functions and sets the text property. Within both the setflag and setcode functions there are calls for formatting the phone number in accordance to your custom formats (which is not the case here) or to the current country based on the nkv source you pass in using the country code. The sources, the country codes, numbers and all of them are correct but upon "formatting" the number the phone number gets changed and is being added the last 3 chars again in the end of the number. So if the phone number is this (for chile for example): 56 9 2522 5421 then the prefilltext function will mess up with this number and in the end you will see displayed in the phone field this: 56 9 2522 5421421.
I managed to overcome this by setting the current country initially to false, setting the text property of the field as is from the response and by manually setting the phonePicker.flagView.flagButton.setImage using the UIImage constructor with the bundle. What would be nice is if we could get acces to the NKVSourcesHelper struct so we can use the static functions from there but i got the job done.

What did you expect to happen?

I expected the phone number to not get any other chars added to it, cause that's not ok at all.

Please provide a boolean so we can set it to false and if that's false then by calling preFillText it won't call the enablePhoneFormat within it and also it won't call the by callin the setFlag function it won't call the textField.presenter.enablePhoneFormat function within it.
Please provide access so we can at least call the NKVSourcesHelper struct and just get the flag(for: source) result.

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

1 participant