0.55.4版本ReactNaitve列表展示Image过多就不显示

0.55.4版本ReactNaitve列表展示Image过多就不显示

问题描述:

  • 0.44.3版本FlatList+Image没有问题。
  • 但是在0.55.4版本中FL列表展示Image显示网络图片,加载到几十张之后,Image就显示空白了,应用推到后台,再进入应用,就刷新有显示了,但是再往前滚动FL,其他的Image就显示空白了。
  • 猜想与内存优化有关,但是没有找到方法,求指教
  • <FlatList getItemLayout={(data, index)=>{return {length: ITEM_HEIGHT,offset: ITEM_HEIGHT * index, index}}} style={{marginTop:10,padding:10,flex:1}} extraData={this.state} data={this.state.result} keyExtractor={(item,index)=>""+index} renderItem={({item,index})=>{ return ( <View style={{flexDirection:"row",alignItems:"center",margin:5}}> <Text style={{fontSize:23,color:"#08f",marginRight:10}}>{index} 、 </Text> <Image source={{uri:item.picUrl[0]}}style={{width:150,height:150}} onError={(e)=>{ console.log("出错error item: "+item.picUrl[0]); } }/> </View> ) }} /> 图片说明

removeClippedSubviews属性,因为列表中绘制的图片过多,导致无法显示更多的图片,将removeClippedSubviews属性置为true,
以此将界面外的视图删除,从而减轻当前视图的绘制要求,但是实际图片依然存在内存中。
借鉴=>https://blog.csdn.net/u010379595/article/details/82385629