react-native-gesture-handler 2.16.0 → 2.16.2
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.
- package/README.md +1 -0
- package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +9 -3
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- 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/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/handlers/createHandler.js +9 -3
- package/lib/module/handlers/createHandler.js.map +1 -1
- 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/handlers/PanGestureHandler.d.ts +4 -4
- 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/handlers/PanGestureHandler.ts +8 -4
- package/src/handlers/createHandler.tsx +14 -10
- package/src/handlers/gestures/GestureDetector.tsx +38 -0
- 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
|
@@ -23,7 +23,7 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
23
23
|
private lastSentState: State | null = null;
|
|
24
24
|
protected currentState: State = State.UNDETERMINED;
|
|
25
25
|
|
|
26
|
-
protected
|
|
26
|
+
protected shouldCancelWhenOutside = false;
|
|
27
27
|
protected hasCustomActivationCriteria = false;
|
|
28
28
|
protected enabled = false;
|
|
29
29
|
|
|
@@ -176,13 +176,13 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
public activate(
|
|
179
|
+
public activate(force = false) {
|
|
180
180
|
if (
|
|
181
|
-
this.
|
|
182
|
-
this.currentState === State.
|
|
181
|
+
(this.config.manualActivation !== true || force) &&
|
|
182
|
+
(this.currentState === State.UNDETERMINED ||
|
|
183
|
+
this.currentState === State.BEGAN)
|
|
183
184
|
) {
|
|
184
185
|
this.delegate.onActivate();
|
|
185
|
-
|
|
186
186
|
this.moveToState(State.ACTIVE);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
@@ -317,7 +317,7 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
protected onPointerLeave(event: AdaptedEvent): void {
|
|
320
|
-
if (this.
|
|
320
|
+
if (this.shouldCancelWhenOutside) {
|
|
321
321
|
switch (this.currentState) {
|
|
322
322
|
case State.ACTIVE:
|
|
323
323
|
this.cancel();
|
|
@@ -362,7 +362,7 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
362
362
|
if (
|
|
363
363
|
this.enabled &&
|
|
364
364
|
this.active &&
|
|
365
|
-
(!out || (out && !this.
|
|
365
|
+
(!out || (out && !this.shouldCancelWhenOutside))
|
|
366
366
|
) {
|
|
367
367
|
this.sendEvent(this.currentState, this.currentState);
|
|
368
368
|
}
|
|
@@ -805,11 +805,11 @@ export default abstract class GestureHandler implements IGestureHandler {
|
|
|
805
805
|
}
|
|
806
806
|
|
|
807
807
|
protected setShouldCancelWhenOutside(shouldCancel: boolean) {
|
|
808
|
-
this.
|
|
808
|
+
this.shouldCancelWhenOutside = shouldCancel;
|
|
809
809
|
}
|
|
810
810
|
|
|
811
811
|
protected getShouldCancelWhenOutside(): boolean {
|
|
812
|
-
return this.
|
|
812
|
+
return this.shouldCancelWhenOutside;
|
|
813
813
|
}
|
|
814
814
|
|
|
815
815
|
public getPointerType(): PointerType {
|
|
@@ -20,6 +20,7 @@ export default class PanGestureHandler extends GestureHandler {
|
|
|
20
20
|
'failOffsetYEnd',
|
|
21
21
|
'minVelocityX',
|
|
22
22
|
'minVelocityY',
|
|
23
|
+
'minVelocity',
|
|
23
24
|
];
|
|
24
25
|
|
|
25
26
|
public velocityX = 0;
|
|
@@ -221,6 +222,9 @@ export default class PanGestureHandler extends GestureHandler {
|
|
|
221
222
|
this.lastX = this.tracker.getLastAvgX();
|
|
222
223
|
this.lastY = this.tracker.getLastAvgY();
|
|
223
224
|
|
|
225
|
+
this.startX = this.lastX;
|
|
226
|
+
this.startY = this.lastY;
|
|
227
|
+
|
|
224
228
|
this.tryBegin(event);
|
|
225
229
|
this.checkBegan();
|
|
226
230
|
}
|
package/src/web/interfaces.ts
CHANGED