【发布时间】:2018-04-03 20:37:48
【问题描述】:
当我在 react-native 中使用时,它会警告说不推荐使用与孩子一起使用,并且将来会出错。而是用户。
所以, 如果我使用它不会给出我正在使用的预期结果
这是我为使用而编写的代码
<ImageBackground source={require('../../img/splash/splash_bg.png')} style={styles.backgroundImage} >
</ImageBackground>
样式代码是
const styles = StyleSheet.create({
backgroundImage: {
flex: 1,
// width: undefined,
// height: undefined,
// flexDirection: 'column',
// backgroundColor:'transparent',
// justifyContent: 'flex-start',
},}
【问题讨论】:
-
根据github.com/facebook/react-native/blob/…,ImageBackground 接受两种样式道具——style 和 imageStyle——(显然)分别应用于内部 View 和 Image。还值得注意的是,容器样式中的高度和重量值会自动应用于图像样式。
-
我试过只使用
没有任何父母或孩子,但仍然无法获得预期的结果。
标签: javascript react-native imagebackground