android - 无法在 android 模拟器中显示 react-native 应用程序的图像
问题描述
我正在为 android 构建一个 react-native 应用程序。我正在尝试在我的应用程序中包含图像。无论我做什么,我都无法让图像显示在我的应用程序中。我已阅读其他答案并尝试使用 https 图像并为我的图像添加了高度和宽度。这是组件的渲染方法,其中包含我试图显示的图像。现在源动态指向我的 s3 存储桶。
render() {
const { textWrapperStyle, svgStyle, containerStyle, textStyle } = styles
console.log("FILE URL", this.props.file.url)
return (
<View style={{flexDirection: 'row', alignItems: 'center'}}>
<Modal
animationType={'slide'}
transparent={false}
visible={this.state.modalVisible}
onRequestClose={() => {
alert('Modal has been closed.');
}}>
<View style={{flex: 1, justifyContent: 'center'}}>
<View>
<Image
style={{width: 200, height: 200}}
source={{uri: "https://obeya-dgeismar-site-assets"+this.props.file.url }}
/>
<TouchableOpacity
onPress={() => {
this.setModalVisible(!this.state.modalVisible);
}}>
<Text>Hide Modal</Text>
</TouchableOpacity>
</View>
</View>
</Modal>
<TouchableOpacity style={[containerStyle, this.props.customStyle]} onPress={() => {this.setModalVisible(true);}}>
<View style={textWrapperStyle}>
<Text>
{this.props.file.title}
</Text>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={()=>this.confirmDelete(this.props.file.id, this.props.eventId)}>
<Close style={styles.svgStyle} fill='red'/>
</TouchableOpacity>
</View>
)
}
这是整个项目的链接。我目前在 NExus 5x API 29 x86 上的 android studio 中运行它
解决方案
推荐阅读
- reactjs - React,有没有办法在 useEffect 上播放声音?
- java - 在 Spring MVC 中的当前视图上显示后端生成的错误
- excel - 如果在 vba , vb.net 中进行评估
- javascript - 等待代码完成,然后执行另一段
- fiddler - 使用 FiddlerScript 在所有请求中提取请求标头的唯一值
- flutter - Flutter:嵌套 FutureBuilder 会导致异常行为吗?
- typescript - 打字稿不推断对象的动态键
- javascript - 渲染函数中的多个参数
- python - discord.py - 删除非附件并对附件做出反应
- python - python错误运行脚本列表索引超出范围