natintosh / intl_phone_number_input

MIT License
164 stars 496 forks source link

onInputValidated not working well on IOS on specify SG mobile number #219

Open AuronChoo opened 3 years ago

AuronChoo commented 3 years ago

Describe the bug Some new Singapore mobile number are invalid on IOS, but working fine on Android +65 8950 0000 Validation Results: Result from isPossibleNumber(): true Result from isValidNumber(): true Result from isValidNumberForRegion(): true Phone Number region: SG Result from getNumberType(): MOBILE

Source :libphonenumber Phone Number Parser Demo

Package version intl_phone_number_input: ^0.7.0+2

Flutter version 2.2.0-10.1.pre

To Reproduce Steps to reproduce the behavior:

  1. select +65 Singapore as country code
  2. input 89500000 into InternationalPhoneNumberInput()
  3. onInputValidated return false on IOS,but return true on Android

Expected behavior onInputValidated Both Android and IOS should return true


  @override
  Widget build(BuildContext context) {
    return Consumer<PhoneInputBloc>(
      builder: (BuildContext context, PhoneInputBloc bloc, Widget? child) {
        return  InternationalPhoneNumberInput(
            textFieldController: bloc.mobileController,
            countries: ['SG'],
            locale: 'SG',
            formatInput: false,
            onInputValidated: (bool validated) => // expected receive `true` after key in `89500000`
                Provider.of<PhoneInputBloc>(context, listen: false)
                    .setMobileValidated(validated),
            onInputChanged: (PhoneNumber value) =>
                Provider.of<PhoneInputBloc>(context, listen: false)
                    .setCountryCode(value.dialCode),
        );
      },
    );
  }
}```
ScottLee97 commented 2 years ago

Hi Auron, I tried +6580505555 and it doesn't work too. Did you manage to find a way around it??

Coffiie commented 1 month ago

This is the workaround: dependency_overrides: libphonenumber_plugin: 0.2.3 @ScottLee97