react-native-gesture-handler 2.13.0 → 2.13.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/android/build.gradle +6 -3
- package/lib/commonjs/components/Swipeable.js +41 -16
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/ghQueueMicrotask.js +12 -0
- package/lib/commonjs/ghQueueMicrotask.js.map +1 -0
- package/lib/commonjs/handlers/createHandler.js +4 -2
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +3 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +5 -3
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/web/handlers/HoverGestureHandler.js +1 -1
- package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js +3 -1
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- package/lib/module/components/Swipeable.js +41 -16
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/ghQueueMicrotask.js +5 -0
- package/lib/module/ghQueueMicrotask.js.map +1 -0
- package/lib/module/handlers/createHandler.js +3 -2
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +2 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +4 -3
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/web/handlers/HoverGestureHandler.js +1 -1
- package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
- package/lib/module/web_hammer/GestureHandler.js +3 -2
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/typescript/components/Swipeable.d.ts +8 -0
- package/lib/typescript/ghQueueMicrotask.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Swipeable.tsx +33 -0
- package/src/ghQueueMicrotask.ts +5 -0
- package/src/handlers/createHandler.tsx +3 -2
- package/src/handlers/gestureHandlerCommon.ts +2 -1
- package/src/handlers/gestures/GestureDetector.tsx +4 -3
- package/src/web/handlers/HoverGestureHandler.ts +1 -1
- package/src/web_hammer/GestureHandler.ts +2 -1
|
@@ -51,6 +51,7 @@ import { RNRenderer } from '../../RNRenderer';
|
|
|
51
51
|
import { isNewWebImplementationEnabled } from '../../EnableNewWebImplementation';
|
|
52
52
|
import { nativeViewGestureHandlerProps } from '../NativeViewGestureHandler';
|
|
53
53
|
import GestureHandlerRootViewContext from '../../GestureHandlerRootViewContext';
|
|
54
|
+
import { ghQueueMicrotask } from '../../ghQueueMicrotask';
|
|
54
55
|
|
|
55
56
|
declare const global: {
|
|
56
57
|
isFormsStackingContext: (node: unknown) => boolean | null; // JSI function
|
|
@@ -159,7 +160,7 @@ function attachHandlers({
|
|
|
159
160
|
|
|
160
161
|
// use queueMicrotask to extract handlerTags, because all refs should be initialized
|
|
161
162
|
// when it's ran
|
|
162
|
-
|
|
163
|
+
ghQueueMicrotask(() => {
|
|
163
164
|
if (!mountedRef.current) {
|
|
164
165
|
return;
|
|
165
166
|
}
|
|
@@ -179,7 +180,7 @@ function attachHandlers({
|
|
|
179
180
|
|
|
180
181
|
// use queueMicrotask to extract handlerTags, because all refs should be initialized
|
|
181
182
|
// when it's ran
|
|
182
|
-
|
|
183
|
+
ghQueueMicrotask(() => {
|
|
183
184
|
if (!mountedRef.current) {
|
|
184
185
|
return;
|
|
185
186
|
}
|
|
@@ -267,7 +268,7 @@ function updateHandlers(
|
|
|
267
268
|
// use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
|
|
268
269
|
// and handlerTags in BaseGesture references should be updated in the loop above (we need to wait
|
|
269
270
|
// in case of external relations)
|
|
270
|
-
|
|
271
|
+
ghQueueMicrotask(() => {
|
|
271
272
|
if (!mountedRef.current) {
|
|
272
273
|
return;
|
|
273
274
|
}
|
|
@@ -6,6 +6,7 @@ import { findNodeHandle } from 'react-native';
|
|
|
6
6
|
import { State } from '../State';
|
|
7
7
|
import { EventMap } from './constants';
|
|
8
8
|
import * as NodeManager from './NodeManager';
|
|
9
|
+
import { ghQueueMicrotask } from '../ghQueueMicrotask';
|
|
9
10
|
|
|
10
11
|
// TODO(TS) Replace with HammerInput if https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50438/files is merged
|
|
11
12
|
export type HammerInputExt = Omit<HammerInput, 'destroy' | 'handler' | 'init'>;
|
|
@@ -508,7 +509,7 @@ abstract class GestureHandler {
|
|
|
508
509
|
.filter((v) => v);
|
|
509
510
|
|
|
510
511
|
if (shouldUseTouchEvents !== this.shouldUseTouchEvents(props)) {
|
|
511
|
-
|
|
512
|
+
ghQueueMicrotask(() => {
|
|
512
513
|
// if the undelying event API needs to be changed, we need to unmount and mount
|
|
513
514
|
// the hammer instance again.
|
|
514
515
|
this.destroy();
|