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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM