aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

AmplifyAuthenticator: Set phone_number default dial_code #8115

Closed dayvough closed 1 year ago

dayvough commented 3 years ago

Currently the default dial_code is +1 and all the options are available. What if we wanted to build something for a select number of countries, why can't we restrict it only to just say ["+63"]?

Also as a side note, I know you can set the default dial code via formFields on AmplifySignUp BUT if you set your code like this:

<AmplifySignUp slot="sign-up" usernameAlias="phone_number"
  formFields={[
    {
      type: "phone_number",
      dialCode: "+63",
    }
  ]}
></AmplifySignup>

You would end up with the "Username cannot be empty" error.

And I know that formFields overrides the usernameAlias but then now I'm lost as to how I can parse the phone_number with the dialcodes and country prefixes.

tannerabread commented 1 year ago

This should now be handled by the UI Authenticator component via the sign-up attributes. If you are still experiencing this with that component please open a new issue in the UI repo as the component mentioned in the original post is now deprecated.