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

Wrong mask being set after upgrade to version 1.2.1 #24

Open
emersonsiega opened this issue Nov 3, 2021 · 2 comments
Open

Wrong mask being set after upgrade to version 1.2.1 #24

emersonsiega opened this issue Nov 3, 2021 · 2 comments

Comments

@emersonsiega
Copy link

emersonsiega commented Nov 3, 2021

We are using this library in two different projects, applying masks for brazilian phone numbers.
The first one is using version 1.1.0 and the second started using this lib with version 1.2.1.
We notice that the mask is not being applied correctly in version 1.2.1.

With 1.1.0, the correct mask is: +55 (XX) XXXXX-XXXX
With 1.2.1, the wrong mask is +55 XXXXX-XXXX

We had to downgrade to version 1.1.0 in both projects.

Tested only in iOS, with latest Flutter version (stable).

@emersonsiega
Copy link
Author

This is how we are mounting the TextInputFormatter. It's the same code used in the two projects.

Future<void> init() async {
    if (_locales == null) {
      await FlutterLibphonenumber().init();

      _locales = await FlutterLibphonenumber().getAllSupportedRegions();
    }
}

TextInputFormatter? maskFor({String? countryCode = 'BR'}) {
    final country = _locales?[countryCode];

    if (country != null) {
      return LibPhonenumberTextFormatter(
        country: country,
        phoneNumberFormat: PhoneNumberFormat.national,
        phoneNumberType: PhoneNumberType.mobile,
      );
    }

    return null;
}

@woelmer
Copy link

woelmer commented Nov 8, 2021

@emersonsiega This is a duplicate of the bug I already logged against national phone numbers in U.S. Issue 22. The latest version has a major bug with the .national phone number format.

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

2 participants