ReactNative 分享解决listView的一个郁闷BUG

用ListView的时候,会出现一个很是傻bi的状况,就是render的时候,listView不显示,须要碰/滑一下才会显示。javascript

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

最后,我按react native里的issue:react

在初始化listView时设置属性git

removeClippedSubviews={false}github

<ListView
    ref = {"listView"}
    style={styles.listView}
    dataSource={this.dataSource.cloneWithRows(this.state.data)}
    renderRow={this._renderRow.bind(this) }
    enableEmptySections={true}
    removeClippedSubviews={false}>
</ListView>

 

原issue:react-native

https://github.com/facebook/react-native/issues/1831布局

相关文章
相关标签/搜索