Aws amplify 在放大验证器注册组件中设置默认国家/地区代码

Aws amplify 在放大验证器注册组件中设置默认国家/地区代码,aws-amplify,aws-amplify-sdk-js,Aws Amplify,Aws Amplify Sdk Js,Amplify authenticator对于常见的身份验证流来说非常方便 默认情况下,国家代码预选为+1,但为其他国家开发的应用程序可能希望默认为另一个 是否有方法更改默认的预选值 不包括这方面的任何内容 将signUpConfig.defaultCountryCode重新注册 阅读完amplify js的源代码后。代码在这里 getDefaultDialCode() { return this.props.signUpConfig &&

Amplify authenticator对于常见的身份验证流来说非常方便

默认情况下,国家代码预选为+1,但为其他国家开发的应用程序可能希望默认为另一个

是否有方法更改默认的预选值

不包括这方面的任何内容


将signUpConfig.defaultCountryCode重新注册

阅读完amplify js的源代码后。代码在这里

getDefaultDialCode() {
        return this.props.signUpConfig &&
            this.props.signUpConfig.defaultCountryCode &&
            countryDialCodes.indexOf(
                `+${this.props.signUpConfig.defaultCountryCode}`
            ) !== -1
            ? `+${this.props.signUpConfig.defaultCountryCode}`
            : '+1';
    }
因此,我们必须使用它。主席先生,我想

export default withAuthenticator(App, {signUpConfig: {defaultCountryCode: 61}})

您可以在formFields中传递
拨号代码

{
  type: 'phone_number',
  dialCode: 27, // or '+27' 
  value: '5555555555',
}

但是,当使用新UI软件包
@aws amplify/UI react
中的带验证器的
时,
signUpConfig
不再存在,它似乎是
aws amplify react
的继承者。
@aws amplify/ui react
的文档确实提到了使用验证器的
,但文档最终没有关于设置默认电话国家/地区代码的信息。。。甚至不确定新UI包中是否有此选项。