我遇到了一个问题:当我使用react-native-image-progress,react-native-fast-image时,看不到可见图像。 我想为listview添加加载图像。谢谢!!!
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>
答案 0 :(得分:0)
在展示图片之前,您可以fetch
张图片。您不必为此使用库。
示例强>
fetch(url).then(()=> { this.setState({ loading: false }) });
<Image source={this.state.loading === true ? require('/path/to/loading.gif') : { uri: url }} />