【发布时间】:2021-05-11 13:46:24
【问题描述】:
我的 ImageBackground 模块只显示白色背景。显示的代码基本上是来自 React 在 ImageBackgrounds 上的官方文档的样板模板。我的 uri 不为空。 "props.route.params.image" 是 react-native-camera 模块的 TakePictureResponse 类型。
我在看与这个类似的问题,他们的解决方案已经在我的身上实现了。
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
},
image: {
flex: 1,
resizeMode: 'cover',
justifyContent: 'center',
}
})
render() {
return (
<View style={styles.container}>
<ImageBackground
source={{uri: this.props.route.params.image.uri}}
style={styles.image}
/>
</View>
);
}
【问题讨论】:
标签: ios react-native react-native-camera imagebackground