UNPKG

4.56 kBTypeScriptView Raw
1import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
2import { GestureUpdateEvent } from '../gestureHandlerCommon';
3import { PanGestureConfig } from '../PanGestureHandler';
4import type { PanGestureHandlerEventPayload } from '../GestureHandlerEventPayload';
5export type PanGestureChangeEventPayload = {
6 changeX: number;
7 changeY: number;
8};
9export declare class PanGesture extends ContinousBaseGesture<PanGestureHandlerEventPayload, PanGestureChangeEventPayload> {
10 config: BaseGestureConfig & PanGestureConfig;
11 constructor();
12 /**
13 * Range along Y axis (in points) where fingers travels without activation of gesture.
14 * @param offset
15 * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetyvalue-number--number
16 */
17 activeOffsetY(offset: number | [activeOffsetYStart: number, activeOffsetYEnd: number]): this;
18 /**
19 * Range along X axis (in points) where fingers travels without activation of gesture.
20 * @param offset
21 * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetxvalue-number--number
22 */
23 activeOffsetX(offset: number | [activeOffsetXStart: number, activeOffsetXEnd: number]): this;
24 /**
25 * When the finger moves outside this range (in points) along Y axis and gesture hasn't yet activated it will fail recognizing the gesture.
26 * @param offset
27 * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetyvalue-number--number
28 */
29 failOffsetY(offset: number | [failOffsetYStart: number, failOffsetYEnd: number]): this;
30 /**
31 * When the finger moves outside this range (in points) along X axis and gesture hasn't yet activated it will fail recognizing the gesture.
32 * @param offset
33 * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetxvalue-number--number
34 */
35 failOffsetX(offset: number | [failOffsetXStart: number, failOffsetXEnd: number]): this;
36 /**
37 * A number of fingers that is required to be placed before gesture can activate. Should be a higher or equal to 0 integer.
38 * @param minPointers
39 */
40 minPointers(minPointers: number): this;
41 /**
42 * When the given number of fingers is placed on the screen and gesture hasn't yet activated it will fail recognizing the gesture.
43 * Should be a higher or equal to 0 integer.
44 * @param maxPointers
45 */
46 maxPointers(maxPointers: number): this;
47 /**
48 * Minimum distance the finger (or multiple finger) need to travel before the gesture activates.
49 * Expressed in points.
50 * @param distance
51 */
52 minDistance(distance: number): this;
53 /**
54 * Minimum velocity the finger has to reach in order to activate handler.
55 * @param velocity
56 */
57 minVelocity(velocity: number): this;
58 /**
59 * Minimum velocity along X axis the finger has to reach in order to activate handler.
60 * @param velocity
61 */
62 minVelocityX(velocity: number): this;
63 /**
64 * Minimum velocity along Y axis the finger has to reach in order to activate handler.
65 * @param velocity
66 */
67 minVelocityY(velocity: number): this;
68 /**
69 * #### Android only
70 * Android, by default, will calculate translation values based on the position of the leading pointer (the first one that was placed on the screen).
71 * This modifier allows that behavior to be changed to the one that is default on iOS - the averaged position of all active pointers will be used to calculate the translation values.
72 * @param value
73 */
74 averageTouches(value: boolean): this;
75 /**
76 * #### iOS only
77 * Enables two-finger gestures on supported devices, for example iPads with trackpads.
78 * @param value
79 * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#enabletrackpadtwofingergesturevalue-boolean-ios-only
80 */
81 enableTrackpadTwoFingerGesture(value: boolean): this;
82 /**
83 * Duration in milliseconds of the LongPress gesture before Pan is allowed to activate.
84 * @param duration
85 * @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#activateafterlongpressduration-number
86 */
87 activateAfterLongPress(duration: number): this;
88 onChange(callback: (event: GestureUpdateEvent<PanGestureHandlerEventPayload & PanGestureChangeEventPayload>) => void): this;
89}
90export type PanGestureType = InstanceType<typeof PanGesture>;