天天看點

pullview使用flatlist下拉上拉

站在諸多巨人的肩上,寫的這個庫。自己用着感覺還行,大家可以試試。

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。

效果圖:

pullview使用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={}
            initialNumToRender={}
            key={'list'}
        />)}
           

pullview=>使用scrollview

onPullRelease = (resolve) => {
        //請求資料然後執行 
          resolve()
        }

    render() {
        return (
            <PullView
                style={{width: WIDTH,backgroundColor:'#f5f5f5'}}
                onPullRelease={this.onPullRelease}
            >
             //一些元件
            </PullView>
        )
    }
           

下拉上拉在iOS上,不會出現空白現象。