D_inosaur 2019-06-12 11:21 采纳率: 0%
浏览 190

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> ) }} /> 图片说明
  • 写回答

1条回答 默认 最新

  • D_inosaur 2019-06-14 14:27
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题