【发布时间】:2016-05-01 17:37:10
【问题描述】:
我正在尝试在我的登录视图上设置一个完整的背景图像。
我在 Stackoverflow 中发现了这个问题:What's the best way to add a full screen background image in React Native
所以我在那里做了,但是没有用:
var login = React.createClass({
render: function() {
return (
<View style={ styles.container }>
<Image source={require('../images/login_background.png')} style={styles.backgroundImage} />
<View style={ styles.loginForm }>
<Text>TEST</Text>
</View>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
},
backgroundImage: {
flex: 1,
resizeMode: 'cover', // or 'stretch'
},
loginForm: {
},
});
我不知道我做错了什么。任何帮助将不胜感激。
编辑:这是应用程序,如果你们想看看 -> Full size background image example on rnplay.org。我不知道怎么做可编辑:/
谢谢:)
【问题讨论】:
-
用
styles.loginFormstyle 将View包裹在Image组件内 -
像这样吧?它没有用:/ -> puu.sh/mIZ9k/7df9341cd6.pngTEST
标签: background-image fullscreen react-native