javascript - 如何加载文件流图像
问题描述
我有一个图像的文件流,我想将它加载到一个Image
元素中。但是我的元素显示一个白屏:
我的形象:
https://ccg24.com/w/kasian/GetListSlider/745869/Merchent/Fa/image/512M51
<Image elevation={5} resizeMode='stretch' style={{ borderRadius: 16, position: 'absolute',right:4, bottom: 10, alignSelf: 'center', width: (height / 2)+20, height: (height / 2)+10 }} source={{ uri: 'https://ccg24.com/w/kasian/GetListSlider/745869/Merchent/Fa/image/512M512' }} />
解决方案
您可以使用该Image
组件。有用。但elevation
不是Image
组件的属性。也许你的网络很慢,所以它显示一个白屏。
并请注意位置。绝对定位总是相对于父级。
<Image style={{ borderRadius: 16, right:4, bottom: 10, alignSelf: 'center', width: (400 / 2)+20, height: (400 / 2)+10 }} source={{ uri: 'https://ccg24.com/w/kasian/GetListSlider/745869/Merchent/Fa/image/512M512' }} />