[英]After loading images on scroll image gets disappeared react native
I have used ListView component from react-native and used it for rendering product details and images. 我使用了react-native的ListView组件,并将其用于呈现产品详细信息和图像。
Now , after the images being loaded I am scrolling the view downwards. 现在,在加载图像之后,我向下滚动视图。 While coming back to previous products only images get disappeared and seems to get loaded again from the source.
回到以前的产品时,只有图像消失了,似乎又从源头重新加载了。
The image source is a URL. 图像源是URL。
Please tell how can I persist the images already loaded in current react Native android screen. 请告诉我如何持久保存当前已在本机android屏幕上加载的图像。
I am using : 我在用 :
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.45.1",
"react-native-keyboard-aware-scroll-view": "^0.2.9",
"react-native-vector-icons": "^4.2.0",
"react-navigation": "^1.0.0-beta.11"
},
Updated Code for reference: 更新了代码以供参考:
<ListView
renderRow={this._renderRow.bind(this)}
dataSource={this.state.dataSource}
pageSize={data.length}/>
</View>
_renderRow(data){
return (
<View style={styles.boxContainer}>
<Image
style={styles.image}
resizeMode={'contain'}
source={{uri: "https://vesyl.in/"+data.image_url}}
/>
</View>
</View>
)
}
The response from API: API的响应:
data = [];
for(let i=0; i<responseJson.data.length; i++){
var t = responseJson.data;
data.push(t[i]);
}
const ds = new ListView.DataSource({rowHasChanged: (r1, r2)=>r1!==r2});
this.setState({dataSource: ds.cloneWithRows(data)});
data.image_url are objects containing image urls. data.image_url是包含图像URL的对象。
Try android:largeHeap="true"
under <application>
in your androidManifest file. 在androidManifest文件的
<application>
下尝试android:largeHeap="true"
。 Also, add the property removeClippedSubviews={true}
to your scrollView
s. 另外,将属性
removeClippedSubviews={true}
到您的scrollView
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.