forked from bolan9999/react-native-spring-scrollview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
124 lines (108 loc) · 3.13 KB
/
index.d.ts
File metadata and controls
124 lines (108 loc) · 3.13 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
* Author: Shi(bolan0000@icloud.com)
* Date: 2018/7/26
* Copyright (c) 2018, AoTang, Inc.
*
* Description:
*/
declare module "react-native-spring-scrollview" {
import { Animated, ViewProps, ViewStyle } from "react-native";
import * as React from "react";
export interface Offset {
x: number;
y: number;
}
export interface Size {
width:number;
height:number;
}
export interface NativeContentOffset {
x?: Animated.Value;
y?: Animated.Value;
}
export type RefreshStyle = "topping" | "stickyScrollView" | "stickyContent";
export type LoadingStyle = "bottoming" | "stickyScrollView" | "stickyContent";
export interface ScrollEvent {
nativeEvent: {
contentOffset: {
x: number;
y: number;
};
};
}
export type HeaderStatus =
| "waiting"
| "pulling"
| "pullingEnough"
| "pullingCancel"
| "refreshing"
| "rebound";
export interface RefreshHeaderPropType {
maxHeight: number;
offset: Animated.Value;
}
export interface RefreshHeaderStateType {
status: HeaderStatus;
}
export class RefreshHeader extends React.Component<
RefreshHeaderPropType,
RefreshHeaderStateType
> {}
export class NormalHeader extends RefreshHeader {}
export type FooterStatus =
| "waiting"
| "dragging"
| "draggingEnough"
| "draggingCancel"
| "releaseRebound"
| "loading"
| "rebound"
| "allLoaded";
export interface LoadingFooterPropType {
maxHeight: number;
offset: Animated.Value;
bottomOffset: number;
}
export interface LoadingFooterStateType {
status: FooterStatus;
}
export class LoadingFooter extends React.Component<
LoadingFooterPropType,
LoadingFooterStateType
> {}
export class NormalFooter extends LoadingFooter {}
export interface SpringScrollViewPropType extends ViewProps {
contentStyle?: ViewStyle;
bounces?: boolean;
scrollEnabled?: boolean;
directionalLockEnabled?: boolean;
initialContentOffset?: Offset;
showsVerticalScrollIndicator?: boolean;
showsHorizontalScrollIndicator?: boolean;
refreshHeader?: React.ComponentClass<RefreshHeaderPropType, RefreshHeaderStateType>;
loadingFooter?: React.ComponentClass<LoadingFooterPropType, LoadingFooterStateType>;
onRefresh?: () => any;
onLoading?: () => any;
allLoaded?: boolean;
textInputRefs?: any[];
inputToolBarHeight?: number;
tapToHideKeyboard?: boolean;
onTouchBegin?: () => any;
onTouchEnd?: () => any;
inverted?: boolean;
onMomentumScrollBegin?: () => any;
onMomentumScrollEnd?: () => any;
onScroll?: (evt: ScrollEvent) => any;
onNativeContentOffsetExtract?: NativeContentOffset;
onSizeChange?: (size:Size) => any;
onContentSizeChange?: (size: Size) => any;
}
export class SpringScrollView extends React.PureComponent<SpringScrollViewPropType> {
scrollTo(offset: Offset, animated?: boolean): Promise<void>;
scroll(offset: Offset, animated?: boolean): Promise<void>;
scrollToBegin(animated?: boolean): Promise<void>;
scrollToEnd(animated?: boolean): Promise<void>;
endRefresh(): void;
endLoading(): void;
}
}