【发布时间】:2017-09-14 04:05:39
【问题描述】:
我有问题。我在 Image 中使用 onLoad、onLoadStart 和 onLoadEnd。我想等待服务器获取响应链接图像并显示图像,添加加载。但它不停地抽搐。
constructor (props) {
super(props)
this.state = {loading: true}}
return(
<Image
onLoad={(e) => this.setState({loading: true})}
onError={(e) => this.setState({loading: false})}
onLoadStart={(e) => this.setState({loading: false})}
source={this.state.loading ? require('../../img/loading.gif') : {
uri: getBestUrl(artwork)}}
style={styles.artworkImage}
resizeMode={Image.resizeMode.cover}
/>)
【问题讨论】:
标签: react-native react-native-android react-native-listview