反应原生android:不可见图像使用react-native-image-progress

问题描述:

我有一个问题:当我使用react-native-image-progress,react-native-fast-image时看不到图像。 我想为listview添加加载图像。谢谢!!!反应原生android:不可见图像使用react-native-image-progress

import ProgressBar from 'react-native-progress/CircleSnail'; 
import FastImage from 'react-native-fast-image'; 
import { createImageProgress } from 'react-native-image-progress'; 
const Image = createImageProgress(FastImage); 
    <TouchableNativeFeedback 
     background={TouchableNativeFeedback.SelectableBackground()} 
    > 
     <Image 
       source={{ uri: 'url' }} 
       style={styles.Image} 
       indicator={ProgressBar} 
      /> 
    </TouchableNativeFeedback> 

error Image

+0

是'url' HTTPS? – MattyK14

+0

是的。这是一个链接。 –

+0

我的意思是它是https而不是http。 – MattyK14

你可以向他们展示之前fetch图像。你不必为此使用一个库。

fetch(url).then(()=> { this.setState({ loading: false }) }); 

<Image source={this.state.loading === true ? require('/path/to/loading.gif') : { uri: url }} /> 
+0

感谢您的帮助。但是我是新成员,:((你能解释得更好吗?代码行位于何处?)(fetch(url).then(()=> {this.setState({loading:false})}); ) –

+0

您可以阅读更多关于'fetch' [here](https://facebook.github.io/react-native/docs/network.html#using-fetch)和[here](https:// developer。 mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch)。基本上你下载的图像在显示加载时缓存,然后当你改变它时,它直接从缓存中读取数据并立即显示。 – bennygenel

+0

url is this.props.url。我不知道提取网址 –