react-native-gesture-handler 2.13.3 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/RNGestureHandler.podspec +19 -25
  2. package/android/build.gradle +3 -2
  3. package/android/gradle.properties +2 -2
  4. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +36 -72
  5. package/android/src/main/java/com/swmansion/gesturehandler/react/Extensions.kt +1 -1
  6. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +13 -9
  7. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +12 -14
  8. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerInteractionManager.kt +8 -1
  9. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +34 -88
  10. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt +1 -1
  11. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.kt +18 -12
  12. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/FlingGestureHandlerEventDataBuilder.kt +30 -0
  13. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/GestureHandlerEventDataBuilder.kt +22 -0
  14. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/HoverGestureHandlerEventDataBuilder.kt +30 -0
  15. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/LongPressGestureHandlerEventDataBuilder.kt +33 -0
  16. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/ManualGestureHandlerEventDataBuilder.kt +5 -0
  17. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/NativeGestureHandlerEventDataBuilder.kt +18 -0
  18. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PanGestureHandlerEventDataBuilder.kt +42 -0
  19. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/PinchGestureHandlerEventDataBuilder.kt +30 -0
  20. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/RotationGestureHandlerEventDataBuilder.kt +30 -0
  21. package/android/src/main/java/com/swmansion/gesturehandler/react/eventbuilders/TapGestureHandlerEventDataBuilder.kt +30 -0
  22. package/android/src/main/jni/CMakeLists.txt +14 -2
  23. package/ios/Handlers/RNHoverHandler.m +15 -14
  24. package/ios/RNGestureHandler.m +11 -0
  25. package/ios/RNGestureHandlerButtonComponentView.mm +2 -0
  26. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js +1 -1
  27. package/lib/commonjs/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  28. package/lib/commonjs/getReactNativeVersion.js +22 -0
  29. package/lib/commonjs/getReactNativeVersion.js.map +1 -0
  30. package/lib/commonjs/getReactNativeVersion.web.js +11 -0
  31. package/lib/commonjs/getReactNativeVersion.web.js.map +1 -0
  32. package/lib/commonjs/handlers/gestureHandlerCommon.js +1 -1
  33. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  34. package/lib/commonjs/handlers/gestures/GestureDetector.js +13 -3
  35. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
  36. package/lib/commonjs/handlers/gestures/gesture.js +8 -0
  37. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  38. package/lib/commonjs/utils.js +0 -13
  39. package/lib/commonjs/utils.js.map +1 -1
  40. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  41. package/lib/commonjs/web/interfaces.js.map +1 -1
  42. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js +4 -15
  43. package/lib/commonjs/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  44. package/lib/commonjs/web/tools/InteractionManager.js +27 -29
  45. package/lib/commonjs/web/tools/InteractionManager.js.map +1 -1
  46. package/lib/commonjs/web/tools/PointerEventManager.js +11 -3
  47. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  48. package/lib/module/components/touchables/TouchableNativeFeedback.android.js +1 -1
  49. package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
  50. package/lib/module/getReactNativeVersion.js +10 -0
  51. package/lib/module/getReactNativeVersion.js.map +1 -0
  52. package/lib/module/getReactNativeVersion.web.js +4 -0
  53. package/lib/module/getReactNativeVersion.web.js.map +1 -0
  54. package/lib/module/handlers/gestureHandlerCommon.js +1 -1
  55. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  56. package/lib/module/handlers/gestures/GestureDetector.js +12 -3
  57. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
  58. package/lib/module/handlers/gestures/gesture.js +8 -0
  59. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  60. package/lib/module/utils.js +0 -6
  61. package/lib/module/utils.js.map +1 -1
  62. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  63. package/lib/module/web/interfaces.js.map +1 -1
  64. package/lib/module/web/tools/GestureHandlerOrchestrator.js +4 -15
  65. package/lib/module/web/tools/GestureHandlerOrchestrator.js.map +1 -1
  66. package/lib/module/web/tools/InteractionManager.js +27 -29
  67. package/lib/module/web/tools/InteractionManager.js.map +1 -1
  68. package/lib/module/web/tools/PointerEventManager.js +11 -3
  69. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  70. package/lib/typescript/ActionType.d.ts +1 -1
  71. package/lib/typescript/Directions.d.ts +1 -1
  72. package/lib/typescript/PlatformConstants.d.ts +1 -1
  73. package/lib/typescript/RNGestureHandlerModule.d.ts +1 -1
  74. package/lib/typescript/State.d.ts +1 -1
  75. package/lib/typescript/TouchEventType.d.ts +1 -1
  76. package/lib/typescript/components/DrawerLayout.d.ts +9 -9
  77. package/lib/typescript/components/GestureButtons.d.ts +3 -3
  78. package/lib/typescript/components/GestureComponents.d.ts +6 -6
  79. package/lib/typescript/components/GestureComponents.web.d.ts +1 -1
  80. package/lib/typescript/components/GestureHandlerRootView.android.d.ts +2 -1
  81. package/lib/typescript/components/GestureHandlerRootView.d.ts +2 -1
  82. package/lib/typescript/components/GestureHandlerRootView.web.d.ts +2 -1
  83. package/lib/typescript/components/Swipeable.d.ts +4 -4
  84. package/lib/typescript/components/touchables/GenericTouchable.d.ts +4 -3
  85. package/lib/typescript/components/touchables/TouchableHighlight.d.ts +4 -3
  86. package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +7 -6
  87. package/lib/typescript/components/touchables/TouchableOpacity.d.ts +3 -2
  88. package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +1 -1
  89. package/lib/typescript/getReactNativeVersion.d.ts +4 -0
  90. package/lib/typescript/getReactNativeVersion.web.d.ts +1 -0
  91. package/lib/typescript/handlers/FlingGestureHandler.d.ts +2 -2
  92. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +2 -2
  93. package/lib/typescript/handlers/LongPressGestureHandler.d.ts +2 -2
  94. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +3 -3
  95. package/lib/typescript/handlers/PanGestureHandler.d.ts +2 -2
  96. package/lib/typescript/handlers/PinchGestureHandler.d.ts +2 -2
  97. package/lib/typescript/handlers/RotationGestureHandler.d.ts +2 -2
  98. package/lib/typescript/handlers/TapGestureHandler.d.ts +2 -2
  99. package/lib/typescript/handlers/createHandler.d.ts +1 -1
  100. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +11 -10
  101. package/lib/typescript/handlers/gestureHandlerTypesCompat.d.ts +32 -32
  102. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -2
  103. package/lib/typescript/handlers/gestures/flingGesture.d.ts +1 -1
  104. package/lib/typescript/handlers/gestures/forceTouchGesture.d.ts +2 -2
  105. package/lib/typescript/handlers/gestures/gesture.d.ts +7 -5
  106. package/lib/typescript/handlers/gestures/gestureComposition.d.ts +4 -4
  107. package/lib/typescript/handlers/gestures/hoverGesture.d.ts +3 -3
  108. package/lib/typescript/handlers/gestures/longPressGesture.d.ts +1 -1
  109. package/lib/typescript/handlers/gestures/manualGesture.d.ts +1 -1
  110. package/lib/typescript/handlers/gestures/nativeGesture.d.ts +1 -1
  111. package/lib/typescript/handlers/gestures/panGesture.d.ts +2 -2
  112. package/lib/typescript/handlers/gestures/pinchGesture.d.ts +2 -2
  113. package/lib/typescript/handlers/gestures/rotationGesture.d.ts +2 -2
  114. package/lib/typescript/handlers/gestures/tapGesture.d.ts +1 -1
  115. package/lib/typescript/jestUtils/jestUtils.d.ts +6 -6
  116. package/lib/typescript/typeUtils.d.ts +1 -1
  117. package/lib/typescript/utils.d.ts +1 -5
  118. package/lib/typescript/web/interfaces.d.ts +4 -3
  119. package/lib/typescript/web/tools/GestureHandlerOrchestrator.d.ts +0 -1
  120. package/lib/typescript/web/tools/InteractionManager.d.ts +2 -1
  121. package/lib/typescript/web_hammer/GestureHandler.d.ts +2 -2
  122. package/package.json +7 -7
  123. package/src/components/touchables/TouchableNativeFeedback.android.tsx +2 -1
  124. package/src/getReactNativeVersion.ts +11 -0
  125. package/src/getReactNativeVersion.web.ts +3 -0
  126. package/src/handlers/gestureHandlerCommon.ts +6 -1
  127. package/src/handlers/gestures/GestureDetector.tsx +9 -6
  128. package/src/handlers/gestures/gesture.ts +9 -1
  129. package/src/utils.ts +0 -8
  130. package/src/web/handlers/GestureHandler.ts +1 -1
  131. package/src/web/interfaces.ts +1 -0
  132. package/src/web/tools/GestureHandlerOrchestrator.ts +4 -13
  133. package/src/web/tools/InteractionManager.ts +37 -30
  134. package/src/web/tools/PointerEventManager.ts +12 -3
  135. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEventDataExtractor.kt +0 -8
  136. /package/android/{src/fabric → fabric/src/main}/java/com/swmansion/gesturehandler/RNGestureHandlerComponentsRegistry.java +0 -0
  137. /package/android/{src/fabric → fabric/src/main}/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +0 -0
  138. /package/android/{src/paper → paper/src/main}/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +0 -0
  139. /package/android/{src/paper → paper/src/main}/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +0 -0
  140. /package/android/{src/paper → paper/src/main}/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerDelegate.java +0 -0
  141. /package/android/{src/paper → paper/src/main}/java/com/facebook/react/viewmanagers/RNGestureHandlerRootViewManagerInterface.java +0 -0
  142. /package/android/{src/paper → paper/src/main}/java/com/swmansion/gesturehandler/ReactContextExtensions.kt +0 -0
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { State } from '../State';
3
3
  import { TouchEventType } from '../TouchEventType';
