React native 无法使用自定义主题覆盖默认的Amplify withAuthenticator样式

React native 无法使用自定义主题覆盖默认的Amplify withAuthenticator样式,react-native,aws-amplify,React Native,Aws Amplify,我正在尝试在React本机应用程序中使用Authenticator HOC自定义AWS的样式。我一步一步地跟着放大。但是,应用程序会继续呈现默认样式(橙色按钮),而不是预期的自定义颜色 import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import Amplify from '@aws-amplify/core'; import config from './aws-exports'

我正在尝试在React本机应用程序中使用Authenticator HOC自定义AWS的样式。我一步一步地跟着放大。但是,应用程序会继续呈现默认样式(橙色按钮),而不是预期的自定义颜色

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Amplify from '@aws-amplify/core';
import config from './aws-exports';
import { withAuthenticator } from 'aws-amplify-react-native';
import { AmplifyTheme } from 'aws-amplify-react-native';

// custom colors for components 
const Mybutton = Object.assign({}, AmplifyTheme.button, { backgroundColor: '#000', });
//console.log('My own design: ', Mybutton)
const MyTheme = Object.assign({}, AmplifyTheme, { button: Mybutton });


class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>You are now signed in!</Text>
      </View>
    );
  }
}

export default withAuthenticator(App, { includeGreetings: true }, false, [], null, MyTheme)

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
从“React”导入React;
从“react native”导入{样式表、文本、视图};
从“@aws Amplify/core”导入放大;
从“/aws导出”导入配置;
从“aws放大反应本机”导入{withAuthenticator};
从“aws amplify react native”导入{AmplifyTheme};
//组件的自定义颜色
const Mybutton=Object.assign({},amplicationtheme.button,{backgroundColor:'#000',});
//log(“我自己的设计:”,Mybutton)
const myteme=Object.assign({},主题,{button:Mybutton});
类应用程序扩展了React.Component{
render(){
返回(
您现在已登录!
);
}
}
使用验证器导出默认值(应用程序,{includeGreetings:true}、false、[]、null、MyTheme)
const styles=StyleSheet.create({
容器:{
弹性:1,
背景颜色:“#fff”,
对齐项目:“居中”,
为内容辩护:“中心”,
},
});

有人能告诉我我做错了什么吗?

你需要像这样通过withAuthenticator调用:

export default withAuthenticator(App, {includeGreetings: true, theme: MyTheme});

然后它就会起作用。

你有没有想过这个问题?