react-native-scrollpageviewtest 0.0.1-security → 1.5.6
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 +978 -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,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
|
+
});
|