美文网首页
react-native listView的bug之数据不显示,

react-native listView的bug之数据不显示,

作者: oc123 | 来源:发表于2018-07-10 16:13 被阅读0次

用ListView的时候,会出现一个非常傻bi的情况,就是render的时候,listView不显示,需要碰/滑一下才会显示。

一开始我在怀疑自己是不是布局哪里有冲突,改到哭都没发现布局有什么问题,直到我谷歌了一下 “react native listView not show touch”...

最后,我按react native里的issue:

在初始化listView时设置属性

removeClippedSubviews={false}
例子:

  <ListView
     enableEmptySections={true}
     dataSource={this.state.dataSource}
     renderRow={(rowData, sectionID, rowID) => this.renderGoods(rowData, sectionID, rowID, this.state.editOrCancel)}
     scrollEnabled={false}
     removeClippedSubviews={false} // 用于解决:购物车偶尔出现空白,滑动显示数据
   >

原文:https://www.cnblogs.com/rayshen/p/5994534.html
原issue:https://github.com/facebook/react-native/issues/1831

相关文章

网友评论

      本文标题:react-native listView的bug之数据不显示,

      本文链接:https://www.haomeiwen.com/subject/sqfqpftx.html