react-native-ultimate-listview-ts
v4.1.0
Published
A high performance FlatList providing customised pull-to-refresh | auto-pagination & infinite-scrolling | gridview layout | swipeable-row. The truly ultimate version that I have done the most tricky part for you, just simply follow the instructions shown
Downloads
8
Maintainers
Readme
React Native Ultimate Listview
This Library includes two components: UltimateListView
and UltimateRefreshView
- UltimateListView: A high performance FlatList providing customised pull-to-refresh | auto-pagination & infinite-scrolling | gridview layout | swipeable-row. The truly ultimate version that I have done the most tricky part for you, you can treat this module as an enhanced FlatList with all excellently extra features, comparing to the official version.
- UltimateRefreshView: A refreshable ScrollView providing customised pull-to-refresh feature, which has already been using in the UltimateListView, but it can be used independently.
This module supports both of iOS and Android platforms.
All codes are written in ES6 syntax, and meet most rules of Eslint syntax
Quick installation
yarn add react-native-ultimate-listview-ts
Demo
| | iOS | Android | | ------------ | ---------------------------------------- | ---------------------------------------- | | FlatList | | |
Usage
import { UltimateListView, UltimateRefreshView } from 'react-native-ultimate-listview-ts'
<UltimateRefreshView onRefresh={this.onRefresh}>
<YourView/>
</UltimateRefreshView>
<UltimateListView
ref={ref => this.listView = ref}
key={this.state.layout}
onFetch={this.onFetch}
keyExtractor={(item, index) => `${index} - ${item}`}
refreshableMode="advanced" // basic or advanced
item={this.renderItem} // this takes three params (item, index, separator)
displayDate
arrowImageStyle={{ width: 20, height: 20, resizeMode: 'contain' }}/>
Or you can look through this link: Usage
Documentation
- Overview
- FlatList Migration
- Usage
- ListView API
- RefreshView API - most props are supported in
- Pagination API
- Methods API
- Swipable Tip
Why FlatList
I have found some articles to explain why you need to use FlatList instead of the legacy ListView. There are some obvious reasons:
- FlatList is just like the UICollectionView or RecyclerView, which can dramatically reduce memory usage. It also provides smoother animation when you have an extremely long list.
- FlatList supports scrollToIndex function, which is pretty convenient when you want to scroll to an item with index, instead of depending the y-offset.
- FlatList recommend developer to use PureComponent to reduce unnecessary re-rendering, this can really boost the performance and make your app run faster.
License
MIT