站在諸多巨人的肩上,寫的這個庫。自己用着感覺還行,大家可以試試。
scrollview&&FlatList android&&ios
1:flatlist與scrollview下拉刷新上拉加載更多
2:沒有網絡沒有數據狀態頁面。
3:解決react-native-pull中iOS下拉頭部出現空白問題。
GitHub:https://github.com/wuyunqiang/react-native-pullview
參考react-native-pull和react-native-refreshable-flatlist。
效果圖:
使用方式直接拷貝到文件目錄下,導入組件即可:
pulllist=>使用flatlist
onPullRelease = (resolve) => {
//請求數據然後執行
this.list && this.list.setData(result);
resolve()
}
render() {
return (<PullList
style={{width: WIDTH,backgroundColor:'#f5f5f5'}}
ref={(list)=> this.list = list}
onPullRelease={this.onPullRelease}
onEndReached={()=>{ this.list&&this.list.addData([]);}}
renderItem={this.item}
numColumns={1}
initialNumToRender={5}
key={'list'}
/>)}
pullview=>使用scrollview
onPullRelease = (resolve) => {
//請求數據然後執行
resolve()
}
render() {
return (
<PullView
style={{width: WIDTH,backgroundColor:'#f5f5f5'}}
onPullRelease={this.onPullRelease}
>
//一些組件
</PullView>
)
}
下拉上拉在iOS上,不會出現空白現象。