forked from greatbsky/react-native-pull
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PullList.js
36 lines (30 loc) · 1.24 KB
/
PullList.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';
import React, { Component } from 'react';
import { ListView } from 'react-native';
import Pullable from './Pullable';
/**
支持android&ios可以下拉刷新的PullList组件
Demo:
import {PullList} from 'react-native-pullview';
<PullList onPulling={} onPullOk={} onPullRelease={} isPullEnd={true}
topIndicatorRender={({pulling, pullok, pullrelease}) => {}} topIndicatorHeight={60}
{...ListView.props}
>
Demo2:
topIndicatorRender(pulling, pullok, pullrelease) {
return <View style={{flex: 1, flexDirection: 'row', justifyContent: 'center', alignItems: 'center', height: 60}}>
<ActivityIndicator size="small" color="gray" />
{pulling ? <Text>下拉刷新2...</Text> : null}
{pullok ? <Text>松开刷新2......</Text> : null}
{pullrelease ? <Text>玩命刷新中2......</Text> : null}
</View>;
}
<PullList onPullRelease={this.props.onRefresh} topIndicatorRender={this.topIndicatorRender} topIndicatorHeight={60} {...ListView.props} />
*/
export default class extends Pullable {
getScrollable() {
return (
<ListView ref={(c) => {this.scroll = c;}} scrollEnabled={this.state.scrollEnabled} onScroll={this.onScroll} {...this.props} />
);
}
}