【发布时间】:2018-12-09 18:45:54
【问题描述】:
我正在使用来自 React Native 的 ImageBackground 组件。但是,无论我选择哪种样式,总是会显示相同的错误消息。代码如下:
render() {
return (
<ImageBackground
source={require('./common/Background_image.png')}
stlye={styles.backgroundStyle}
>
<Text>Some text here!!</Text>
</ImageBackground>
);
}
backgroundStyle: {
flex: 1,
width: null,
height: null,
resizeMode: 'cover'}
React-Native 版本: 反应原生 cli:2.0.1 反应原生:0.55.4
对这可能发生的事情有什么想法吗?
【问题讨论】:
-
你为什么通过
width: null, height: null,。只需将其删除并重试。 -
已经尝试过了,但我仍然得到同样的错误
标签: reactjs react-native imagebackground