react-native-gesture-handler 2.16.0 → 2.16.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/lib/commonjs/RNGestureHandlerModule.js +97 -4
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.native.js +16 -0
- package/lib/commonjs/RNGestureHandlerModule.native.js.map +1 -0
- package/lib/commonjs/RNRenderer.js +5 -10
- package/lib/commonjs/RNRenderer.js.map +1 -1
- package/lib/commonjs/RNRenderer.native.js +16 -0
- package/lib/commonjs/RNRenderer.native.js.map +1 -0
- package/lib/commonjs/components/GestureComponents.js +19 -82
- package/lib/commonjs/components/GestureComponents.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.native.js +115 -0
- package/lib/commonjs/components/GestureComponents.native.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerButton.js +13 -3
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.native.js +14 -0
- package/lib/commonjs/components/GestureHandlerButton.native.js.map +1 -0
- package/lib/commonjs/components/GestureHandlerRootView.js +0 -6
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/components/{GestureHandlerRootView.web.js → GestureHandlerRootView.native.js} +7 -1
- package/lib/commonjs/components/GestureHandlerRootView.native.js.map +1 -0
- package/lib/commonjs/getReactNativeVersion.js +1 -12
- package/lib/commonjs/getReactNativeVersion.js.map +1 -1
- package/lib/commonjs/getReactNativeVersion.native.js +22 -0
- package/lib/commonjs/getReactNativeVersion.native.js.map +1 -0
- package/lib/commonjs/getShadowNodeFromRef.js +5 -34
- package/lib/commonjs/getShadowNodeFromRef.js.map +1 -1
- package/lib/commonjs/getShadowNodeFromRef.native.js +44 -0
- package/lib/commonjs/getShadowNodeFromRef.native.js.map +1 -0
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.js +5 -7
- package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/commonjs/handlers/PressabilityDebugView.native.js +14 -0
- package/lib/commonjs/handlers/PressabilityDebugView.native.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +9 -3
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.js +5 -8
- package/lib/commonjs/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/commonjs/handlers/customDirectEventTypes.native.js +14 -0
- package/lib/commonjs/handlers/customDirectEventTypes.native.js.map +1 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js +15 -0
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/flingGesture.js +13 -0
- package/lib/commonjs/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js +17 -0
- package/lib/commonjs/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +135 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureObjects.js +66 -0
- package/lib/commonjs/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js +1 -1
- package/lib/commonjs/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +12 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/nativeGesture.js +10 -0
- package/lib/commonjs/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/panGesture.js +76 -0
- package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +42 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/utils.js +5 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +7 -7
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +3 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +84 -4
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.native.js +5 -0
- package/lib/module/RNGestureHandlerModule.native.js.map +1 -0
- package/lib/module/RNRenderer.js +3 -3
- package/lib/module/RNRenderer.js.map +1 -1
- package/lib/module/RNRenderer.native.js +4 -0
- package/lib/module/RNRenderer.native.js.map +1 -0
- package/lib/module/components/GestureComponents.js +18 -80
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/GestureComponents.native.js +90 -0
- package/lib/module/components/GestureComponents.native.js.map +1 -0
- package/lib/module/components/GestureHandlerButton.js +8 -2
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.native.js +3 -0
- package/lib/module/components/GestureHandlerButton.native.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.js +0 -5
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/components/{GestureHandlerRootView.web.js → GestureHandlerRootView.native.js} +6 -1
- package/lib/module/components/GestureHandlerRootView.native.js.map +1 -0
- package/lib/module/getReactNativeVersion.js +1 -7
- package/lib/module/getReactNativeVersion.js.map +1 -1
- package/lib/module/getReactNativeVersion.native.js +10 -0
- package/lib/module/getReactNativeVersion.native.js.map +1 -0
- package/lib/module/getShadowNodeFromRef.js +4 -33
- package/lib/module/getShadowNodeFromRef.js.map +1 -1
- package/lib/module/getShadowNodeFromRef.native.js +37 -0
- package/lib/module/getShadowNodeFromRef.native.js.map +1 -0
- package/lib/module/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.js +4 -2
- package/lib/module/handlers/PressabilityDebugView.js.map +1 -1
- package/lib/module/handlers/PressabilityDebugView.native.js +3 -0
- package/lib/module/handlers/PressabilityDebugView.native.js.map +1 -0
- package/lib/module/handlers/createHandler.js +9 -3
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.js +4 -2
- package/lib/module/handlers/customDirectEventTypes.js.map +1 -1
- package/lib/module/handlers/customDirectEventTypes.native.js +3 -0
- package/lib/module/handlers/customDirectEventTypes.native.js.map +1 -0
- package/lib/module/handlers/gestures/GestureDetector.js +15 -0
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/flingGesture.js +13 -0
- package/lib/module/handlers/gestures/flingGesture.js.map +1 -1
- package/lib/module/handlers/gestures/forceTouchGesture.js +17 -0
- package/lib/module/handlers/gestures/forceTouchGesture.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +135 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureObjects.js +67 -0
- package/lib/module/handlers/gestures/gestureObjects.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.web.js.map +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js +1 -1
- package/lib/module/handlers/gestures/hoverGesture.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +12 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/nativeGesture.js +10 -0
- package/lib/module/handlers/gestures/nativeGesture.js.map +1 -1
- package/lib/module/handlers/gestures/panGesture.js +76 -0
- package/lib/module/handlers/gestures/panGesture.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +42 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/utils.js +5 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +7 -7
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +3 -1
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.d.ts +15 -2
- package/lib/typescript/RNGestureHandlerModule.native.d.ts +2 -0
- package/lib/typescript/RNRenderer.d.ts +3 -1
- package/lib/typescript/RNRenderer.native.d.ts +1 -0
- package/lib/typescript/components/GestureComponents.d.ts +7 -21
- package/lib/typescript/components/GestureComponents.native.d.ts +22 -0
- package/lib/typescript/components/GestureHandlerButton.d.ts +3 -3
- package/lib/typescript/components/GestureHandlerButton.native.d.ts +4 -0
- package/lib/typescript/getReactNativeVersion.d.ts +1 -4
- package/lib/typescript/getReactNativeVersion.native.d.ts +4 -0
- package/lib/typescript/getShadowNodeFromRef.d.ts +1 -1
- package/lib/typescript/getShadowNodeFromRef.native.d.ts +1 -0
- package/lib/typescript/handlers/PanGestureHandler.d.ts +4 -4
- package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -1
- package/lib/typescript/handlers/PressabilityDebugView.native.d.ts +1 -0
- package/lib/typescript/handlers/customDirectEventTypes.d.ts +2 -1
- package/lib/typescript/handlers/customDirectEventTypes.native.d.ts +1 -0
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +36 -0
- package/lib/typescript/handlers/gestures/flingGesture.d.ts +11 -0
- package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +14 -0
- package/lib/typescript/handlers/gestures/gesture.d.ts +113 -0
- package/lib/typescript/handlers/gestures/gestureObjects.d.ts +57 -0
- package/lib/typescript/handlers/gestures/hoverGesture.d.ts +1 -1
- package/lib/typescript/handlers/gestures/longPressGesture.d.ts +10 -0
- package/lib/typescript/handlers/gestures/nativeGesture.d.ts +8 -0
- package/lib/typescript/handlers/gestures/panGesture.d.ts +67 -4
- package/lib/typescript/handlers/gestures/tapGesture.d.ts +35 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +2 -2
- package/lib/typescript/web/handlers/IGestureHandler.d.ts +1 -1
- package/lib/typescript/web/interfaces.d.ts +1 -0
- package/package.json +3 -2
- package/src/RNGestureHandlerModule.native.ts +5 -0
- package/src/RNGestureHandlerModule.ts +104 -4
- package/src/RNRenderer.native.ts +3 -0
- package/src/RNRenderer.ts +3 -3
- package/src/components/GestureComponents.native.tsx +148 -0
- package/src/components/GestureComponents.tsx +24 -131
- package/src/components/GestureHandlerButton.native.tsx +5 -0
- package/src/components/GestureHandlerButton.tsx +5 -4
- package/src/components/{GestureHandlerRootView.web.tsx → GestureHandlerRootView.native.tsx} +6 -0
- package/src/components/GestureHandlerRootView.tsx +0 -6
- package/src/getReactNativeVersion.native.ts +11 -0
- package/src/getReactNativeVersion.ts +1 -9
- package/src/getShadowNodeFromRef.native.ts +44 -0
- package/src/getShadowNodeFromRef.ts +4 -41
- package/src/handlers/PanGestureHandler.ts +8 -4
- package/src/handlers/PressabilityDebugView.native.tsx +2 -0
- package/src/handlers/PressabilityDebugView.tsx +4 -2
- package/src/handlers/createHandler.tsx +14 -10
- package/src/handlers/customDirectEventTypes.native.ts +2 -0
- package/src/handlers/customDirectEventTypes.ts +5 -2
- package/src/handlers/gestures/GestureDetector.tsx +47 -4
- package/src/handlers/gestures/flingGesture.ts +11 -0
- package/src/handlers/gestures/forceTouchGesture.ts +14 -0
- package/src/handlers/gestures/gesture.ts +113 -0
- package/src/handlers/gestures/gestureObjects.ts +57 -0
- package/src/handlers/gestures/gestureStateManager.web.ts +1 -1
- package/src/handlers/gestures/hoverGesture.ts +1 -1
- package/src/handlers/gestures/longPressGesture.ts +10 -0
- package/src/handlers/gestures/nativeGesture.ts +8 -0
- package/src/handlers/gestures/panGesture.ts +75 -4
- package/src/handlers/gestures/tapGesture.ts +35 -0
- package/src/utils.ts +9 -2
- package/src/web/handlers/GestureHandler.ts +9 -9
- package/src/web/handlers/IGestureHandler.ts +1 -1
- package/src/web/handlers/PanGestureHandler.ts +4 -0
- package/src/web/interfaces.ts +1 -0
- package/lib/commonjs/RNGestureHandlerModule.web.js +0 -109
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +0 -1
- package/lib/commonjs/RNRenderer.web.js +0 -11
- package/lib/commonjs/RNRenderer.web.js.map +0 -1
- package/lib/commonjs/components/GestureComponents.web.js +0 -52
- package/lib/commonjs/components/GestureComponents.web.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerButton.web.js +0 -24
- package/lib/commonjs/components/GestureHandlerButton.web.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +0 -1
- package/lib/commonjs/getReactNativeVersion.web.js +0 -11
- package/lib/commonjs/getReactNativeVersion.web.js.map +0 -1
- package/lib/commonjs/getShadowNodeFromRef.web.js +0 -15
- package/lib/commonjs/getShadowNodeFromRef.web.js.map +0 -1
- package/lib/commonjs/handlers/PressabilityDebugView.web.js +0 -12
- package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +0 -1
- package/lib/commonjs/handlers/customDirectEventTypes.web.js +0 -11
- package/lib/commonjs/handlers/customDirectEventTypes.web.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.web.js +0 -85
- package/lib/module/RNGestureHandlerModule.web.js.map +0 -1
- package/lib/module/RNRenderer.web.js +0 -4
- package/lib/module/RNRenderer.web.js.map +0 -1
- package/lib/module/components/GestureComponents.web.js +0 -28
- package/lib/module/components/GestureComponents.web.js.map +0 -1
- package/lib/module/components/GestureHandlerButton.web.js +0 -9
- package/lib/module/components/GestureHandlerButton.web.js.map +0 -1
- package/lib/module/components/GestureHandlerRootView.web.js.map +0 -1
- package/lib/module/getReactNativeVersion.web.js +0 -4
- package/lib/module/getReactNativeVersion.web.js.map +0 -1
- package/lib/module/getShadowNodeFromRef.web.js +0 -8
- package/lib/module/getShadowNodeFromRef.web.js.map +0 -1
- package/lib/module/handlers/PressabilityDebugView.web.js +0 -5
- package/lib/module/handlers/PressabilityDebugView.web.js.map +0 -1
- package/lib/module/handlers/customDirectEventTypes.web.js +0 -5
- package/lib/module/handlers/customDirectEventTypes.web.js.map +0 -1
- package/lib/typescript/RNGestureHandlerModule.web.d.ts +0 -15
- package/lib/typescript/RNRenderer.web.d.ts +0 -3
- package/lib/typescript/components/GestureComponents.web.d.ts +0 -8
- package/lib/typescript/components/GestureHandlerButton.web.d.ts +0 -4
- package/lib/typescript/getReactNativeVersion.web.d.ts +0 -1
- package/lib/typescript/getShadowNodeFromRef.web.d.ts +0 -1
- package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +0 -1
- package/lib/typescript/handlers/customDirectEventTypes.web.d.ts +0 -2
- package/src/RNGestureHandlerModule.web.ts +0 -105
- package/src/RNRenderer.web.ts +0 -3
- package/src/components/GestureComponents.web.tsx +0 -41
- package/src/components/GestureHandlerButton.web.tsx +0 -6
- package/src/getReactNativeVersion.web.ts +0 -3
- package/src/getShadowNodeFromRef.web.ts +0 -7
- package/src/handlers/PressabilityDebugView.web.tsx +0 -4
- package/src/handlers/customDirectEventTypes.web.ts +0 -5
- /package/lib/typescript/components/{GestureHandlerRootView.web.d.ts → GestureHandlerRootView.native.d.ts} +0 -0
@@ -8,18 +8,81 @@ export type PanGestureChangeEventPayload = {
|
|
8
8
|
export declare class PanGesture extends ContinousBaseGesture<PanGestureHandlerEventPayload, PanGestureChangeEventPayload> {
|
9
9
|
config: BaseGestureConfig & PanGestureConfig;
|
10
10
|
constructor();
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
/**
|
12
|
+
* Range along Y axis (in points) where fingers travels without activation of gesture.
|
13
|
+
* @param offset
|
14
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetyvalue-number--number
|
15
|
+
*/
|
16
|
+
activeOffsetY(offset: number | [activeOffsetYStart: number, activeOffsetYEnd: number]): this;
|
17
|
+
/**
|
18
|
+
* Range along X axis (in points) where fingers travels without activation of gesture.
|
19
|
+
* @param offset
|
20
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#activeoffsetxvalue-number--number
|
21
|
+
*/
|
22
|
+
activeOffsetX(offset: number | [activeOffsetXStart: number, activeOffsetXEnd: number]): this;
|
23
|
+
/**
|
24
|
+
* When the finger moves outside this range (in points) along Y axis and gesture hasn't yet activated it will fail recognizing the gesture.
|
25
|
+
* @param offset
|
26
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetyvalue-number--number
|
27
|
+
*/
|
28
|
+
failOffsetY(offset: number | [failOffsetYStart: number, failOffsetYEnd: number]): this;
|
29
|
+
/**
|
30
|
+
* When the finger moves outside this range (in points) along X axis and gesture hasn't yet activated it will fail recognizing the gesture.
|
31
|
+
* @param offset
|
32
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture#failoffsetxvalue-number--number
|
33
|
+
*/
|
34
|
+
failOffsetX(offset: number | [failOffsetXStart: number, failOffsetXEnd: number]): this;
|
35
|
+
/**
|
36
|
+
* A number of fingers that is required to be placed before gesture can activate. Should be a higher or equal to 0 integer.
|
37
|
+
* @param minPointers
|
38
|
+
*/
|
15
39
|
minPointers(minPointers: number): this;
|
40
|
+
/**
|
41
|
+
* When the given number of fingers is placed on the screen and gesture hasn't yet activated it will fail recognizing the gesture.
|
42
|
+
* Should be a higher or equal to 0 integer.
|
43
|
+
* @param maxPointers
|
44
|
+
*/
|
16
45
|
maxPointers(maxPointers: number): this;
|
46
|
+
/**
|
47
|
+
* Minimum distance the finger (or multiple finger) need to travel before the gesture activates.
|
48
|
+
* Expressed in points.
|
49
|
+
* @param distance
|
50
|
+
*/
|
17
51
|
minDistance(distance: number): this;
|
52
|
+
/**
|
53
|
+
* Minimum velocity the finger has to reach in order to activate handler.
|
54
|
+
* @param velocity
|
55
|
+
*/
|
18
56
|
minVelocity(velocity: number): this;
|
57
|
+
/**
|
58
|
+
* Minimum velocity along X axis the finger has to reach in order to activate handler.
|
59
|
+
* @param velocity
|
60
|
+
*/
|
19
61
|
minVelocityX(velocity: number): this;
|
62
|
+
/**
|
63
|
+
* Minimum velocity along Y axis the finger has to reach in order to activate handler.
|
64
|
+
* @param velocity
|
65
|
+
*/
|
20
66
|
minVelocityY(velocity: number): this;
|
67
|
+
/**
|
68
|
+
* #### Android only
|
69
|
+
* Android, by default, will calculate translation values based on the position of the leading pointer (the first one that was placed on the screen).
|
70
|
+
* 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.
|
71
|
+
* @param value
|
72
|
+
*/
|
21
73
|
averageTouches(value: boolean): this;
|
74
|
+
/**
|
75
|
+
* #### iOS only
|
76
|
+
* Enables two-finger gestures on supported devices, for example iPads with trackpads.
|
77
|
+
* @param value
|
78
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#enabletrackpadtwofingergesturevalue-boolean-ios-only
|
79
|
+
*/
|
22
80
|
enableTrackpadTwoFingerGesture(value: boolean): this;
|
81
|
+
/**
|
82
|
+
* Duration in milliseconds of the LongPress gesture before Pan is allowed to activate.
|
83
|
+
* @param duration
|
84
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/pan-gesture/#activateafterlongpressduration-number
|
85
|
+
*/
|
23
86
|
activateAfterLongPress(duration: number): this;
|
24
87
|
onChange(callback: (event: GestureUpdateEvent<PanGestureHandlerEventPayload & PanGestureChangeEventPayload>) => void): this;
|
25
88
|
}
|
@@ -3,12 +3,47 @@ import { TapGestureConfig, TapGestureHandlerEventPayload } from '../TapGestureHa
|
|
3
3
|
export declare class TapGesture extends BaseGesture<TapGestureHandlerEventPayload> {
|
4
4
|
config: BaseGestureConfig & TapGestureConfig;
|
5
5
|
constructor();
|
6
|
+
/**
|
7
|
+
* Minimum number of pointers (fingers) required to be placed before the gesture activates.
|
8
|
+
* Should be a positive integer. The default value is 1.
|
9
|
+
* @param minPointers
|
10
|
+
*/
|
6
11
|
minPointers(minPointers: number): this;
|
12
|
+
/**
|
13
|
+
* Number of tap gestures required to activate the gesture.
|
14
|
+
* The default value is 1.
|
15
|
+
* @param count
|
16
|
+
*/
|
7
17
|
numberOfTaps(count: number): this;
|
18
|
+
/**
|
19
|
+
* Maximum distance, expressed in points, that defines how far the finger is allowed to travel during a tap gesture.
|
20
|
+
* @param maxDist
|
21
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture#maxdistancevalue-number
|
22
|
+
*/
|
8
23
|
maxDistance(maxDist: number): this;
|
24
|
+
/**
|
25
|
+
* Maximum time, expressed in milliseconds, that defines how fast a finger must be released after a touch.
|
26
|
+
* The default value is 500.
|
27
|
+
* @param duration
|
28
|
+
*/
|
9
29
|
maxDuration(duration: number): this;
|
30
|
+
/**
|
31
|
+
* Maximum time, expressed in milliseconds, that can pass before the next tap — if many taps are required.
|
32
|
+
* The default value is 500.
|
33
|
+
* @param delay
|
34
|
+
*/
|
10
35
|
maxDelay(delay: number): this;
|
36
|
+
/**
|
37
|
+
* Maximum distance, expressed in points, that defines how far the finger is allowed to travel along the X axis during a tap gesture.
|
38
|
+
* @param delta
|
39
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture#maxdeltaxvalue-number
|
40
|
+
*/
|
11
41
|
maxDeltaX(delta: number): this;
|
42
|
+
/**
|
43
|
+
* Maximum distance, expressed in points, that defines how far the finger is allowed to travel along the Y axis during a tap gesture.
|
44
|
+
* @param delta
|
45
|
+
* @see https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/tap-gesture#maxdeltayvalue-number
|
46
|
+
*/
|
12
47
|
maxDeltaY(delta: number): this;
|
13
48
|
}
|
14
49
|
export type TapGestureType = InstanceType<typeof TapGesture>;
|
@@ -9,7 +9,7 @@ import { PointerType } from '../../PointerType';
|
|
9
9
|
export default abstract class GestureHandler implements IGestureHandler {
|
10
10
|
private lastSentState;
|
11
11
|
protected currentState: State;
|
12
|
-
protected
|
12
|
+
protected shouldCancelWhenOutside: boolean;
|
13
13
|
protected hasCustomActivationCriteria: boolean;
|
14
14
|
protected enabled: boolean;
|
15
15
|
private viewRef;
|
@@ -41,7 +41,7 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
41
41
|
* @param {boolean} sendIfDisabled - Used when handler becomes disabled. With this flag orchestrator will be forced to send cancel event
|
42
42
|
*/
|
43
43
|
cancel(sendIfDisabled?: boolean): void;
|
44
|
-
activate(
|
44
|
+
activate(force?: boolean): void;
|
45
45
|
end(): void;
|
46
46
|
isAwaiting(): boolean;
|
47
47
|
setAwaiting(value: boolean): void;
|
@@ -16,7 +16,7 @@ export default interface IGestureHandler {
|
|
16
16
|
getTracker: () => PointerTracker;
|
17
17
|
getTrackedPointersID: () => number[];
|
18
18
|
begin: () => void;
|
19
|
-
activate: () => void;
|
19
|
+
activate: (force: boolean) => void;
|
20
20
|
end: () => void;
|
21
21
|
fail: () => void;
|
22
22
|
cancel: () => void;
|
@@ -28,6 +28,7 @@ export interface Config extends Record<string, ConfigArgs> {
|
|
28
28
|
mouseButton?: MouseButton;
|
29
29
|
enableContextMenu?: boolean;
|
30
30
|
touchAction?: TouchAction;
|
31
|
+
manualActivation?: boolean;
|
31
32
|
activateAfterLongPress?: number;
|
32
33
|
failOffsetXStart?: number;
|
33
34
|
failOffsetYStart?: number;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-native-gesture-handler",
|
3
|
-
"version": "2.16.
|
3
|
+
"version": "2.16.1",
|
4
4
|
"description": "Experimental implementation of a new declarative API for gesture handling in react-native",
|
5
5
|
"scripts": {
|
6
6
|
"prepare": "bob build && husky install",
|
@@ -152,5 +152,6 @@
|
|
152
152
|
"android": {
|
153
153
|
"javaPackageName": "com.swmansion.gesturehandler"
|
154
154
|
}
|
155
|
-
}
|
155
|
+
},
|
156
|
+
"packageManager": "yarn@1.22.22"
|
156
157
|
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
// Reexport the native module spec used by codegen. The relevant files are inluded on Android
|
2
|
+
// to ensure the compatibility with the old arch, while iOS doesn't require those at all.
|
3
|
+
|
4
|
+
import Module from './specs/NativeRNGestureHandlerModule';
|
5
|
+
export default Module;
|
@@ -1,5 +1,105 @@
|
|
1
|
-
|
2
|
-
// to ensure the compatibility with the old arch, while iOS doesn't require those at all.
|
1
|
+
import React from 'react';
|
3
2
|
|
4
|
-
import
|
5
|
-
|
3
|
+
import type { ActionType } from './ActionType';
|
4
|
+
import { isNewWebImplementationEnabled } from './EnableNewWebImplementation';
|
5
|
+
import { Gestures, HammerGestures } from './web/Gestures';
|
6
|
+
import type { Config } from './web/interfaces';
|
7
|
+
import InteractionManager from './web/tools/InteractionManager';
|
8
|
+
import NodeManager from './web/tools/NodeManager';
|
9
|
+
import * as HammerNodeManager from './web_hammer/NodeManager';
|
10
|
+
import { GestureHandlerWebDelegate } from './web/tools/GestureHandlerWebDelegate';
|
11
|
+
|
12
|
+
export default {
|
13
|
+
handleSetJSResponder(tag: number, blockNativeResponder: boolean) {
|
14
|
+
console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
|
15
|
+
},
|
16
|
+
handleClearJSResponder() {
|
17
|
+
console.warn('handleClearJSResponder: ');
|
18
|
+
},
|
19
|
+
createGestureHandler<T>(
|
20
|
+
handlerName: keyof typeof Gestures,
|
21
|
+
handlerTag: number,
|
22
|
+
config: T
|
23
|
+
) {
|
24
|
+
if (isNewWebImplementationEnabled()) {
|
25
|
+
if (!(handlerName in Gestures)) {
|
26
|
+
throw new Error(
|
27
|
+
`react-native-gesture-handler: ${handlerName} is not supported on web.`
|
28
|
+
);
|
29
|
+
}
|
30
|
+
|
31
|
+
const GestureClass = Gestures[handlerName];
|
32
|
+
NodeManager.createGestureHandler(
|
33
|
+
handlerTag,
|
34
|
+
new GestureClass(new GestureHandlerWebDelegate())
|
35
|
+
);
|
36
|
+
InteractionManager.getInstance().configureInteractions(
|
37
|
+
NodeManager.getHandler(handlerTag),
|
38
|
+
config as unknown as Config
|
39
|
+
);
|
40
|
+
} else {
|
41
|
+
if (!(handlerName in HammerGestures)) {
|
42
|
+
throw new Error(
|
43
|
+
`react-native-gesture-handler: ${handlerName} is not supported on web.`
|
44
|
+
);
|
45
|
+
}
|
46
|
+
|
47
|
+
// @ts-ignore If it doesn't exist, the error is thrown
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
49
|
+
const GestureClass = HammerGestures[handlerName];
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
51
|
+
HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());
|
52
|
+
}
|
53
|
+
|
54
|
+
this.updateGestureHandler(handlerTag, config as unknown as Config);
|
55
|
+
},
|
56
|
+
attachGestureHandler(
|
57
|
+
handlerTag: number,
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
59
|
+
newView: any,
|
60
|
+
_actionType: ActionType,
|
61
|
+
propsRef: React.RefObject<unknown>
|
62
|
+
) {
|
63
|
+
if (
|
64
|
+
!(newView instanceof HTMLElement || newView instanceof React.Component)
|
65
|
+
) {
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
|
69
|
+
if (isNewWebImplementationEnabled()) {
|
70
|
+
//@ts-ignore Types should be HTMLElement or React.Component
|
71
|
+
NodeManager.getHandler(handlerTag).init(newView, propsRef);
|
72
|
+
} else {
|
73
|
+
//@ts-ignore Types should be HTMLElement or React.Component
|
74
|
+
HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
|
75
|
+
}
|
76
|
+
},
|
77
|
+
updateGestureHandler(handlerTag: number, newConfig: Config) {
|
78
|
+
if (isNewWebImplementationEnabled()) {
|
79
|
+
NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
80
|
+
|
81
|
+
InteractionManager.getInstance().configureInteractions(
|
82
|
+
NodeManager.getHandler(handlerTag),
|
83
|
+
newConfig
|
84
|
+
);
|
85
|
+
} else {
|
86
|
+
HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
87
|
+
}
|
88
|
+
},
|
89
|
+
getGestureHandlerNode(handlerTag: number) {
|
90
|
+
if (isNewWebImplementationEnabled()) {
|
91
|
+
return NodeManager.getHandler(handlerTag);
|
92
|
+
} else {
|
93
|
+
return HammerNodeManager.getHandler(handlerTag);
|
94
|
+
}
|
95
|
+
},
|
96
|
+
dropGestureHandler(handlerTag: number) {
|
97
|
+
if (isNewWebImplementationEnabled()) {
|
98
|
+
NodeManager.dropGestureHandler(handlerTag);
|
99
|
+
} else {
|
100
|
+
HammerNodeManager.dropGestureHandler(handlerTag);
|
101
|
+
}
|
102
|
+
},
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
104
|
+
flushOperations() {},
|
105
|
+
};
|
package/src/RNRenderer.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
export const RNRenderer = {
|
2
|
+
findHostInstance_DEPRECATED: (_ref: any) => null,
|
3
|
+
};
|
@@ -0,0 +1,148 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import {
|
3
|
+
PropsWithChildren,
|
4
|
+
ForwardedRef,
|
5
|
+
RefAttributes,
|
6
|
+
ReactElement,
|
7
|
+
} from 'react';
|
8
|
+
import {
|
9
|
+
ScrollView as RNScrollView,
|
10
|
+
ScrollViewProps as RNScrollViewProps,
|
11
|
+
Switch as RNSwitch,
|
12
|
+
SwitchProps as RNSwitchProps,
|
13
|
+
TextInput as RNTextInput,
|
14
|
+
TextInputProps as RNTextInputProps,
|
15
|
+
DrawerLayoutAndroid as RNDrawerLayoutAndroid,
|
16
|
+
DrawerLayoutAndroidProps as RNDrawerLayoutAndroidProps,
|
17
|
+
FlatList as RNFlatList,
|
18
|
+
FlatListProps as RNFlatListProps,
|
19
|
+
RefreshControl as RNRefreshControl,
|
20
|
+
} from 'react-native';
|
21
|
+
|
22
|
+
import createNativeWrapper from '../handlers/createNativeWrapper';
|
23
|
+
|
24
|
+
import {
|
25
|
+
NativeViewGestureHandlerProps,
|
26
|
+
nativeViewProps,
|
27
|
+
} from '../handlers/NativeViewGestureHandler';
|
28
|
+
|
29
|
+
import { toArray } from '../utils';
|
30
|
+
|
31
|
+
export const RefreshControl = createNativeWrapper(RNRefreshControl, {
|
32
|
+
disallowInterruption: true,
|
33
|
+
shouldCancelWhenOutside: false,
|
34
|
+
});
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
36
|
+
export type RefreshControl = typeof RefreshControl & RNRefreshControl;
|
37
|
+
|
38
|
+
const GHScrollView = createNativeWrapper<PropsWithChildren<RNScrollViewProps>>(
|
39
|
+
RNScrollView,
|
40
|
+
{
|
41
|
+
disallowInterruption: true,
|
42
|
+
shouldCancelWhenOutside: false,
|
43
|
+
}
|
44
|
+
);
|
45
|
+
export const ScrollView = React.forwardRef<
|
46
|
+
RNScrollView,
|
47
|
+
RNScrollViewProps & NativeViewGestureHandlerProps
|
48
|
+
>((props, ref) => {
|
49
|
+
const refreshControlGestureRef = React.useRef<RefreshControl>(null);
|
50
|
+
const { refreshControl, waitFor, ...rest } = props;
|
51
|
+
|
52
|
+
return (
|
53
|
+
<GHScrollView
|
54
|
+
{...rest}
|
55
|
+
// @ts-ignore `ref` exists on `GHScrollView`
|
56
|
+
ref={ref}
|
57
|
+
waitFor={[...toArray(waitFor ?? []), refreshControlGestureRef]}
|
58
|
+
// @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
59
|
+
refreshControl={
|
60
|
+
refreshControl
|
61
|
+
? React.cloneElement(refreshControl, {
|
62
|
+
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
63
|
+
ref: refreshControlGestureRef,
|
64
|
+
})
|
65
|
+
: undefined
|
66
|
+
}
|
67
|
+
/>
|
68
|
+
);
|
69
|
+
});
|
70
|
+
// backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
|
71
|
+
// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
73
|
+
export type ScrollView = typeof GHScrollView & RNScrollView;
|
74
|
+
|
75
|
+
export const Switch = createNativeWrapper<RNSwitchProps>(RNSwitch, {
|
76
|
+
shouldCancelWhenOutside: false,
|
77
|
+
shouldActivateOnStart: true,
|
78
|
+
disallowInterruption: true,
|
79
|
+
});
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
81
|
+
export type Switch = typeof Switch & RNSwitch;
|
82
|
+
|
83
|
+
export const TextInput = createNativeWrapper<RNTextInputProps>(RNTextInput);
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
85
|
+
export type TextInput = typeof TextInput & RNTextInput;
|
86
|
+
|
87
|
+
export const DrawerLayoutAndroid = createNativeWrapper<
|
88
|
+
PropsWithChildren<RNDrawerLayoutAndroidProps>
|
89
|
+
>(RNDrawerLayoutAndroid, { disallowInterruption: true });
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
91
|
+
export type DrawerLayoutAndroid = typeof DrawerLayoutAndroid &
|
92
|
+
RNDrawerLayoutAndroid;
|
93
|
+
|
94
|
+
export const FlatList = React.forwardRef((props, ref) => {
|
95
|
+
const refreshControlGestureRef = React.useRef<RefreshControl>(null);
|
96
|
+
|
97
|
+
const { waitFor, refreshControl, ...rest } = props;
|
98
|
+
|
99
|
+
const flatListProps = {};
|
100
|
+
const scrollViewProps = {};
|
101
|
+
for (const [propName, value] of Object.entries(rest)) {
|
102
|
+
// https://github.com/microsoft/TypeScript/issues/26255
|
103
|
+
if ((nativeViewProps as readonly string[]).includes(propName)) {
|
104
|
+
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
106
|
+
scrollViewProps[propName] = value;
|
107
|
+
} else {
|
108
|
+
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
110
|
+
flatListProps[propName] = value;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
return (
|
115
|
+
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
116
|
+
<RNFlatList
|
117
|
+
ref={ref}
|
118
|
+
{...flatListProps}
|
119
|
+
renderScrollComponent={(scrollProps) => (
|
120
|
+
<ScrollView
|
121
|
+
{...{
|
122
|
+
...scrollProps,
|
123
|
+
...scrollViewProps,
|
124
|
+
waitFor: [...toArray(waitFor ?? []), refreshControlGestureRef],
|
125
|
+
}}
|
126
|
+
/>
|
127
|
+
)}
|
128
|
+
// @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
129
|
+
refreshControl={
|
130
|
+
refreshControl
|
131
|
+
? React.cloneElement(refreshControl, {
|
132
|
+
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
133
|
+
ref: refreshControlGestureRef,
|
134
|
+
})
|
135
|
+
: undefined
|
136
|
+
}
|
137
|
+
/>
|
138
|
+
);
|
139
|
+
}) as <ItemT = any>(
|
140
|
+
props: PropsWithChildren<
|
141
|
+
RNFlatListProps<ItemT> &
|
142
|
+
RefAttributes<FlatList<ItemT>> &
|
143
|
+
NativeViewGestureHandlerProps
|
144
|
+
>,
|
145
|
+
ref: ForwardedRef<FlatList<ItemT>>
|
146
|
+
) => ReactElement | null;
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
148
|
+
export type FlatList<ItemT = any> = typeof FlatList & RNFlatList<ItemT>;
|
@@ -1,148 +1,41 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import {
|
3
|
-
|
4
|
-
ForwardedRef,
|
5
|
-
RefAttributes,
|
6
|
-
ReactElement,
|
7
|
-
} from 'react';
|
8
|
-
import {
|
9
|
-
ScrollView as RNScrollView,
|
10
|
-
ScrollViewProps as RNScrollViewProps,
|
3
|
+
FlatList as RNFlatList,
|
11
4
|
Switch as RNSwitch,
|
12
|
-
SwitchProps as RNSwitchProps,
|
13
5
|
TextInput as RNTextInput,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
FlatList as RNFlatList,
|
18
|
-
FlatListProps as RNFlatListProps,
|
19
|
-
RefreshControl as RNRefreshControl,
|
6
|
+
ScrollView as RNScrollView,
|
7
|
+
FlatListProps,
|
8
|
+
View,
|
20
9
|
} from 'react-native';
|
21
10
|
|
22
11
|
import createNativeWrapper from '../handlers/createNativeWrapper';
|
23
12
|
|
24
|
-
|
25
|
-
|
26
|
-
nativeViewProps,
|
27
|
-
} from '../handlers/NativeViewGestureHandler';
|
28
|
-
|
29
|
-
import { toArray } from '../utils';
|
30
|
-
|
31
|
-
export const RefreshControl = createNativeWrapper(RNRefreshControl, {
|
32
|
-
disallowInterruption: true,
|
33
|
-
shouldCancelWhenOutside: false,
|
13
|
+
export const ScrollView = createNativeWrapper(RNScrollView, {
|
14
|
+
disallowInterruption: false,
|
34
15
|
});
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
36
|
-
export type RefreshControl = typeof RefreshControl & RNRefreshControl;
|
37
|
-
|
38
|
-
const GHScrollView = createNativeWrapper<PropsWithChildren<RNScrollViewProps>>(
|
39
|
-
RNScrollView,
|
40
|
-
{
|
41
|
-
disallowInterruption: true,
|
42
|
-
shouldCancelWhenOutside: false,
|
43
|
-
}
|
44
|
-
);
|
45
|
-
export const ScrollView = React.forwardRef<
|
46
|
-
RNScrollView,
|
47
|
-
RNScrollViewProps & NativeViewGestureHandlerProps
|
48
|
-
>((props, ref) => {
|
49
|
-
const refreshControlGestureRef = React.useRef<RefreshControl>(null);
|
50
|
-
const { refreshControl, waitFor, ...rest } = props;
|
51
16
|
|
52
|
-
|
53
|
-
<GHScrollView
|
54
|
-
{...rest}
|
55
|
-
// @ts-ignore `ref` exists on `GHScrollView`
|
56
|
-
ref={ref}
|
57
|
-
waitFor={[...toArray(waitFor ?? []), refreshControlGestureRef]}
|
58
|
-
// @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
59
|
-
refreshControl={
|
60
|
-
refreshControl
|
61
|
-
? React.cloneElement(refreshControl, {
|
62
|
-
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
63
|
-
ref: refreshControlGestureRef,
|
64
|
-
})
|
65
|
-
: undefined
|
66
|
-
}
|
67
|
-
/>
|
68
|
-
);
|
69
|
-
});
|
70
|
-
// backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
|
71
|
-
// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
73
|
-
export type ScrollView = typeof GHScrollView & RNScrollView;
|
74
|
-
|
75
|
-
export const Switch = createNativeWrapper<RNSwitchProps>(RNSwitch, {
|
17
|
+
export const Switch = createNativeWrapper(RNSwitch, {
|
76
18
|
shouldCancelWhenOutside: false,
|
77
19
|
shouldActivateOnStart: true,
|
78
20
|
disallowInterruption: true,
|
79
21
|
});
|
80
|
-
|
81
|
-
export
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
export
|
92
|
-
|
93
|
-
|
94
|
-
export const FlatList = React.forwardRef((props, ref) => {
|
95
|
-
const refreshControlGestureRef = React.useRef<RefreshControl>(null);
|
96
|
-
|
97
|
-
const { waitFor, refreshControl, ...rest } = props;
|
98
|
-
|
99
|
-
const flatListProps = {};
|
100
|
-
const scrollViewProps = {};
|
101
|
-
for (const [propName, value] of Object.entries(rest)) {
|
102
|
-
// https://github.com/microsoft/TypeScript/issues/26255
|
103
|
-
if ((nativeViewProps as readonly string[]).includes(propName)) {
|
104
|
-
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
106
|
-
scrollViewProps[propName] = value;
|
107
|
-
} else {
|
108
|
-
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
110
|
-
flatListProps[propName] = value;
|
111
|
-
}
|
112
|
-
}
|
113
|
-
|
114
|
-
return (
|
115
|
-
// @ts-ignore - this function cannot have generic type so we have to ignore this error
|
22
|
+
export const TextInput = createNativeWrapper(RNTextInput);
|
23
|
+
export const DrawerLayoutAndroid = () => {
|
24
|
+
console.warn('DrawerLayoutAndroid is not supported on web!');
|
25
|
+
return <View />;
|
26
|
+
};
|
27
|
+
|
28
|
+
// RefreshControl is implemented as a functional component, rendering a View
|
29
|
+
// NativeViewGestureHandler needs to set a ref on its child, which cannot be done
|
30
|
+
// on functional components
|
31
|
+
export const RefreshControl = createNativeWrapper(View);
|
32
|
+
|
33
|
+
export const FlatList = React.forwardRef(
|
34
|
+
<ItemT extends any>(props: FlatListProps<ItemT>, ref: any) => (
|
116
35
|
<RNFlatList
|
117
36
|
ref={ref}
|
118
|
-
{...
|
119
|
-
renderScrollComponent={(scrollProps) =>
|
120
|
-
<ScrollView
|
121
|
-
{...{
|
122
|
-
...scrollProps,
|
123
|
-
...scrollViewProps,
|
124
|
-
waitFor: [...toArray(waitFor ?? []), refreshControlGestureRef],
|
125
|
-
}}
|
126
|
-
/>
|
127
|
-
)}
|
128
|
-
// @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
129
|
-
refreshControl={
|
130
|
-
refreshControl
|
131
|
-
? React.cloneElement(refreshControl, {
|
132
|
-
// @ts-ignore for reasons unknown to me, `ref` doesn't exist on the type inferred by TS
|
133
|
-
ref: refreshControlGestureRef,
|
134
|
-
})
|
135
|
-
: undefined
|
136
|
-
}
|
37
|
+
{...props}
|
38
|
+
renderScrollComponent={(scrollProps) => <ScrollView {...scrollProps} />}
|
137
39
|
/>
|
138
|
-
)
|
139
|
-
|
140
|
-
props: PropsWithChildren<
|
141
|
-
RNFlatListProps<ItemT> &
|
142
|
-
RefAttributes<FlatList<ItemT>> &
|
143
|
-
NativeViewGestureHandlerProps
|
144
|
-
>,
|
145
|
-
ref: ForwardedRef<FlatList<ItemT>>
|
146
|
-
) => ReactElement | null;
|
147
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
148
|
-
export type FlatList<ItemT = any> = typeof FlatList & RNFlatList<ItemT>;
|
40
|
+
)
|
41
|
+
);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { HostComponent } from 'react-native';
|
2
|
+
import { RawButtonProps } from './GestureButtons';
|
3
|
+
import RNGestureHandlerButtonNativeComponent from '../specs/RNGestureHandlerButtonNativeComponent';
|
4
|
+
|
5
|
+
export default RNGestureHandlerButtonNativeComponent as HostComponent<RawButtonProps>;
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
import RNGestureHandlerButtonNativeComponent from '../specs/RNGestureHandlerButtonNativeComponent';
|
1
|
+
import * as React from 'react';
|
2
|
+
import { View } from 'react-native';
|
4
3
|
|
5
|
-
export default
|
4
|
+
export default React.forwardRef<View>((props, ref) => (
|
5
|
+
<View ref={ref} accessibilityRole="button" {...props} />
|
6
|
+
));
|