大家好,我正在尝试使用 AWS Amplify 和 React Native 制作应用程序。我只想向我的应用程序添加背景图像,出于这个小目的,我不想创建一个完全自定义的组件来显示登录屏幕。这是我的代码。
import React, { useEffect } from 'react';
import { Text, View, StyleSheet, StatusBar, ImageBackground, Image } from 'react-native';
import SplashScreen from 'react-native-splash-screen';
import Amplify from 'aws-amplify';
import awsconfig from './aws-exports';
import { Authenticator, AmplifyTheme } from 'aws-amplify-react-native';
Amplify.configure(awsconfig);
console.disableYellowBox=true;
const App = function() {
useEffect(() => {
SplashScreen.hide();
}, []);
return(
<View style={styles.container}>
<StatusBar
barStyle = 'light-content'
backgroundColor='black'
/>
<Authenticator usernameAttributes="email" >
</Authenticator>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'black'
}
});
export default App;
我知道 ImageBackground 应该可以完成这项工作,但我不知道如何将 Amplify 登录与其集成。
提前致谢。