我是 react native 的新手,我想使用 ImageBackground。
但是,当我尝试使用以下代码使其全屏显示时:
import React from 'react';
import { StyleSheet, ImageBackground,Text, View } from 'react-native';
const Signin = () => {
return (
<ImageBackground source={require('./images/background.jpg')} style={styles.image}>
<Text>Hello</Text>
</ImageBackground>
)
}
const styles = StyleSheet.create({
image: {
flex: 1,
width: '100%',
height: '100%',
resizeMode:'cover'
}
});
export default Signin;
它只返回我屏幕的一半图片。关于它为什么这样做的任何想法?
我的初始图像可以在这里找到:https ://unsplash.com/photos/0AwoTNSdwV