我一直在尝试为amplify的withAuthenticator编辑默认UI的主题,并使该主题正常工作,但现在看来它已将我的注册页面重置为默认页面?
例如,在这里查看我的代码:
const signUpConfig = {
header: 'Sign up to our App',
hideAllDefaults: true,
signUpFields: [
{
label: 'Username',
key: 'username',
required: true,
displayOrder: 1,
type: 'string'
},
{
label: 'Password',
key: 'password',
required: true,
displayOrder: 2,
type: 'password'
},
{
label: 'Email',
key: 'email',
required: true,
displayOrder: 4,
type: 'string'
}
]
};
const usernameAttributes = 'Username';
const MyButton = Object.assign({}, AmplifyTheme.button, { backgroundColor: 'yellow' });
const sectionLink = Object.assign({}, AmplifyTheme.sectionFooterLink, { color: 'black' });
const buttondisable = Object.assign({}, AmplifyTheme.buttonDisabled, { backgroundColor: '#cccccc' });
const MyTheme = Object.assign({}, AmplifyTheme, { button: MyButton }, {sectionFooterLink:sectionLink},{buttonDisabled:buttondisable});
export default withAuthenticator(RealApp,false, [], null, MyTheme, {signUpConfig}
);
有什么想法吗?我已经阅读了文档,甚至以不同的方式格式化了导出默认格式,但是注册页面被覆盖或主题未应用等。
答案 0 :(得分:0)
让它正常工作。
事实证明,您实际上必须将整个配置添加到导出文件中,例如
export default withAuthenticator(RealApp,false, [], null, MyTheme, {header: 'Sign up to our App',
hideAllDefaults: true,
signUpFields: [
{
label: 'Username',
key: 'username',
required: true,
displayOrder: 1,
type: 'string'
},
{
label: 'Password',
key: 'password',
required: true,
displayOrder: 2,
type: 'password'
},
{
label: 'Email',
key: 'email',
required: true,
displayOrder: 4,
type: 'string'
}
]
}
);