当我在 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',
},}
原文由 Waqas 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可以在 React Native 上使用 “ImageBackground” 组件。