natintosh / intl_phone_number_input

MIT License
166 stars 510 forks source link

On valid phone number it get itself in weird state #273

Open jimmyff opened 3 years ago

jimmyff commented 3 years ago

Once i finish entering my phone number, the app floods my console with my number, the cursor moves to the start of the text field and then I can't reselect the end of the text to make any amendments?

jimmyff commented 3 years ago

It's worth pointing out that I've tried autoValidateMode: AutovalidateMode.disabled, but this didn't help

jimmyff commented 3 years ago

Okay, I think it's a loop caused by this:

                          onInputChanged: (phoneNo) {
                            setState(() {
                              _phoneNumber = phoneNo;
                            });

This fixes it:

                          onInputChanged: (phoneNo) {
                            if (_phoneNumber == phoneNo) return;
                            setState(() {
                              _phoneNumber = phoneNo;
                            });

Should probably do that equatable check in the library?