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

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

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

最后,我按react native里的issue:

在初始化listView时设置属性

removeClippedSubviews={false}

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

 

原issue:

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

posted @ 2016-10-24 20:49  Rayshen  阅读(6392)  评论(1编辑  收藏  举报