github : https://github.com/rgovindji/react-native-atoz-list
注意:
1觉吭、需要導(dǎo)入 lodash
npm i --save lodash
2、使用demo里面的代碼時(shí)岖沛,listView的row高度為95,默認(rèn)加載一頁(yè)的條數(shù)是8搭独。
所以婴削,根據(jù)自己的項(xiàng)目需求,自己修改這些默認(rèn)的數(shù)據(jù)(修改源碼)
AtoZList.js
<FixedHeightWindowedListView
ref={view => this._listView = view}
dataSource={this.state.dataSource}
renderCell={this.props.renderCell}
renderSectionHeader={this.props.renderSection}
incrementDelay={16}
initialNumToRender={8}
pageSize={Platform.OS === 'ios' ? 15 : 8}
maxNumToRender={70}
numToRenderAhead={40}
numToRenderBehind={4}
onEndReached={this.props.onEndReached}
/>
如果只改了高度例如40牙肝,默認(rèn)一頁(yè)的數(shù)據(jù)還是8條的話唉俗,效果是(自己改改看看啊.),
所以啊配椭,要合適的修改 initialNumToRender 的值互躬,確保加載的數(shù)據(jù)起碼能夠占滿整個(gè)屏幕
當(dāng)然這是改的本地的源碼,多人合作的話自我斟酌
github: https://github.com/johanneslumpe/react-native-selectablesectionlistview
mark一下