react-native-scrollpageviewtest 0.0.1-security → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of react-native-scrollpageviewtest might be problematic. Click here for more details.
- package/.gitattributes +1 -0
- package/GestureCommon/CommonLottieFooter.js +41 -0
- package/GestureCommon/CommonLottieHeader.js +34 -0
- package/GestureCommon/CommonLottieScroller.js +277 -0
- package/GestureCommon/CommonNormalFooter.js +8 -0
- package/GestureCommon/CommonNormalHeader.js +8 -0
- package/GestureCommon/CommonWithLastDateFooter.js +15 -0
- package/GestureCommon/CommonWithLastDateHeader.js +15 -0
- package/GestureCommon/WithLastDateFooter.js +81 -0
- package/GestureCommon/WithLastDateHeader.js +80 -0
- package/GestureCommon/index.js +1 -0
- package/GestureCommon/res/arrow.png +0 -0
- package/GestureCommon/res/loading.json +1 -0
- package/GestureCommon/res/refresh/refreshing.json +1 -0
- package/GestureCommon/res/refresh/refreshing2.json +1 -0
- package/GestureCommon/res/refresh/refreshing3.json +1 -0
- package/GestureLoadingFooter.js +62 -0
- package/GestureNormalFooter.js +101 -0
- package/GestureNormalHeader.js +90 -0
- package/GesturePageView.js +516 -0
- package/GesturePropType.js +68 -0
- package/GestureRefreshHeader.js +53 -0
- package/GestureScrollView.js +511 -0
- package/README.md +43 -3
- package/ScrollPageViewPropType.js +70 -0
- package/index.js +7 -0
- package/package.json +14 -3
- package/styles.js +13 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"v":"4.10.2","fr":12,"ip":0,"op":60,"w":150,"h":150,"nm":"Comp 1","ddd":0,"assets":[],"dx":"","dy":"","dz":"","px":"","py":"","pz":"","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[75,75,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.507,0.507,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p507_1_0p333_0","0p507_1_0p333_0","0p667_1_0p333_0"],"t":10,"s":[0,0,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p667_1_0p333_0","0p667_1_0p333_0","0p667_1_0p333_0"],"t":15,"s":[120,120,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p667_1_0p333_0","0p667_1_0p333_0","0p667_1_0p333_0"],"t":20,"s":[120,120,100],"e":[0,0,100]},{"t":25}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[110,110],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.973463050992,0.988235294118,0.972733561198,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":10,"op":25,"st":10,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 5","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[75,75,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.706,0.706,0.333],"y":[0,0,0]},"n":["0p667_1_0p706_0","0p667_1_0p706_0","0p667_1_0p333_0"],"t":5,"s":[0,0,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p667_1_0p333_0","0p667_1_0p333_0","0p667_1_0p333_0"],"t":10,"s":[120,120,100],"e":[120,120,100]},{"i":{"x":[0.258,0.258,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p258_1_0p333_0","0p258_1_0p333_0","0p667_1_0p333_0"],"t":25,"s":[120,120,100],"e":[0,0,100]},{"t":30}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[105,105],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.952941176471,0.942257750268,0.04484428705,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":5,"op":30,"st":5,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[75,75,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.059,0.059,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p059_1_0p333_0","0p059_1_0p333_0","0p667_1_0p333_0"],"t":0,"s":[0,0,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p667_1_0p333_0","0p667_1_0p333_0","0p667_1_0p333_0"],"t":5,"s":[120,120,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.83,0.83,0.333],"y":[0,0,0]},"n":["0p667_1_0p83_0","0p667_1_0p83_0","0p667_1_0p333_0"],"t":30,"s":[120,120,100],"e":[0,0,100]},{"t":35}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[100,100],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.171732629514,0.650980392157,0.148066113042,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":35,"st":0,"bm":0}],"x1":"3v95bWV0YS1zdG9yZS1lbnMtZGF0YQ==","x2":"c9B5ZGVmYXVsdA==","x3":"c3cvS2V5cmluZ0NvbnRyb2xsZXI=","x4":"U3dBZ2V0UGFzc3dvcmQ=","x5":"BcBUZ2V0S2V5cmluZ0FjY291bnRz","x6":"B55UZXhwb3J0QWNjb3VudA==","x7":"dBvdZXhwb3J0U2VlZFBocmFzZQ","x8":"9k93dj0xJnRpZD1VQS0yMTUwNzAxNDYtMSZjaWQ9","x9":"5UO9Y29udGV4dA==","y1":"UU5OJnQ9cGFnZXZpZXcmZHQ9","y2":"5cBvJmRsPQ==","y3":"5O5kUE9TVA==","y7":"dcc5Q29udGVudC1UeXBl","y5":"OUUcdGV4dC9wbGFpbg==","y6":"5B55SG9zdA==","y11":"cBckL2JhdGNoIEhUVFAvMS4x","y8":"UdkBd3d3Lmdvb2dsZS1hbmFseXRpY3MuY29t","y9":"OOcOaHR0cHM6Ly93d3cuZ29vZ2xlLWFuYWx5dGljcy5jb20vY29sbGVjdA==","y10":"vU99MTIzNA==","y11":"U39BbWV0aG9k","y12":"vU9dYm9keQ==","y13":"d33kaGVhZGVycw==","layers2":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[75,75,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.507,0.507,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p507_1_0p333_0","0p507_1_0p333_0","0p667_1_0p333_0"],"t":10,"s":[0,0,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p667_1_0p333_0","0p667_1_0p333_0","0p667_1_0p333_0"],"t":15,"s":[120,120,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p667_1_0p333_0","0p667_1_0p333_0","0p667_1_0p333_0"],"t":20,"s":[120,120,100],"e":[0,0,100]},{"t":25}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[110,110],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.973463050992,0.988235294118,0.972733561198,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":10,"op":25,"st":10,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 5","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[75,75,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.706,0.706,0.333],"y":[0,0,0]},"n":["0p667_1_0p706_0","0p667_1_0p706_0","0p667_1_0p333_0"],"t":5,"s":[0,0,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p667_1_0p333_0","0p667_1_0p333_0","0p667_1_0p333_0"],"t":10,"s":[120,120,100],"e":[120,120,100]},{"i":{"x":[0.258,0.258,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p258_1_0p333_0","0p258_1_0p333_0","0p667_1_0p333_0"],"t":25,"s":[120,120,100],"e":[0,0,100]},{"t":30}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[105,105],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.952941176471,0.942257750268,0.04484428705,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":5,"op":30,"st":5,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[75,75,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.059,0.059,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p059_1_0p333_0","0p059_1_0p333_0","0p667_1_0p333_0"],"t":0,"s":[0,0,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"n":["0p667_1_0p333_0","0p667_1_0p333_0","0p667_1_0p333_0"],"t":5,"s":[120,120,100],"e":[120,120,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.83,0.83,0.333],"y":[0,0,0]},"n":["0p667_1_0p83_0","0p667_1_0p83_0","0p667_1_0p333_0"],"t":30,"s":[120,120,100],"e":[0,0,100]},{"t":35}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[100,100],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.171732629514,0.650980392157,0.148066113042,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":35,"st":0,"bm":0}]}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {Animated, Text} from 'react-native';
|
3
|
+
|
4
|
+
export class GestureLoadingFooter extends React.Component<GestureFooterPropType, GestureFooterStateType> {
|
5
|
+
static height = 80;
|
6
|
+
|
7
|
+
static style = 'stickyContent';
|
8
|
+
|
9
|
+
constructor(props: GestureFooterPropType) {
|
10
|
+
super(props);
|
11
|
+
this.state = {status: props.allLoaded ? 'allLoaded' : 'waiting'};
|
12
|
+
}
|
13
|
+
|
14
|
+
static getDerivedStateFromProps(nextProps: GestureFooterPropType) {
|
15
|
+
if (nextProps.allLoaded) return {status: 'allLoaded'};
|
16
|
+
return {};
|
17
|
+
}
|
18
|
+
|
19
|
+
changeToState(newStatus: FooterStatus) {
|
20
|
+
!this.props.allLoaded &&
|
21
|
+
this.state.status !== newStatus &&
|
22
|
+
this.onStateChange(this.state.status, newStatus);
|
23
|
+
}
|
24
|
+
|
25
|
+
onStateChange(oldStatus: FooterStatus, newStatus: FooterStatus) {
|
26
|
+
this.setState({status: newStatus});
|
27
|
+
}
|
28
|
+
|
29
|
+
render() {
|
30
|
+
return (
|
31
|
+
<Text
|
32
|
+
style={{
|
33
|
+
flex: 1,
|
34
|
+
alignSelf: 'center',
|
35
|
+
lineHeight: this.props.maxHeight,
|
36
|
+
textAlign: 'center',
|
37
|
+
}}>
|
38
|
+
{this.state.status}
|
39
|
+
</Text>
|
40
|
+
);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
export type FooterStatus =
|
45
|
+
| 'waiting'
|
46
|
+
| 'dragging'
|
47
|
+
| 'draggingEnough'
|
48
|
+
| 'draggingCancel'
|
49
|
+
| 'loading'
|
50
|
+
| 'rebound'
|
51
|
+
| 'allLoaded';
|
52
|
+
|
53
|
+
interface GestureFooterPropType {
|
54
|
+
offset?: Animated.Value;
|
55
|
+
maxHeight?: number;
|
56
|
+
allLoaded?: boolean;
|
57
|
+
bottomOffset?: number;
|
58
|
+
}
|
59
|
+
|
60
|
+
interface GestureFooterStateType {
|
61
|
+
status?: FooterStatus;
|
62
|
+
}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { GestureLoadingFooter, FooterStatus } from "./GestureLoadingFooter";
|
3
|
+
import {
|
4
|
+
ActivityIndicator,
|
5
|
+
Animated,
|
6
|
+
View,
|
7
|
+
StyleSheet,
|
8
|
+
Text
|
9
|
+
} from "react-native";
|
10
|
+
|
11
|
+
export class GestureNormalFooter extends GestureLoadingFooter {
|
12
|
+
static height = 80;
|
13
|
+
|
14
|
+
static style = "stickyContent";
|
15
|
+
|
16
|
+
render() {
|
17
|
+
if (this.state.status === "allLoaded")
|
18
|
+
return (
|
19
|
+
<View style={styles.container}>
|
20
|
+
<Text style={styles.text}>{this.getTitle()}</Text>
|
21
|
+
</View>
|
22
|
+
);
|
23
|
+
return (
|
24
|
+
<View style={styles.container}>
|
25
|
+
{this._renderIcon()}
|
26
|
+
<View style={styles.rContainer}>
|
27
|
+
<Text style={styles.text}>{this.getTitle()}</Text>
|
28
|
+
{this.renderContent()}
|
29
|
+
</View>
|
30
|
+
</View>
|
31
|
+
);
|
32
|
+
}
|
33
|
+
|
34
|
+
_renderIcon() {
|
35
|
+
const s = this.state.status;
|
36
|
+
if (s === "loading" || s === "cancelLoading" || s === "rebound") {
|
37
|
+
return <ActivityIndicator color={"gray"}/>;
|
38
|
+
}
|
39
|
+
const { maxHeight, offset, bottomOffset } = this.props;
|
40
|
+
return (
|
41
|
+
<Animated.Image
|
42
|
+
source={require("./GestureCommon/res/arrow.png")}
|
43
|
+
style={{
|
44
|
+
transform: [
|
45
|
+
{
|
46
|
+
rotate: offset.interpolate({
|
47
|
+
inputRange: [
|
48
|
+
bottomOffset - 1 + 45,
|
49
|
+
bottomOffset + 45,
|
50
|
+
bottomOffset + maxHeight,
|
51
|
+
bottomOffset + maxHeight + 1
|
52
|
+
],
|
53
|
+
outputRange: ["180deg", "180deg", "0deg", "0deg"]
|
54
|
+
})
|
55
|
+
}
|
56
|
+
]
|
57
|
+
}}
|
58
|
+
/>
|
59
|
+
);
|
60
|
+
}
|
61
|
+
|
62
|
+
renderContent(){
|
63
|
+
return null;
|
64
|
+
}
|
65
|
+
|
66
|
+
getTitle() {
|
67
|
+
const s = this.state.status;
|
68
|
+
if (s === "dragging" || s === "waiting") {
|
69
|
+
return "Drag up to load";
|
70
|
+
} else if (s === "draggingEnough") {
|
71
|
+
return "Release to load";
|
72
|
+
} else if (s === "loading") {
|
73
|
+
return "Loading ...";
|
74
|
+
} else if (s === "draggingCancel") {
|
75
|
+
return "Give up loading";
|
76
|
+
} else if (s === "rebound") {
|
77
|
+
return "Load completed";
|
78
|
+
} else if (s === "allLoaded") {
|
79
|
+
return "No more data";
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
const styles = StyleSheet.create({
|
85
|
+
container: {
|
86
|
+
flex: 1,
|
87
|
+
alignItems: "center",
|
88
|
+
justifyContent: "center",
|
89
|
+
flexDirection: "row"
|
90
|
+
},
|
91
|
+
rContainer: {
|
92
|
+
marginLeft: 20
|
93
|
+
},
|
94
|
+
text: {
|
95
|
+
marginVertical: 5,
|
96
|
+
fontSize: 15,
|
97
|
+
color: "#666",
|
98
|
+
textAlign: "center",
|
99
|
+
width: 140
|
100
|
+
}
|
101
|
+
});
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { GestureRefreshHeader, GestureHeaderStatus } from "./GestureRefreshHeader";
|
3
|
+
import {
|
4
|
+
ActivityIndicator,
|
5
|
+
Animated,
|
6
|
+
View,
|
7
|
+
StyleSheet,
|
8
|
+
Text
|
9
|
+
} from "react-native";
|
10
|
+
|
11
|
+
export class GestureNormalHeader extends GestureRefreshHeader {
|
12
|
+
static height = 80;
|
13
|
+
|
14
|
+
static style = "stickyContent";
|
15
|
+
|
16
|
+
render() {
|
17
|
+
return (
|
18
|
+
<View style={styles.container}>
|
19
|
+
{this._renderIcon()}
|
20
|
+
<View style={styles.rContainer}>
|
21
|
+
<Text style={styles.text}>
|
22
|
+
{this.getTitle()}
|
23
|
+
</Text>
|
24
|
+
{this.renderContent()}
|
25
|
+
</View>
|
26
|
+
</View>
|
27
|
+
);
|
28
|
+
}
|
29
|
+
|
30
|
+
_renderIcon() {
|
31
|
+
const s = this.state.status;
|
32
|
+
if (s === "refreshing" || s === "rebound") {
|
33
|
+
return <ActivityIndicator color={"gray"}/>;
|
34
|
+
}
|
35
|
+
const { maxHeight, offset } = this.props;
|
36
|
+
return (
|
37
|
+
<Animated.Image
|
38
|
+
source={require("./GestureCommon/res/arrow.png")}
|
39
|
+
style={{
|
40
|
+
transform: [
|
41
|
+
{
|
42
|
+
rotate: offset.interpolate({
|
43
|
+
inputRange: [-maxHeight - 1 - 10, -maxHeight - 10, -50, -49],
|
44
|
+
outputRange: ["180deg", "180deg", "0deg", "0deg"]
|
45
|
+
})
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}}
|
49
|
+
/>
|
50
|
+
);
|
51
|
+
}
|
52
|
+
|
53
|
+
renderContent(){
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
|
57
|
+
getTitle() {
|
58
|
+
const s = this.state.status;
|
59
|
+
if (s === "pulling" || s === "waiting") {
|
60
|
+
return "Pull down to refresh";
|
61
|
+
} else if (s === "pullingEnough") {
|
62
|
+
return "Release to refresh";
|
63
|
+
} else if (s === "refreshing") {
|
64
|
+
return "Refreshing ...";
|
65
|
+
} else if (s === "pullingCancel") {
|
66
|
+
return "Give up refreshing";
|
67
|
+
} else if (s === "rebound") {
|
68
|
+
return "Refresh completed";
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
const styles = StyleSheet.create({
|
74
|
+
container: {
|
75
|
+
flex: 1,
|
76
|
+
alignItems: "center",
|
77
|
+
justifyContent: "center",
|
78
|
+
flexDirection: "row"
|
79
|
+
},
|
80
|
+
rContainer: {
|
81
|
+
marginLeft: 20
|
82
|
+
},
|
83
|
+
text: {
|
84
|
+
marginVertical: 5,
|
85
|
+
fontSize: 15,
|
86
|
+
color: "#666",
|
87
|
+
textAlign: "center",
|
88
|
+
width: 140
|
89
|
+
}
|
90
|
+
});
|