natintosh / intl_phone_number_input

MIT License
166 stars 510 forks source link

Cannot edit phone number after input #263

Open nmazidi opened 3 years ago

nmazidi commented 3 years ago

Describe the bug Once a full phone number has been entered, it's not possible to edit the phone number or move the cursor.

Package version 0.7.0+2

Flutter version 2.2.2

To Reproduce Steps to reproduce the behavior:

  1. Enter full phone number
  2. Try to more the text cursor or delete the text

Expected behavior Should allow user to edit the phone number that they've entered.

Targeted platforms (please complete the following information):

khttps commented 3 years ago

I have the same issue, do you happen to know if it's a recent release bug? That's my code for reference.

InternationalPhoneNumberInput( initialValue: PhoneNumber(), keyboardAction: TextInputAction.next, onInputChanged: (number) { //....... }, errorMessage: 'Invalid phone number', ignoreBlank: true, countries: ['SA'], ),

khttps commented 3 years ago

I fixed it. I used to update my FormState using onInputChanged, and initialValue gets value from said state, i moved my update code to onSaved and it's fixed , downside is i have to restrict maxLength manually, which what i thought this library handles automatically. idk if it's ideal for multiple countries.

mnarsely commented 3 years ago

@akhattab451 can you share a short snippet code of how you fixed it, I am also having this issue

jimmyff commented 3 years ago

I think this is the same: https://github.com/natintosh/intl_phone_number_input/issues/273