Can';t在android emulator中显示react本机应用程序的图像
我正在为android构建一个react原生应用程序。我正在尝试在我的应用程序中包含图像。无论我做什么,我都无法在我的应用程序中显示图像。我读过这篇文章,尝试使用https图像,并在图像中添加了高度和宽度。 这是我试图显示的图像的组件的渲染方法。现在,源代码动态指向我的s3 bucketCan';t在android emulator中显示react本机应用程序的图像,android,image,react-native,Android,Image,React Native,我正在为android构建一个react原生应用程序。我正在尝试在我的应用程序中包含图像。无论我做什么,我都无法在我的应用程序中显示图像。我读过这篇文章,尝试使用https图像,并在图像中添加了高度和宽度。 这是我试图显示的图像的组件的渲染方法。现在,源代码动态指向我的s3 bucket render() { const { textWrapperStyle, svgStyle, containerStyle, textStyle } = styles console.log("
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>
)
}
render(){
const{textWrapperStyle,svgStyle,containerStyle,textStyle}=styles
log(“文件URL”,this.props.FILE.URL)
返回(
{
警报(“模式已关闭”);
}}>
{
this.setModalVisible(!this.state.modalVisible);
}}>
隐藏模态
{this.setModalVisible(true);}>
{this.props.file.title}
this.confirmDelete(this.props.file.id,this.props.eventId)}>
)
}
这是对整个项目的一点建议。我目前在android studio的NExus 5x API 29 x86上运行它如果我在Internet地址栏中键入您正在查看的地址,您是否正确显示图像?@hongdevelop yes it doesry在图像中传递prop resizeMode=“contain”,您是否也可以显示通过控制台这一行得到的结果。警告(
https://obeya-dgeismar-site-assets${this.props.file.url}
)您找到答案了吗?请共享如果我在Internet地址栏中键入您正在查看的地址,您是否正确显示图像?@hongdevelop yes it doesty prop resizeMode=“contain”在Imageand中,您还可以显示通过控制台这一行得到的结果。warn(https://obeya-dgeismar-site-assets${this.props.file.url}
)找到答案了吗?请分享