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.
Files changed (39) hide show
  1. package/android/build.gradle +6 -3
  2. package/lib/commonjs/components/Swipeable.js +41 -16
  3. package/lib/commonjs/components/Swipeable.js.map +1 -1
  4. package/lib/commonjs/ghQueueMicrotask.js +12 -0
  5. package/lib/commonjs/ghQueueMicrotask.js.map +1 -0
  6. package/lib/commonjs/handlers/createHandler.js +4 -2
  7. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  8. package/lib/commonjs/handlers/gestureHandlerCommon.js +3 -1
  9. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  10. package/lib/commonjs/handlers/gestures/GestureDetector.js +5 -3
  11. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
  12. package/lib/commonjs/web/handlers/HoverGestureHandler.js +1 -1
  13. package/lib/commonjs/web/handlers/HoverGestureHandler.js.map +1 -1
  14. package/lib/commonjs/web_hammer/GestureHandler.js +3 -1
  15. package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
  16. package/lib/module/components/Swipeable.js +41 -16
  17. package/lib/module/components/Swipeable.js.map +1 -1
  18. package/lib/module/ghQueueMicrotask.js +5 -0
  19. package/lib/module/ghQueueMicrotask.js.map +1 -0
  20. package/lib/module/handlers/createHandler.js +3 -2
  21. package/lib/module/handlers/createHandler.js.map +1 -1
  22. package/lib/module/handlers/gestureHandlerCommon.js +2 -1
  23. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  24. package/lib/module/handlers/gestures/GestureDetector.js +4 -3
  25. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
  26. package/lib/module/web/handlers/HoverGestureHandler.js +1 -1
  27. package/lib/module/web/handlers/HoverGestureHandler.js.map +1 -1
  28. package/lib/module/web_hammer/GestureHandler.js +3 -2
  29. package/lib/module/web_hammer/GestureHandler.js.map +1 -1
  30. package/lib/typescript/components/Swipeable.d.ts +8 -0
  31. package/lib/typescript/ghQueueMicrotask.d.ts +1 -0
  32. package/package.json +1 -1
  33. package/src/components/Swipeable.tsx +33 -0
  34. package/src/ghQueueMicrotask.ts +5 -0
  35. package/src/handlers/createHandler.tsx +3 -2
  36. package/src/handlers/gestureHandlerCommon.ts +2 -1
  37. package/src/handlers/gestures/GestureDetector.tsx +4 -3
  38. package/src/web/handlers/HoverGestureHandler.ts +1 -1
  39. 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
- queueMicrotask(() => {
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
- queueMicrotask(() => {
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
- queueMicrotask(() => {
271
+ ghQueueMicrotask(() => {
271
272
  if (!mountedRef.current) {
272
273
  return;
273
274
  }
@@ -1,4 +1,4 @@
1
- import { State } from '../../../src/State';
1
+ import { State } from '../../State';
2
2
  import { AdaptedEvent, Config } from '../interfaces';
3
3
  import GestureHandlerOrchestrator from '../tools/GestureHandlerOrchestrator';
4
4
  import GestureHandler from './GestureHandler';
@@ -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
- queueMicrotask(() => {
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();