forked from i6mi6/react-native-parallax-scroll-view
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.android.js
43 lines (40 loc) · 1.28 KB
/
index.android.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
37
38
39
40
41
42
43
/*
* This Android demo shows how to integrate `PullToRefreshViewAndroid` with `ScrollableParallaxView`.
*/
import React, { Component } from 'react'
import {
AppRegistry,
PullToRefreshViewAndroid,
View
} from 'react-native';
import Talks from './Talks';
class AndroidExample extends Component {
render() {
return (
<PullToRefreshViewAndroid
ref={ref => { this._pullToRefresh = ref }}
style={{ flex: 1 }}
colors={['#000', '#999', '#fff']}
progressBackgroundColor={'#fff'}
enabled={true}
refreshing={false}
onRefresh={() => {
this._pullToRefresh.getInnerViewNode().setNativeProps({ refreshing: true });
setTimeout(() => {
this._pullToRefresh.getInnerViewNode().setNativeProps({ refreshing: false });
}, 5000);
}}>
<Talks
key="talks"
onScroll={(e) => {
if (e.nativeEvent.contentOffset.y <= 0) {
this._pullToRefresh.getInnerViewNode().setNativeProps({ enabled: true });
} else {
this._pullToRefresh.getInnerViewNode().setNativeProps({ enabled: false });
}
}}/>
</PullToRefreshViewAndroid>
);
}
}
AppRegistry.registerComponent('ListViewExample', () => AndroidExample);