gpt4 book ai didi

javascript - React-Native 图像似乎已加载,但显示为空白

转载 作者:行者123 更新时间:2023-11-28 16:55:45 29 4
gpt4 key购买 nike

我使用 S3 存储桶作为应用程序图像的来源。 Storage.get 似乎工作正常,因为当我在浏览器上复制并粘贴链接时,它会正确加载图像。但是,图像标签似乎不起作用...

它似乎正确加载图像,因为它显示了应用程序中的空间,但没有显示实际图像。

这是代码:

  render() {
return(
<View style={Styles.vContainerF}>
{ this.state.gmpLogoURL ?
<Image style={{flex:1}}
resizeMode='contain'
source={{uri: this.state.gmpLogoURL }}
/>
: null }

这是 View 样式配置:

  vContainerF: {
flex: 1,
padding: 10,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
},

有任何关于可能出现问题的提示吗?

提前感谢各位!

最佳答案

react-native image doc 中所述:

Note that for network and data images, you will need to manually specify the dimensions of your image!

因此,将高度宽度添加到您的图像样式中:

<Image 
style={{ flex: 1, height: 100, width: 100 }}
resizeMode='contain'
source={{ uri: this.state.gmpLogoURL }}
/>

关于javascript - React-Native 图像似乎已加载,但显示为空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59258964/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com