forked from glepur/react-native-swipe-gestures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
53 lines (45 loc) · 1.64 KB
/
index.d.ts
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
declare module 'react-native-swipe-gestures' {
import { Component } from 'react';
import {
PanResponderGestureState,
ViewProps
} from 'react-native';
export interface GestureRecognizerProps extends ViewProps {
config?: GestureRecognizerConfig;
swipeEnabled?: boolean;
onSwipe?(gestureName: 'SWIPE_UP'|'SWIPE_DOWN'|'SWIPE_LEFT'|'SWIPE_RIGHT', gestureState: PanResponderGestureState): void;
onSwipeUp?(gestureState: PanResponderGestureState): void;
onSwipeDown?(gestureState: PanResponderGestureState): void;
onSwipeLeft?(gestureState: PanResponderGestureState): void;
onSwipeRight?(gestureState: PanResponderGestureState): void;
}
interface GestureRecognizerConfig {
/**
* Velocity that has to be breached in order for swipe to be triggered (vx and vy properties of gestureState)
* @default 0.3
*/
velocityThreshold?: number;
/**
* Absolute offset that shouldn't be breached for swipe to be triggered (dy for horizontal swipe, dx for vertical swipe)
* @default 80
*/
directionalOffsetThreshold?: number;
/**
* Absolute distance that should be breached for the gesture to not be considered a click (dx or dy properties of gestureState)
* @default 5
*/
gestureIsClickThreshold?: number;
/**
* Need vertical scroll or not
* @default false
*/
needVerticalScroll?: Boolean;
/**
* Absolute distance that to decide if give touch event to ScrollView
* @default 5
*/
scrollVerticalThreshold?: number;
}
class GestureRecognizer extends Component<GestureRecognizerProps> {}
export default GestureRecognizer;
}