RN-组件的简单使用

RN-索引列表

2017-08-04  本文已影响19人  精神病患者link常

github : https://github.com/rgovindji/react-native-atoz-list

注意:
1、需要导入 lodash

npm i --save lodash

2、使用demo里面的代码时,listView的row高度为95,默认加载一页的条数是8。
所以,根据自己的项目需求,自己修改这些默认的数据(修改源码)

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,默认一页的数据还是8条的话,效果是(自己改改看看啊.),

所以啊,要合适的修改 initialNumToRender 的值,确保加载的数据起码能够占满整个屏幕

当然这是改的本地的源码,多人合作的话自我斟酌

github: https://github.com/johanneslumpe/react-native-selectablesectionlistview

mark一下

上一篇下一篇

猜你喜欢

热点阅读