用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