4
4
  import { ValueOf } from '../typeUtils';
5
- export declare const baseGestureHandlerProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "cancelsTouchesInView", "userSelect", "activeCursor", "waitFor", "simultaneousHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange"];
5
+ export declare const baseGestureHandlerProps: readonly ["id", "enabled", "shouldCancelWhenOutside", "hitSlop", "cancelsTouchesInView", "userSelect", "activeCursor", "waitFor", "simultaneousHandlers", "blocksHandlers", "onBegan", "onFailed", "onCancelled", "onActivated", "onEnded", "onGestureEvent", "onHandlerStateChange"];
6
6
  export declare const baseGestureHandlerWithMonitorProps: string[];
7
7
  export interface GestureEventPayload {
8
8
  handlerTag: number;
@@ -12,23 +12,23 @@ export interface GestureEventPayload {
12
12
  export interface HandlerStateChangeEventPayload extends GestureEventPayload {
13
13
  oldState: ValueOf<typeof State>;
14
14
  }
15
- export declare type HitSlop = number | Partial<Record<'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal', number>> | Record<'width' | 'left', number> | Record<'width' | 'right', number> | Record<'height' | 'top', number> | Record<'height' | 'bottom', number>;
16
- export declare type UserSelect = 'none' | 'auto' | 'text';
17
- export declare type ActiveCursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out';
15
+ export type HitSlop = number | Partial<Record<'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal', number>> | Record<'width' | 'left', number> | Record<'width' | 'right', number> | Record<'height' | 'top', number> | Record<'height' | 'bottom', number>;
16
+ export type UserSelect = 'none' | 'auto' | 'text';
17
+ export type ActiveCursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out';
18
18
  export interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {
19
19
  nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;
20
20
  }
21
21
  export interface HandlerStateChangeEvent<ExtraEventPayloadT = Record<string, unknown>> {
22
22
  nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;
23
23
  }
24
- export declare type TouchData = {
24
+ export type TouchData = {
25
25
  id: number;
26
26
  x: number;
27
27
  y: number;
28
28
  absoluteX: number;
29
29
  absoluteY: number;
30
30
  };
31
- export declare type GestureTouchEvent = {
31
+ export type GestureTouchEvent = {
32
32
  handlerTag: number;
33
33
  numberOfTouches: number;
34
34
  state: ValueOf<typeof State>;
@@ -36,19 +36,20 @@ export declare type GestureTouchEvent = {
36
36
  allTouches: TouchData[];
37
37
  changedTouches: TouchData[];
38
38
  };
39
- export declare type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> = GestureEventPayload & GestureEventPayloadT;
40
- export declare type GestureStateChangeEvent<GestureStateChangeEventPayloadT = Record<string, unknown>> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;
41
- export declare type CommonGestureConfig = {
39
+ export type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> = GestureEventPayload & GestureEventPayloadT;
40
+ export type GestureStateChangeEvent<GestureStateChangeEventPayloadT = Record<string, unknown>> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;
41
+ export type CommonGestureConfig = {
42
42
  enabled?: boolean;
43
43
  shouldCancelWhenOutside?: boolean;
44
44
  hitSlop?: HitSlop;
45
45
  userSelect?: UserSelect;
46
46
  activeCursor?: ActiveCursor;
47
47
  };
48
- export declare type BaseGestureHandlerProps<ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>> = CommonGestureConfig & {
48
+ export type BaseGestureHandlerProps<ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>> = CommonGestureConfig & {
49
49
  id?: string;
50
50
  waitFor?: React.Ref<unknown> | React.Ref<unknown>[];
51
51
  simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
52
+ blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
52
53
  testID?: string;
53
54
  cancelsTouchesInView?: boolean;
54
55
  onBegan?: (event: HandlerStateChangeEvent) => void;
@@ -8,35 +8,35 @@ import { PinchGestureHandlerEventPayload, PinchGestureHandlerProps } from './Pin
8
8
  import { RotationGestureHandlerEventPayload, RotationGestureHandlerProps } from './RotationGestureHandler';
9
9
  import { TapGestureHandlerEventPayload, TapGestureHandlerProps } from './TapGestureHandler';
10
10
  import { NativeViewGestureHandlerPayload, NativeViewGestureHandlerProps } from './NativeViewGestureHandler';
11
- export declare type GestureHandlerGestureEventNativeEvent = GestureEventPayload;
12
- export declare type GestureHandlerStateChangeNativeEvent = HandlerStateChangeEventPayload;
13
- export declare type GestureHandlerGestureEvent = GestureEvent;
14
- export declare type GestureHandlerStateChangeEvent = HandlerStateChangeEvent;
15
- export declare type NativeViewGestureHandlerGestureEvent = GestureEvent<NativeViewGestureHandlerPayload>;
16
- export declare type NativeViewGestureHandlerStateChangeEvent = HandlerStateChangeEvent<NativeViewGestureHandlerPayload>;
17
- export declare type TapGestureHandlerGestureEvent = GestureEvent<TapGestureHandlerEventPayload>;
18
- export declare type TapGestureHandlerStateChangeEvent = HandlerStateChangeEvent<TapGestureHandlerEventPayload>;
19
- export declare type ForceTouchGestureHandlerGestureEvent = GestureEvent<ForceTouchGestureHandlerEventPayload>;
20
- export declare type ForceTouchGestureHandlerStateChangeEvent = HandlerStateChangeEvent<ForceTouchGestureHandlerEventPayload>;
21
- export declare type LongPressGestureHandlerGestureEvent = GestureEvent<LongPressGestureHandlerEventPayload>;
22
- export declare type LongPressGestureHandlerStateChangeEvent = HandlerStateChangeEvent<LongPressGestureHandlerEventPayload>;
23
- export declare type PanGestureHandlerGestureEvent = GestureEvent<PanGestureHandlerEventPayload>;
24
- export declare type PanGestureHandlerStateChangeEvent = HandlerStateChangeEvent<PanGestureHandlerEventPayload>;
25
- export declare type PinchGestureHandlerGestureEvent = GestureEvent<PinchGestureHandlerEventPayload>;
26
- export declare type PinchGestureHandlerStateChangeEvent = HandlerStateChangeEvent<PinchGestureHandlerEventPayload>;
27
- export declare type RotationGestureHandlerGestureEvent = GestureEvent<RotationGestureHandlerEventPayload>;
28
- export declare type RotationGestureHandlerStateChangeEvent = HandlerStateChangeEvent<RotationGestureHandlerEventPayload>;
29
- export declare type FlingGestureHandlerGestureEvent = GestureEvent<FlingGestureHandlerEventPayload>;
30
- export declare type FlingGestureHandlerStateChangeEvent = HandlerStateChangeEvent<FlingGestureHandlerEventPayload>;
31
- export declare type NativeViewGestureHandlerProperties = NativeViewGestureHandlerProps;
32
- export declare type TapGestureHandlerProperties = TapGestureHandlerProps;
33
- export declare type LongPressGestureHandlerProperties = LongPressGestureHandlerProps;
34
- export declare type PanGestureHandlerProperties = PanGestureHandlerProps;
35
- export declare type PinchGestureHandlerProperties = PinchGestureHandlerProps;
36
- export declare type RotationGestureHandlerProperties = RotationGestureHandlerProps;
37
- export declare type FlingGestureHandlerProperties = FlingGestureHandlerProps;
38
- export declare type ForceTouchGestureHandlerProperties = ForceTouchGestureHandlerProps;
39
- export declare type RawButtonProperties = RawButtonProps;
40
- export declare type BaseButtonProperties = BaseButtonProps;
41
- export declare type RectButtonProperties = RectButtonProps;
42
- export declare type BorderlessButtonProperties = BorderlessButtonProps;
11
+ export type GestureHandlerGestureEventNativeEvent = GestureEventPayload;
12
+ export type GestureHandlerStateChangeNativeEvent = HandlerStateChangeEventPayload;
13
+ export type GestureHandlerGestureEvent = GestureEvent;
14
+ export type GestureHandlerStateChangeEvent = HandlerStateChangeEvent;
15
+ export type NativeViewGestureHandlerGestureEvent = GestureEvent<NativeViewGestureHandlerPayload>;
16
+ export type NativeViewGestureHandlerStateChangeEvent = HandlerStateChangeEvent<NativeViewGestureHandlerPayload>;
17
+ export type TapGestureHandlerGestureEvent = GestureEvent<TapGestureHandlerEventPayload>;
18
+ export type TapGestureHandlerStateChangeEvent = HandlerStateChangeEvent<TapGestureHandlerEventPayload>;
19
+ export type ForceTouchGestureHandlerGestureEvent = GestureEvent<ForceTouchGestureHandlerEventPayload>;
20
+ export type ForceTouchGestureHandlerStateChangeEvent = HandlerStateChangeEvent<ForceTouchGestureHandlerEventPayload>;
21
+ export type LongPressGestureHandlerGestureEvent = GestureEvent<LongPressGestureHandlerEventPayload>;
22
+ export type LongPressGestureHandlerStateChangeEvent = HandlerStateChangeEvent<LongPressGestureHandlerEventPayload>;
23
+ export type PanGestureHandlerGestureEvent = GestureEvent<PanGestureHandlerEventPayload>;
24
+ export type PanGestureHandlerStateChangeEvent = HandlerStateChangeEvent<PanGestureHandlerEventPayload>;
25
+ export type PinchGestureHandlerGestureEvent = GestureEvent<PinchGestureHandlerEventPayload>;
26
+ export type PinchGestureHandlerStateChangeEvent = HandlerStateChangeEvent<PinchGestureHandlerEventPayload>;
27
+ export type RotationGestureHandlerGestureEvent = GestureEvent<RotationGestureHandlerEventPayload>;
28
+ export type RotationGestureHandlerStateChangeEvent = HandlerStateChangeEvent<RotationGestureHandlerEventPayload>;
29
+ export type FlingGestureHandlerGestureEvent = GestureEvent<FlingGestureHandlerEventPayload>;
30
+ export type FlingGestureHandlerStateChangeEvent = HandlerStateChangeEvent<FlingGestureHandlerEventPayload>;
31
+ export type NativeViewGestureHandlerProperties = NativeViewGestureHandlerProps;
32
+ export type TapGestureHandlerProperties = TapGestureHandlerProps;
33
+ export type LongPressGestureHandlerProperties = LongPressGestureHandlerProps;
34
+ export type PanGestureHandlerProperties = PanGestureHandlerProps;
35
+ export type PinchGestureHandlerProperties = PinchGestureHandlerProps;
36
+ export type RotationGestureHandlerProperties = RotationGestureHandlerProps;
37
+ export type FlingGestureHandlerProperties = FlingGestureHandlerProps;
38
+ export type ForceTouchGestureHandlerProperties = ForceTouchGestureHandlerProps;
39
+ export type RawButtonProperties = RawButtonProps;
40
+ export type BaseButtonProperties = BaseButtonProps;
41
+ export type RectButtonProperties = RectButtonProps;
42
+ export type BorderlessButtonProperties = BorderlessButtonProps;
@@ -3,7 +3,7 @@ import { GestureType, HandlerCallbacks } from './gesture';
3
3
  import { SharedValue } from './reanimatedWrapper';
4
4
  import { UserSelect } from '../gestureHandlerCommon';
5
5
  import { ComposedGesture } from './gestureComposition';
6
- export declare type GestureConfigReference = {
6
+ export type GestureConfigReference = {
7
7
  config: GestureType[];
8
8
  animatedEventHandler: unknown;
9
9
  animatedHandlers: SharedValue<HandlerCallbacks<Record<string, unknown>>[] | null> | null;
@@ -15,5 +15,5 @@ interface GestureDetectorProps {
15
15
  userSelect?: UserSelect;
16
16
  children?: React.ReactNode;
17
17
  }
18
- export declare const GestureDetector: (props: GestureDetectorProps) => JSX.Element;
18
+ export declare const GestureDetector: (props: GestureDetectorProps) => React.JSX.Element;
19
19
  export {};
@@ -6,4 +6,4 @@ export declare class FlingGesture extends BaseGesture<FlingGestureHandlerEventPa
6
6
  numberOfPointers(pointers: number): this;
7
7
  direction(direction: number): this;
8
8
  }
9
- export declare type FlingGestureType = InstanceType<typeof FlingGesture>;
9
+ export type FlingGestureType = InstanceType<typeof FlingGesture>;
@@ -1,7 +1,7 @@
1
1
  import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
2
2
  import { ForceTouchGestureConfig, ForceTouchGestureHandlerEventPayload } from '../ForceTouchGestureHandler';
3
3
  import { GestureUpdateEvent } from '../gestureHandlerCommon';
4
- export declare type ForceTouchGestureChangeEventPayload = {
4
+ export type ForceTouchGestureChangeEventPayload = {
5
5
  forceChange: number;
6
6
  };
7
7
  export declare class ForceTouchGesture extends ContinousBaseGesture<ForceTouchGestureHandlerEventPayload, ForceTouchGestureChangeEventPayload> {
@@ -12,4 +12,4 @@ export declare class ForceTouchGesture extends ContinousBaseGesture<ForceTouchGe
12
12
  feedbackOnActivation(value: boolean): this;
13
13
  onChange(callback: (event: GestureUpdateEvent<GestureUpdateEvent<ForceTouchGestureHandlerEventPayload & ForceTouchGestureChangeEventPayload>>) => void): this;
14
14
  }
15
- export declare type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;
15
+ export type ForceTouchGestureType = InstanceType<typeof ForceTouchGesture>;
@@ -8,20 +8,21 @@ import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';
8
8
  import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
9
9
  import { TapGestureHandlerEventPayload } from '../TapGestureHandler';
10
10
  import { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';
11
- export declare type GestureType = BaseGesture<Record<string, unknown>> | BaseGesture<Record<string, never>> | BaseGesture<TapGestureHandlerEventPayload> | BaseGesture<PanGestureHandlerEventPayload> | BaseGesture<LongPressGestureHandlerEventPayload> | BaseGesture<RotationGestureHandlerEventPayload> | BaseGesture<PinchGestureHandlerEventPayload> | BaseGesture<FlingGestureHandlerEventPayload> | BaseGesture<ForceTouchGestureHandlerEventPayload> | BaseGesture<NativeViewGestureHandlerPayload>;
12
- export declare type GestureRef = number | GestureType | React.RefObject<GestureType | undefined> | React.RefObject<React.ComponentType | undefined>;
11
+ export type GestureType = BaseGesture<Record<string, unknown>> | BaseGesture<Record<string, never>> | BaseGesture<TapGestureHandlerEventPayload> | BaseGesture<PanGestureHandlerEventPayload> | BaseGesture<LongPressGestureHandlerEventPayload> | BaseGesture<RotationGestureHandlerEventPayload> | BaseGesture<PinchGestureHandlerEventPayload> | BaseGesture<FlingGestureHandlerEventPayload> | BaseGesture<ForceTouchGestureHandlerEventPayload> | BaseGesture<NativeViewGestureHandlerPayload>;
12
+ export type GestureRef = number | GestureType | React.RefObject<GestureType | undefined> | React.RefObject<React.ComponentType | undefined>;
13
13
  export interface BaseGestureConfig extends CommonGestureConfig, Record<string, unknown> {
14
14
  ref?: React.MutableRefObject<GestureType | undefined>;
15
15
  requireToFail?: GestureRef[];
16
16
  simultaneousWith?: GestureRef[];
17
+ blocksHandlers?: GestureRef[];
17
18
  needsPointerData?: boolean;
18
19
  manualActivation?: boolean;
19
20
  runOnJS?: boolean;
20
21
  testId?: string;
21
22
  cancelsTouchesInView?: boolean;
22
23
  }
23
- declare type TouchEventHandlerType = (event: GestureTouchEvent, stateManager: GestureStateManagerType) => void;
24
- export declare type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {
24
+ type TouchEventHandlerType = (event: GestureTouchEvent, stateManager: GestureStateManagerType) => void;
25
+ export type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {
25
26
  gestureId: number;
26
27
  handlerTag: number;
27
28
  onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;
@@ -50,7 +51,7 @@ export declare const CALLBACK_TYPE: {
50
51
  readonly TOUCHES_UP: 9;
51
52
  readonly TOUCHES_CANCELLED: 10;
52
53
  };
53
- export declare type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];
54
+ export type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];
54
55
  export declare abstract class Gesture {
55
56
  /**
56
57
  * Return array of gestures, providing the same interface for creating and updating
@@ -93,6 +94,7 @@ export declare abstract class BaseGesture<EventPayloadT extends Record<string, u
93
94
  runOnJS(runOnJS: boolean): this;
94
95
  simultaneousWithExternalGesture(...gestures: Exclude<GestureRef, number>[]): this;
95
96
  requireExternalGestureToFail(...gestures: Exclude<GestureRef, number>[]): this;
97
+ blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]): this;
96
98
  withTestId(id: string): this;
97
99
  cancelsTouchesInView(value: boolean): this;
98
100
  initialize(): void;
@@ -15,7 +15,7 @@ export declare class SimultaneousGesture extends ComposedGesture {
15
15
  export declare class ExclusiveGesture extends ComposedGesture {
16
16
  prepare(): void;
17
17
  }
18
- export declare type ComposedGestureType = InstanceType<typeof ComposedGesture>;
19
- export declare type RaceGestureType = ComposedGestureType;
20
- export declare type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;
21
- export declare type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;
18
+ export type ComposedGestureType = InstanceType<typeof ComposedGesture>;
19
+ export type RaceGestureType = ComposedGestureType;
20
+ export type SimultaneousGestureType = InstanceType<typeof SimultaneousGesture>;
21
+ export type ExclusiveGestureType = InstanceType<typeof ExclusiveGesture>;
@@ -1,12 +1,12 @@
1
1
  import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
2
2
  import { GestureUpdateEvent } from '../gestureHandlerCommon';
3
- export declare type HoverGestureHandlerEventPayload = {
3
+ export type HoverGestureHandlerEventPayload = {
4
4
  x: number;
5
5
  y: number;
6
6
  absoluteX: number;
7
7
  absoluteY: number;
8
8
  };
9
- export declare type HoverGestureChangeEventPayload = {
9
+ export type HoverGestureChangeEventPayload = {
10
10
  changeX: number;
11
11
  changeY: number;
12
12
  };
@@ -29,4 +29,4 @@ export declare class HoverGesture extends ContinousBaseGesture<HoverGestureHandl
29
29
  effect(effect: HoverEffect): this;
30
30
  onChange(callback: (event: GestureUpdateEvent<HoverGestureHandlerEventPayload & HoverGestureChangeEventPayload>) => void): this;
31
31
  }
32
- export declare type HoverGestureType = InstanceType<typeof HoverGesture>;
32
+ export type HoverGestureType = InstanceType<typeof HoverGesture>;
@@ -6,4 +6,4 @@ export declare class LongPressGesture extends BaseGesture<LongPressGestureHandle
6
6
  minDuration(duration: number): this;
7
7
  maxDistance(distance: number): this;
8
8
  }
9
- export declare type LongPressGestureType = InstanceType<typeof LongPressGesture>;
9
+ export type LongPressGestureType = InstanceType<typeof LongPressGesture>;
@@ -4,4 +4,4 @@ export declare class ManualGesture extends ContinousBaseGesture<Record<string, n
4
4
  constructor();
5
5
  onChange(callback: (event: GestureUpdateEvent<Record<string, never>>) => void): this;
6
6
  }
7
- export declare type ManualGestureType = InstanceType<typeof ManualGesture>;
7
+ export type ManualGestureType = InstanceType<typeof ManualGesture>;
@@ -6,4 +6,4 @@ export declare class NativeGesture extends BaseGesture<NativeViewGestureHandlerP
6
6
  shouldActivateOnStart(value: boolean): this;
7
7
  disallowInterruption(value: boolean): this;
8
8
  }
9
- export declare type NativeGestureType = InstanceType<typeof NativeGesture>;
9
+ export type NativeGestureType = InstanceType<typeof NativeGesture>;
@@ -1,7 +1,7 @@
1
1
  import { BaseGestureConfig, ContinousBaseGesture } from './gesture';
2
2
  import { GestureUpdateEvent } from '../gestureHandlerCommon';
3
3
  import { PanGestureConfig, PanGestureHandlerEventPayload } from '../PanGestureHandler';
4
- export declare type PanGestureChangeEventPayload = {
4
+ export type PanGestureChangeEventPayload = {
5
5
  changeX: number;
6
6
  changeY: number;
7
7
  };
@@ -23,4 +23,4 @@ export declare class PanGesture extends ContinousBaseGesture<PanGestureHandlerEv
23
23
  activateAfterLongPress(duration: number): this;
24
24
  onChange(callback: (event: GestureUpdateEvent<PanGestureHandlerEventPayload & PanGestureChangeEventPayload>) => void): this;
25
25
  }
26
- export declare type PanGestureType = InstanceType<typeof PanGesture>;
26
+ export type PanGestureType = InstanceType<typeof PanGesture>;
@@ -1,11 +1,11 @@
1
1
  import { ContinousBaseGesture } from './gesture';
2
2
  import { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';
3
3
  import { GestureUpdateEvent } from '../gestureHandlerCommon';
4
- export declare type PinchGestureChangeEventPayload = {
4
+ export type PinchGestureChangeEventPayload = {
5
5
  scaleChange: number;
6
6
  };
7
7
  export declare class PinchGesture extends ContinousBaseGesture<PinchGestureHandlerEventPayload, PinchGestureChangeEventPayload> {
8
8
  constructor();
9
9
  onChange(callback: (event: GestureUpdateEvent<PinchGestureHandlerEventPayload & PinchGestureChangeEventPayload>) => void): this;
10
10
  }
11
- export declare type PinchGestureType = InstanceType<typeof PinchGesture>;
11
+ export type PinchGestureType = InstanceType<typeof PinchGesture>;
@@ -1,12 +1,12 @@
1
1
  import { ContinousBaseGesture } from './gesture';
2
2
  import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
3
3
  import { GestureUpdateEvent } from '../gestureHandlerCommon';
4
- declare type RotationGestureChangeEventPayload = {
4
+ type RotationGestureChangeEventPayload = {
5
5
  rotationChange: number;
6
6
  };
7
7
  export declare class RotationGesture extends ContinousBaseGesture<RotationGestureHandlerEventPayload, RotationGestureChangeEventPayload> {
8
8
  constructor();
9
9
  onChange(callback: (event: GestureUpdateEvent<RotationGestureHandlerEventPayload & RotationGestureChangeEventPayload>) => void): this;
10
10
  }
11
- export declare type RotationGestureType = InstanceType<typeof RotationGesture>;
11
+ export type RotationGestureType = InstanceType<typeof RotationGesture>;
12
12
  export {};
@@ -11,4 +11,4 @@ export declare class TapGesture extends BaseGesture<TapGestureHandlerEventPayloa
11
11
  maxDeltaX(delta: number): this;
12
12
  maxDeltaY(delta: number): this;
13
13
  }
14
- export declare type TapGestureType = InstanceType<typeof TapGesture>;
14
+ export type TapGestureType = InstanceType<typeof TapGesture>;
@@ -17,12 +17,12 @@ import { PanGestureHandler, PanGestureHandlerEventPayload } from '../handlers/Pa
17
17
  import { PinchGestureHandler, PinchGestureHandlerEventPayload } from '../handlers/PinchGestureHandler';
18
18
  import { RotationGestureHandler, RotationGestureHandlerEventPayload } from '../handlers/RotationGestureHandler';
19
19
  import { TapGestureHandler, TapGestureHandlerEventPayload } from '../handlers/TapGestureHandler';
20
- declare type GestureHandlerTestEvent<TEventPayload extends Record<string, unknown> = Record<string, unknown>> = (GestureEvent<TEventPayload> | HandlerStateChangeEvent<TEventPayload>)['nativeEvent'];
21
- declare type AllGestures = TapGesture | PanGesture | LongPressGesture | RotationGesture | PinchGesture | FlingGesture | ForceTouchGesture | NativeGesture;
22
- declare type AllHandlers = TapGestureHandler | PanGestureHandler | LongPressGestureHandler | RotationGestureHandler | PinchGestureHandler | FlingGestureHandler | ForceTouchGestureHandler | NativeViewGestureHandler;
23
- declare type ClassComponentConstructor<P> = new (props: P) => React.Component<P, any, any>;
24
- declare type ExtractPayloadFromProps<T> = T extends BaseGestureHandlerProps<infer TPayload> ? TPayload : never;
25
- declare type ExtractConfig<T> = T extends BaseGesture<infer TGesturePayload> ? TGesturePayload : T extends ClassComponentConstructor<infer THandlerProps> ? ExtractPayloadFromProps<THandlerProps> : Record<string, unknown>;
20
+ type GestureHandlerTestEvent<TEventPayload extends Record<string, unknown> = Record<string, unknown>> = (GestureEvent<TEventPayload> | HandlerStateChangeEvent<TEventPayload>)['nativeEvent'];
21
+ type AllGestures = TapGesture | PanGesture | LongPressGesture | RotationGesture | PinchGesture | FlingGesture | ForceTouchGesture | NativeGesture;
22
+ type AllHandlers = TapGestureHandler | PanGestureHandler | LongPressGestureHandler | RotationGestureHandler | PinchGestureHandler | FlingGestureHandler | ForceTouchGestureHandler | NativeViewGestureHandler;
23
+ type ClassComponentConstructor<P> = new (props: P) => React.Component<P, any, any>;
24
+ type ExtractPayloadFromProps<T> = T extends BaseGestureHandlerProps<infer TPayload> ? TPayload : never;
25
+ type ExtractConfig<T> = T extends BaseGesture<infer TGesturePayload> ? TGesturePayload : T extends ClassComponentConstructor<infer THandlerProps> ? ExtractPayloadFromProps<THandlerProps> : Record<string, unknown>;
26
26
  export declare function fireGestureHandler<THandler extends AllGestures | AllHandlers>(componentOrGesture: ReactTestInstance | GestureType, eventList?: Partial<GestureHandlerTestEvent<ExtractConfig<THandler>>>[]): void;
27
27
  export declare function getByGestureTestId(testID: string): BaseGesture<Record<string, unknown>> | BaseGesture<Record<string, never>> | BaseGesture<TapGestureHandlerEventPayload> | BaseGesture<PanGestureHandlerEventPayload> | BaseGesture<LongPressGestureHandlerEventPayload> | BaseGesture<RotationGestureHandlerEventPayload> | BaseGesture<PinchGestureHandlerEventPayload> | BaseGesture<ForceTouchGestureHandlerEventPayload> | BaseGesture<NativeViewGestureHandlerPayload>;
28
28
  export {};
@@ -1 +1 @@
1
- export declare type ValueOf<T> = T[keyof T];
1
+ export type ValueOf<T> = T[keyof T];
@@ -1,9 +1,5 @@
1
- export declare const REACT_NATIVE_VERSION: {
2
- major: number;
3
- minor: number;
4
- };
5
1
  export declare function toArray<T>(object: T | T[]): T[];
6
- export declare type withPrevAndCurrentMapFn<T, Transformed> = (previous: Transformed | null, current: T) => Transformed;
2
+ export type withPrevAndCurrentMapFn<T, Transformed> = (previous: Transformed | null, current: T) => Transformed;
7
3
  export declare function withPrevAndCurrent<T, Transformed>(array: T[], mapFn: withPrevAndCurrentMapFn<T, Transformed>): Transformed[];
8
4
  export declare function hasProperty(object: object, key: string): boolean;
9
5
  export declare function isJestEnv(): boolean;
@@ -14,11 +14,12 @@ export interface HitSlop {
14
14
  export interface Handler {
15
15
  handlerTag: number;
16
16
  }
17
- declare type ConfigArgs = number | boolean | HitSlop | UserSelect | ActiveCursor | Directions | Handler[] | null | undefined;
17
+ type ConfigArgs = number | boolean | HitSlop | UserSelect | ActiveCursor | Directions | Handler[] | null | undefined;
18
18
  export interface Config extends Record<string, ConfigArgs> {
19
19
  enabled?: boolean;
20
20
  simultaneousHandlers?: Handler[] | null;
21
21
  waitFor?: Handler[] | null;
22
+ blocksHandlers?: Handler[] | null;
22
23
  hitSlop?: HitSlop;
23
24
  shouldCancelWhenOutside?: boolean;
24
25
  userSelect?: UserSelect;
@@ -53,7 +54,7 @@ export interface Config extends Record<string, ConfigArgs> {
53
54
  disallowInterruption?: boolean;
54
55
  direction?: Directions;
55
56
  }
56
- declare type NativeEventArgs = number | State | boolean | undefined;
57
+ type NativeEventArgs = number | State | boolean | undefined;
57
58
  interface NativeEvent extends Record<string, NativeEventArgs> {
58
59
  numberOfPointers: number;
59
60
  state: State;
@@ -69,7 +70,7 @@ export interface PointerData {
69
70
  absoluteX: number;
70
71
  absoluteY: number;
71
72
  }
72
- declare type TouchNativeArgs = number | State | TouchEventType | PointerData[];
73
+ type TouchNativeArgs = number | State | TouchEventType | PointerData[];
73
74
  interface NativeTouchEvent extends Record<string, TouchNativeArgs> {
74
75
  handlerTag: number;
75
76
  state: State;
@@ -4,7 +4,6 @@ export default class GestureHandlerOrchestrator {
4
4
  private static instance;
5
5
  private gestureHandlers;
6
6
  private awaitingHandlers;
7
- private handlersToCancel;
8
7
  private handlingChangeSemaphore;
9
8
  private activationIndex;
10
9
  private constructor();
@@ -4,11 +4,12 @@ export default class InteractionManager {
4
4
  private static instance;
5
5
  private readonly waitForRelations;
6
6
  private readonly simultaneousRelations;
7
+ private readonly blocksHandlersRelations;
7
8
  private constructor();
8
9
  configureInteractions(handler: GestureHandler, config: Config): void;
9
10
  shouldWaitForHandlerFailure(handler: GestureHandler, otherHandler: GestureHandler): boolean;
10
11
  shouldRecognizeSimultaneously(handler: GestureHandler, otherHandler: GestureHandler): boolean;
11
- shouldRequireHandlerToWaitForFailure(_handler: GestureHandler, _otherHandler: GestureHandler): boolean;
12
+ shouldRequireHandlerToWaitForFailure(handler: GestureHandler, otherHandler: GestureHandler): boolean;
12
13
  shouldHandlerBeCancelledBy(_handler: GestureHandler, _otherHandler: GestureHandler): boolean;
13
14
  dropRelationsForHandlerWithTag(handlerTag: number): void;
14
15
  reset(): void;
@@ -1,8 +1,8 @@
1
1
  import { findNodeHandle } from 'react-native';
2
2
  import { State } from '../State';
3
3
  import { EventMap } from './constants';
4
- export declare type HammerInputExt = Omit<HammerInput, 'destroy' | 'handler' | 'init'>;
5
- export declare type Config = Partial<{
4
+ export type HammerInputExt = Omit<HammerInput, 'destroy' | 'handler' | 'init'>;
5
+ export type Config = Partial<{
6
6
  enabled: boolean;
7
7
  minPointers: number;
8
8
  maxPointers: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gesture-handler",
3
- "version": "2.13.3",
3
+ "version": "2.14.0",
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",
@@ -31,8 +31,8 @@
31
31
  "android/src/main/AndroidManifest.xml",
32
32
  "android/src/main/java/",
33
33
  "android/src/main/jni/",
34
- "android/src/fabric/java",
35
- "android/src/paper/java",
34
+ "android/fabric/src/main/java",
35
+ "android/paper/src/main/java",
36
36
  "android/common/src/main/java/",
37
37
  "android/reanimated/src/main/java/",
38
38
  "android/noreanimated/src/main/java/",
@@ -77,12 +77,13 @@
77
77
  "@babel/preset-env": "^7.12.11",
78
78
  "@babel/preset-typescript": "^7.12.7",
79
79
  "@babel/runtime": "^7.12.5",
80
+ "@react-native/babel-preset": "^0.73.18",
80
81
  "@testing-library/jest-native": "^4.0.4",
81
82
  "@testing-library/react-native": "^9.0.0",
82
83
  "@types/hammerjs": "^2.0.38",
83
84
  "@types/hoist-non-react-statics": "^3.3.1",
84
85
  "@types/jest": "^27.0.3",
85
- "@types/react": "^18.0.24",
86
+ "@types/react": "^18.2.6",
86
87
  "@types/react-test-renderer": "^17.0.0",
87
88
  "@typescript-eslint/eslint-plugin": "^4.33.0",
88
89
  "@typescript-eslint/parser": "^4.33.0",
@@ -97,17 +98,16 @@
97
98
  "husky": "^8.0.1",
98
99
  "jest": "^26.6.3",
99
100
  "lint-staged": "^12.3.2",
100
- "metro-react-native-babel-preset": "^0.64.0",
101
101
  "prettier": "^2.7.1",
102
102
  "react": "18.2.0",
103
103
  "react-dom": "^16.12.0",
104
- "react-native": "0.72.0-rc.5",
104
+ "react-native": "0.73.0-rc.5",
105
105
  "react-native-builder-bob": "^0.17.1",
106
106
  "react-native-reanimated": "^2.3.1",
107
107
  "react-native-web": "^0.11.7",
108
108
  "react-test-renderer": "17.0.2",
109
109
  "release-it": "^13.6.5",
110
- "typescript": "^4.5.5"
110
+ "typescript": "5.0.4"
111
111
  },
112
112
  "peerDependencies": {
113
113
  "react": "*",
@@ -56,7 +56,8 @@ export default class TouchableNativeFeedback extends Component<TouchableNativeFe
56
56
  rippleRadius,
57
57
  });
58
58
 
59
- static canUseNativeForeground = () => Platform.Version >= 23;
59
+ static canUseNativeForeground = () =>
60
+ Platform.OS === 'android' && Platform.Version >= 23;
60
61
 
61
62
  getExtraButtonProps() {
62
63
  const extraProps: TouchableNativeFeedbackExtraProps = {};
@@ -0,0 +1,11 @@
1
+ import pack from 'react-native/package.json';
2
+
3
+ const [majorStr, minorStr] = pack.version.split('.');
4
+ const REACT_NATIVE_VERSION = {
5
+ major: parseInt(majorStr, 10),
6
+ minor: parseInt(minorStr, 10),
7
+ };
8
+
9
+ export function getReactNativeVersion() {
10
+ return REACT_NATIVE_VERSION;
11
+ }
@@ -0,0 +1,3 @@
1
+ export function getReactNativeVersion() {
2
+ throw new Error('getReactNativeVersion is not supported on web');
3
+ }
@@ -23,7 +23,11 @@ const commonProps = [
23
23
  'activeCursor',
24
24
  ] as const;
25
25
 
26
- const componentInteractionProps = ['waitFor', 'simultaneousHandlers'] as const;
26
+ const componentInteractionProps = [
27
+ 'waitFor',
28
+ 'simultaneousHandlers',
29
+ 'blocksHandlers',
30
+ ] as const;
27
31
 
28
32
  export const baseGestureHandlerProps = [
29
33
  ...commonProps,
@@ -155,6 +159,7 @@ export type BaseGestureHandlerProps<
155
159
  id?: string;
156
160
  waitFor?: React.Ref<unknown> | React.Ref<unknown>[];
157
161
  simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
162
+ blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];
158
163
  testID?: string;
159
164
  cancelsTouchesInView?: boolean;
160
165
  // TODO(TS) - fix event types
@@ -37,12 +37,8 @@ import { State } from '../../State';
37
37
  import { TouchEventType } from '../../TouchEventType';
38
38
  import { ComposedGesture } from './gestureComposition';
39
39
  import { ActionType } from '../../ActionType';
40
- import {
41
- isFabric,
42
- isJestEnv,
43
- REACT_NATIVE_VERSION,
44
- tagMessage,
45
- } from '../../utils';
40
+ import { isFabric, isJestEnv, tagMessage } from '../../utils';
41
+ import { getReactNativeVersion } from '../../getReactNativeVersion';
46
42
  import { getShadowNodeFromRef } from '../../getShadowNodeFromRef';
47
43
  import { Platform } from 'react-native';
48
44
  import type RNGestureHandlerModuleWeb from '../../RNGestureHandlerModule.web';
@@ -197,11 +193,17 @@ function attachHandlers({
197
193
  );
198
194
  }
199
195
 
196
+ let blocksHandlers: number[] = [];
197
+ if (handler.config.blocksHandlers) {
198
+ blocksHandlers = extractValidHandlerTags(handler.config.blocksHandlers);
199
+ }
200
+
200
201
  RNGestureHandlerModule.updateGestureHandler(
201
202
  handler.handlerTag,
202
203
  filterConfig(handler.config, ALLOWED_PROPS, {
203
204
  simultaneousHandlers: simultaneousWith,
204
205
  waitFor: requireToFail,
206
+ blocksHandlers: blocksHandlers,
205
207
  })
206
208
  );
207
209
  }
@@ -565,6 +567,7 @@ function validateDetectorChildren(ref: any) {
565
567
  // / \
566
568
  // NativeView NativeView
567
569
  if (__DEV__ && Platform.OS !== 'web') {
570
+ const REACT_NATIVE_VERSION = getReactNativeVersion();
568
571
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
569
572
  const wrapType =
570
573
  REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0
@@ -41,6 +41,7 @@ export interface BaseGestureConfig
41
41
  ref?: React.MutableRefObject<GestureType | undefined>;
42
42
  requireToFail?: GestureRef[];
43
43
  simultaneousWith?: GestureRef[];
44
+ blocksHandlers?: GestureRef[];
44
45
  needsPointerData?: boolean;
45
46
  manualActivation?: boolean;
46
47
  runOnJS?: boolean;
@@ -144,7 +145,7 @@ export abstract class BaseGesture<
144
145
  }
145
146
 
146
147
  private addDependency(
147
- key: 'simultaneousWith' | 'requireToFail',
148
+ key: 'simultaneousWith' | 'requireToFail' | 'blocksHandlers',
148
149
  gesture: Exclude<GestureRef, number>
149
150
  ) {
150
151
  const value = this.config[key];
@@ -275,6 +276,13 @@ export abstract class BaseGesture<
275
276
  return this;
276
277
  }
277
278
 
279
+ blocksExternalGesture(...gestures: Exclude<GestureRef, number>[]) {
280
+ for (const gesture of gestures) {
281
+ this.addDependency('blocksHandlers', gesture);
282
+ }
283
+ return this;
284
+ }
285
+
278
286
  withTestId(id: string) {
279
287
  this.config.testId = id;
280
288
  return this;