react-native-gesture-handler 2.14.1 → 2.15.0

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 (172) hide show
  1. package/README.md +1 -0
  2. package/RNGestureHandler.podspec +2 -2
  3. package/android/paper/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.java +55 -0
  4. package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +64 -4
  5. package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +12 -2
  6. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +53 -19
  7. package/{ios → apple}/Handlers/RNFlingHandler.m +25 -5
  8. package/{ios → apple}/Handlers/RNForceTouchHandler.m +25 -7
  9. package/{ios → apple}/Handlers/RNHoverHandler.m +26 -1
  10. package/{ios → apple}/Handlers/RNLongPressHandler.m +24 -4
  11. package/{ios → apple}/Handlers/RNManualHandler.m +24 -4
  12. package/{ios → apple}/Handlers/RNNativeViewHandler.mm +42 -6
  13. package/{ios → apple}/Handlers/RNPanHandler.m +100 -15
  14. package/apple/Handlers/RNPinchHandler.m +162 -0
  15. package/{ios → apple}/Handlers/RNRotationHandler.m +71 -9
  16. package/{ios → apple}/Handlers/RNTapHandler.m +96 -26
  17. package/apple/RNGHUIKit.h +27 -0
  18. package/{ios → apple}/RNGestureHandler.h +3 -3
  19. package/{ios → apple}/RNGestureHandler.m +31 -5
  20. package/{ios → apple}/RNGestureHandlerButton.h +4 -1
  21. package/{ios → apple}/RNGestureHandlerButton.m +12 -4
  22. package/{ios → apple}/RNGestureHandlerButtonManager.m +4 -2
  23. package/{ios → apple}/RNGestureHandlerEvents.h +1 -1
  24. package/{ios → apple}/RNGestureHandlerManager.h +2 -2
  25. package/{ios → apple}/RNGestureHandlerManager.mm +46 -11
  26. package/apple/RNGestureHandlerModule.h +17 -0
  27. package/{ios → apple}/RNGestureHandlerModule.mm +46 -60
  28. package/{ios → apple}/RNGestureHandlerPointerTracker.h +5 -5
  29. package/{ios → apple}/RNGestureHandlerPointerTracker.m +19 -14
  30. package/{ios → apple}/RNGestureHandlerRegistry.h +1 -1
  31. package/{ios → apple}/RNGestureHandlerRegistry.m +1 -1
  32. package/{ios → apple}/RNManualActivationRecognizer.h +8 -0
  33. package/{ios → apple}/RNManualActivationRecognizer.m +27 -7
  34. package/{ios → apple}/RNRootViewGestureRecognizer.m +72 -4
  35. package/lib/commonjs/RNGestureHandlerModule.js +5 -18
  36. package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
  37. package/lib/commonjs/RNGestureHandlerModule.windows.js +10 -102
  38. package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
  39. package/lib/commonjs/components/DrawerLayout.js +2 -0
  40. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  41. package/lib/commonjs/handlers/gestureHandlerCommon.js +1 -1
  42. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  43. package/lib/commonjs/handlers/gestures/GestureDetector.js +11 -1
  44. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
  45. package/lib/commonjs/handlers/gestures/gesture.js +5 -0
  46. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  47. package/lib/commonjs/index.js +8 -0
  48. package/lib/commonjs/index.js.map +1 -1
  49. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +13 -0
  50. package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -0
  51. package/lib/commonjs/web/handlers/FlingGestureHandler.js +4 -0
  52. package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
  53. package/lib/commonjs/web/handlers/GestureHandler.js +13 -1
  54. package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
  55. package/lib/commonjs/web/handlers/LongPressGestureHandler.js +8 -6
  56. package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
  57. package/lib/commonjs/web/handlers/PanGestureHandler.js +4 -0
  58. package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
  59. package/lib/commonjs/web/handlers/TapGestureHandler.js +4 -0
  60. package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
  61. package/lib/commonjs/web/interfaces.js +12 -14
  62. package/lib/commonjs/web/interfaces.js.map +1 -1
  63. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +35 -0
  64. package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  65. package/lib/commonjs/web/tools/NodeManager.js +3 -2
  66. package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
  67. package/lib/commonjs/web/tools/PointerEventManager.js +11 -3
  68. package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
  69. package/lib/commonjs/web/tools/TouchEventManager.js +0 -1
  70. package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
  71. package/lib/module/RNGestureHandlerModule.js +4 -18
  72. package/lib/module/RNGestureHandlerModule.js.map +1 -1
  73. package/lib/module/RNGestureHandlerModule.windows.js +10 -81
  74. package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
  75. package/lib/module/components/DrawerLayout.js +2 -0
  76. package/lib/module/components/DrawerLayout.js.map +1 -1
  77. package/lib/module/handlers/gestureHandlerCommon.js +1 -1
  78. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  79. package/lib/module/handlers/gestures/GestureDetector.js +11 -1
  80. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
  81. package/lib/module/handlers/gestures/gesture.js +5 -0
  82. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  83. package/lib/module/index.js +1 -0
  84. package/lib/module/index.js.map +1 -1
  85. package/lib/module/specs/NativeRNGestureHandlerModule.js +3 -0
  86. package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -0
  87. package/lib/module/web/handlers/FlingGestureHandler.js +4 -0
  88. package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
  89. package/lib/module/web/handlers/GestureHandler.js +14 -2
  90. package/lib/module/web/handlers/GestureHandler.js.map +1 -1
  91. package/lib/module/web/handlers/LongPressGestureHandler.js +8 -5
  92. package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
  93. package/lib/module/web/handlers/PanGestureHandler.js +4 -0
  94. package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
  95. package/lib/module/web/handlers/TapGestureHandler.js +4 -0
  96. package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
  97. package/lib/module/web/interfaces.js +9 -11
  98. package/lib/module/web/interfaces.js.map +1 -1
  99. package/lib/module/web/tools/GestureHandlerWebDelegate.js +34 -0
  100. package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
  101. package/lib/module/web/tools/NodeManager.js +3 -2
  102. package/lib/module/web/tools/NodeManager.js.map +1 -1
  103. package/lib/module/web/tools/PointerEventManager.js +12 -4
  104. package/lib/module/web/tools/PointerEventManager.js.map +1 -1
  105. package/lib/module/web/tools/TouchEventManager.js +1 -2
  106. package/lib/module/web/tools/TouchEventManager.js.map +1 -1
  107. package/lib/typescript/RNGestureHandlerModule.d.ts +2 -13
  108. package/lib/typescript/RNGestureHandlerModule.windows.d.ts +5 -21
  109. package/lib/typescript/components/DrawerLayout.d.ts +11 -0
  110. package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -1
  111. package/lib/typescript/handlers/PanGestureHandler.d.ts +1 -1
  112. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +4 -1
  113. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -1
  114. package/lib/typescript/handlers/gestures/gesture.d.ts +2 -0
  115. package/lib/typescript/index.d.ts +1 -0
  116. package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +14 -0
  117. package/lib/typescript/web/handlers/GestureHandler.d.ts +3 -1
  118. package/lib/typescript/web/interfaces.d.ts +9 -9
  119. package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +2 -0
  120. package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +7 -0
  121. package/lib/typescript/web/tools/PointerEventManager.d.ts +2 -0
  122. package/package.json +14 -11
  123. package/src/RNGestureHandlerModule.ts +4 -49
  124. package/src/RNGestureHandlerModule.windows.ts +18 -100
  125. package/src/components/DrawerLayout.tsx +15 -0
  126. package/src/handlers/gestureHandlerCommon.ts +5 -0
  127. package/src/handlers/gestures/GestureDetector.tsx +16 -2
  128. package/src/handlers/gestures/gesture.ts +6 -0
  129. package/src/index.ts +1 -0
  130. package/src/specs/NativeRNGestureHandlerModule.ts +26 -0
  131. package/src/web/handlers/FlingGestureHandler.ts +4 -0
  132. package/src/web/handlers/GestureHandler.ts +17 -0
  133. package/src/web/handlers/LongPressGestureHandler.ts +8 -5
  134. package/src/web/handlers/PanGestureHandler.ts +4 -0
  135. package/src/web/handlers/TapGestureHandler.ts +4 -0
  136. package/src/web/interfaces.ts +10 -10
  137. package/src/web/tools/GestureHandlerDelegate.ts +3 -0
  138. package/src/web/tools/GestureHandlerWebDelegate.ts +39 -0
  139. package/src/web/tools/NodeManager.ts +5 -1
  140. package/src/web/tools/PointerEventManager.ts +18 -2
  141. package/src/web/tools/TouchEventManager.ts +0 -2
  142. package/ios/Handlers/RNPinchHandler.m +0 -95
  143. package/ios/RNGestureHandlerModule.h +0 -7
  144. package/lib/commonjs/RNGestureHandlerModule.macos.js +0 -149
  145. package/lib/commonjs/RNGestureHandlerModule.macos.js.map +0 -1
  146. package/lib/module/RNGestureHandlerModule.macos.js +0 -110
  147. package/lib/module/RNGestureHandlerModule.macos.js.map +0 -1
  148. package/lib/typescript/RNGestureHandlerModule.macos.d.ts +0 -47
  149. package/src/RNGestureHandlerModule.macos.ts +0 -133
  150. /package/{ios → apple}/Handlers/RNFlingHandler.h +0 -0
  151. /package/{ios → apple}/Handlers/RNForceTouchHandler.h +0 -0
  152. /package/{ios → apple}/Handlers/RNHoverHandler.h +0 -0
  153. /package/{ios → apple}/Handlers/RNLongPressHandler.h +0 -0
  154. /package/{ios → apple}/Handlers/RNManualHandler.h +0 -0
  155. /package/{ios → apple}/Handlers/RNNativeViewHandler.h +0 -0
  156. /package/{ios → apple}/Handlers/RNPanHandler.h +0 -0
  157. /package/{ios → apple}/Handlers/RNPinchHandler.h +0 -0
  158. /package/{ios → apple}/Handlers/RNRotationHandler.h +0 -0
  159. /package/{ios → apple}/Handlers/RNTapHandler.h +0 -0
  160. /package/{ios → apple}/RNGHTouchEventType.h +0 -0
  161. /package/{ios → apple}/RNGestureHandler.xcodeproj/project.pbxproj +0 -0
  162. /package/{ios → apple}/RNGestureHandler.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  163. /package/{ios → apple}/RNGestureHandlerActionType.h +0 -0
  164. /package/{ios → apple}/RNGestureHandlerButtonComponentView.h +0 -0
  165. /package/{ios → apple}/RNGestureHandlerButtonComponentView.mm +0 -0
  166. /package/{ios → apple}/RNGestureHandlerButtonManager.h +0 -0
  167. /package/{ios → apple}/RNGestureHandlerDirection.h +0 -0
  168. /package/{ios → apple}/RNGestureHandlerEvents.m +0 -0
  169. /package/{ios → apple}/RNGestureHandlerRootViewComponentView.mm +0 -0
  170. /package/{ios → apple}/RNGestureHandlerState.h +0 -0
  171. /package/{ios → apple}/RNGestureHandlerStateManager.h +0 -0
  172. /package/{ios → apple}/RNRootViewGestureRecognizer.h +0 -0
@@ -17,6 +17,7 @@ import { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';
17
17
  import { TapGestureHandlerEventPayload } from '../TapGestureHandler';
18
18
  import { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';
19
19
  import { isRemoteDebuggingEnabled } from '../../utils';
20
+ import { MouseButton } from '../../web/interfaces';
20
21
 
21
22
  export type GestureType =
22
23
  | BaseGesture<Record<string, unknown>>
@@ -257,6 +258,11 @@ export abstract class BaseGesture<
257
258
  return this;
258
259
  }
259
260
 
261
+ mouseButton(mouseButton: MouseButton) {
262
+ this.config.mouseButton = mouseButton;
263
+ return this;
264
+ }
265
+
260
266
  runOnJS(runOnJS: boolean) {
261
267
  this.config.runOnJS = runOnJS;
262
268
  return this;
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ import { initialize } from './init';
2
2
 
3
3
  export { Directions } from './Directions';
4
4
  export { State } from './State';
5
+ export { MouseButton } from './web/interfaces';
5
6
  export { default as gestureHandlerRootHOC } from './components/gestureHandlerRootHOC';
6
7
  export { default as GestureHandlerRootView } from './components/GestureHandlerRootView';
7
8
  export type {
@@ -0,0 +1,26 @@
1
+ import { TurboModuleRegistry, TurboModule } from 'react-native';
2
+ import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
+
4
+ export interface Spec extends TurboModule {
5
+ handleSetJSResponder: (tag: Int32, blockNativeResponder: boolean) => void;
6
+ handleClearJSResponder: () => void;
7
+ createGestureHandler: (
8
+ handlerName: string,
9
+ handlerTag: Int32,
10
+ // Record<> is not supported by codegen
11
+ // eslint-disable-next-line @typescript-eslint/ban-types
12
+ config: Object
13
+ ) => void;
14
+ attachGestureHandler: (
15
+ handlerTag: Int32,
16
+ newView: Int32,
17
+ actionType: Int32
18
+ ) => void;
19
+ // eslint-disable-next-line @typescript-eslint/ban-types
20
+ updateGestureHandler: (handlerTag: Int32, newConfig: Object) => void;
21
+ dropGestureHandler: (handlerTag: Int32) => void;
22
+ install: () => boolean;
23
+ flushOperations: () => void;
24
+ }
25
+
26
+ export default TurboModuleRegistry.getEnforcing<Spec>('RNGestureHandlerModule');
@@ -83,6 +83,10 @@ export default class FlingGestureHandler extends GestureHandler {
83
83
  }
84
84
 
85
85
  protected onPointerDown(event: AdaptedEvent): void {
86
+ if (!this.isButtonInConfig(event.button)) {
87
+ return;
88
+ }
89
+
86
90
  this.tracker.addToTracker(event);
87
91
  this.keyPointer = event.pointerId;
88
92
 
@@ -10,6 +10,7 @@ import {
10
10
  PointerType,
11
11
  TouchEventType,
12
12
  EventTypes,
13
+ MouseButton,
13
14
  } from '../interfaces';
14
15
  import EventManager from '../tools/EventManager';
15
16
  import GestureHandlerOrchestrator from '../tools/GestureHandlerOrchestrator';
@@ -117,6 +118,10 @@ export default abstract class GestureHandler {
117
118
  );
118
119
 
119
120
  this.onStateChange(newState, oldState);
121
+
122
+ if (!this.enabled && this.isFinished()) {
123
+ this.currentState = State.UNDETERMINED;
124
+ }
120
125
  }
121
126
 
122
127
  protected onStateChange(_newState: State, _oldState: State): void {}
@@ -736,8 +741,20 @@ export default abstract class GestureHandler {
736
741
  return false;
737
742
  }
738
743
 
744
+ public isButtonInConfig(mouseButton: MouseButton | undefined) {
745
+ return (
746
+ !mouseButton ||
747
+ (!this.config.mouseButton && mouseButton === MouseButton.LEFT) ||
748
+ (this.config.mouseButton && mouseButton & this.config.mouseButton)
749
+ );
750
+ }
751
+
739
752
  protected resetConfig(): void {}
740
753
 
754
+ public onDestroy(): void {
755
+ this.delegate.destroy(this.config);
756
+ }
757
+
741
758
  //
742
759
  // Getters and setters
743
760
  //
@@ -1,4 +1,3 @@
1
- import { Platform } from 'react-native';
2
1
  import { State } from '../../State';
3
2
  import { AdaptedEvent, Config } from '../interfaces';
4
3
 
@@ -22,11 +21,11 @@ export default class LongPressGestureHandler extends GestureHandler {
22
21
  private activationTimeout: number | undefined;
23
22
 
24
23
  public init(ref: number, propsRef: React.RefObject<unknown>) {
25
- super.init(ref, propsRef);
26
-
27
- if (Platform.OS === 'web') {
28
- (this.delegate.getView() as HTMLElement).oncontextmenu = () => false;
24
+ if (this.config.enableContextMenu === undefined) {
25
+ this.config.enableContextMenu = false;
29
26
  }
27
+
28
+ super.init(ref, propsRef);
30
29
  }
31
30
 
32
31
  protected transformNativeEvent() {
@@ -59,6 +58,10 @@ export default class LongPressGestureHandler extends GestureHandler {
59
58
  }
60
59
 
61
60
  protected onPointerDown(event: AdaptedEvent): void {
61
+ if (!this.isButtonInConfig(event.button)) {
62
+ return;
63
+ }
64
+
62
65
  this.tracker.addToTracker(event);
63
66
  super.onPointerDown(event);
64
67
  this.tryBegin(event);
@@ -211,6 +211,10 @@ export default class PanGestureHandler extends GestureHandler {
211
211
 
212
212
  //EventsHandling
213
213
  protected onPointerDown(event: AdaptedEvent): void {
214
+ if (!this.isButtonInConfig(event.button)) {
215
+ return;
216
+ }
217
+
214
218
  this.tracker.addToTracker(event);
215
219
  super.onPointerDown(event);
216
220
 
@@ -105,6 +105,10 @@ export default class TapGestureHandler extends GestureHandler {
105
105
 
106
106
  //Handling Events
107
107
  protected onPointerDown(event: AdaptedEvent): void {
108
+ if (!this.isButtonInConfig(event.button)) {
109
+ return;
110
+ }
111
+
108
112
  this.tracker.addToTracker(event);
109
113
  super.onPointerDown(event);
110
114
 
@@ -37,6 +37,8 @@ export interface Config extends Record<string, ConfigArgs> {
37
37
  shouldCancelWhenOutside?: boolean;
38
38
  userSelect?: UserSelect;
39
39
  activeCursor?: ActiveCursor;
40
+ mouseButton?: MouseButton;
41
+ enableContextMenu?: boolean;
40
42
 
41
43
  activateAfterLongPress?: number;
42
44
  failOffsetXStart?: number;
@@ -122,22 +124,20 @@ export interface AdaptedEvent {
122
124
  pointerId: number;
123
125
  eventType: EventTypes;
124
126
  pointerType: PointerType;
125
- buttons: number;
126
127
  time: number;
128
+ button?: MouseButton;
127
129
  allTouches?: TouchList;
128
130
  changedTouches?: TouchList;
129
131
  touchEventType?: TouchEventType;
130
132
  }
131
133
 
132
- export enum MouseButtons {
133
- NONE,
134
- LEFT,
135
- RIGHT,
136
- LEFT_RIGHT,
137
- SCROLL,
138
- SCROLL_LEFT,
139
- SCROLL_RIGHT,
140
- SCROLL_LEFT_RIGHT,
134
+ export enum MouseButton {
135
+ LEFT = 1,
136
+ MIDDLE = 2,
137
+ RIGHT = 4,
138
+ BUTTON_4 = 8,
139
+ BUTTON_5 = 16,
140
+ ALL = 31,
141
141
  }
142
142
 
143
143
  export enum EventTypes {
@@ -1,4 +1,5 @@
1
1
  import type GestureHandler from '../handlers/GestureHandler';
2
+ import { Config } from '../interfaces';
2
3
 
3
4
  export interface MeasureResult {
4
5
  pageX: number;
@@ -20,4 +21,6 @@ export interface GestureHandlerDelegate<T> {
20
21
  onEnd(): void;
21
22
  onCancel(): void;
22
23
  onFail(): void;
24
+
25
+ destroy(config: Config): void;
23
26
  }
@@ -9,6 +9,7 @@ import TouchEventManager from './TouchEventManager';
9
9
  import { State } from '../../State';
10
10
  import { isPointerInBounds } from '../utils';
11
11
  import EventManager from './EventManager';
12
+ import { Config, MouseButton } from '../interfaces';
12
13
 
13
14
  export class GestureHandlerWebDelegate
14
15
  implements GestureHandlerDelegate<HTMLElement>
@@ -37,6 +38,8 @@ export class GestureHandlerWebDelegate
37
38
 
38
39
  const config = handler.getConfig();
39
40
 
41
+ this.addContextMenuListeners(config);
42
+
40
43
  if (!config.userSelect) {
41
44
  this.view.style['webkitUserSelect'] = 'none';
42
45
  this.view.style['userSelect'] = 'none';
@@ -86,6 +89,38 @@ export class GestureHandlerWebDelegate
86
89
  }
87
90
  }
88
91
 
92
+ private shouldDisableContextMenu(config: Config) {
93
+ return (
94
+ (config.enableContextMenu === undefined &&
95
+ this.gestureHandler.isButtonInConfig(MouseButton.RIGHT)) ||
96
+ config.enableContextMenu === false
97
+ );
98
+ }
99
+
100
+ private addContextMenuListeners(config: Config): void {
101
+ if (this.shouldDisableContextMenu(config)) {
102
+ this.view.addEventListener('contextmenu', this.disableContextMenu);
103
+ } else if (config.enableContextMenu) {
104
+ this.view.addEventListener('contextmenu', this.enableContextMenu);
105
+ }
106
+ }
107
+
108
+ private removeContextMenuListeners(config: Config): void {
109
+ if (this.shouldDisableContextMenu(config)) {
110
+ this.view.removeEventListener('contextmenu', this.disableContextMenu);
111
+ } else if (config.enableContextMenu) {
112
+ this.view.removeEventListener('contextmenu', this.enableContextMenu);
113
+ }
114
+ }
115
+
116
+ private disableContextMenu(this: void, e: MouseEvent): void {
117
+ e.preventDefault();
118
+ }
119
+
120
+ private enableContextMenu(this: void, e: MouseEvent): void {
121
+ e.stopPropagation();
122
+ }
123
+
89
124
  onBegin(): void {
90
125
  // no-op for now
91
126
  }
@@ -112,4 +147,8 @@ export class GestureHandlerWebDelegate
112
147
  onFail(): void {
113
148
  this.tryResetCursor();
114
149
  }
150
+
151
+ public destroy(config: Config): void {
152
+ this.removeContextMenuListeners(config);
153
+ }
115
154
  }
@@ -21,7 +21,9 @@ export default abstract class NodeManager {
21
21
  handler: InstanceType<ValueOf<typeof Gestures>>
22
22
  ): void {
23
23
  if (handlerTag in this.gestures) {
24
- throw new Error(`Handler with tag ${handlerTag} already exists`);
24
+ throw new Error(
25
+ `Handler with tag ${handlerTag} already exists. Please ensure that no Gesture instance is used across multiple GestureDetectors.`
26
+ );
25
27
  }
26
28
 
27
29
  this.gestures[handlerTag] = handler;
@@ -33,6 +35,8 @@ export default abstract class NodeManager {
33
35
  return;
34
36
  }
35
37
 
38
+ this.gestures[handlerTag].onDestroy();
39
+
36
40
  // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
37
41
  delete this.gestures[handlerTag];
38
42
  }
@@ -1,4 +1,9 @@
1
- import { AdaptedEvent, EventTypes, PointerType } from '../interfaces';
1
+ import {
2
+ AdaptedEvent,
3
+ EventTypes,
4
+ MouseButton,
5
+ PointerType,
6
+ } from '../interfaces';
2
7
  import EventManager from './EventManager';
3
8
  import { isPointerInBounds } from '../utils';
4
9
 
@@ -6,6 +11,17 @@ const POINTER_CAPTURE_EXCLUDE_LIST = new Set<string>(['SELECT', 'INPUT']);
6
11
 
7
12
  export default class PointerEventManager extends EventManager<HTMLElement> {
8
13
  private trackedPointers = new Set<number>();
14
+ private readonly mouseButtonsMapper = new Map<number, MouseButton>();
15
+
16
+ constructor(view: HTMLElement) {
17
+ super(view);
18
+
19
+ this.mouseButtonsMapper.set(0, MouseButton.LEFT);
20
+ this.mouseButtonsMapper.set(1, MouseButton.MIDDLE);
21
+ this.mouseButtonsMapper.set(2, MouseButton.RIGHT);
22
+ this.mouseButtonsMapper.set(3, MouseButton.BUTTON_4);
23
+ this.mouseButtonsMapper.set(4, MouseButton.BUTTON_5);
24
+ }
9
25
 
10
26
  public setListeners(): void {
11
27
  this.view.addEventListener('pointerdown', (event: PointerEvent): void => {
@@ -192,7 +208,7 @@ export default class PointerEventManager extends EventManager<HTMLElement> {
192
208
  pointerId: event.pointerId,
193
209
  eventType: eventType,
194
210
  pointerType: event.pointerType as PointerType,
195
- buttons: event.buttons,
211
+ button: this.mouseButtonsMapper.get(event.button),
196
212
  time: event.timeStamp,
197
213
  };
198
214
  }
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  AdaptedEvent,
3
3
  EventTypes,
4
- MouseButtons,
5
4
  PointerType,
6
5
  TouchEventType,
7
6
  } from '../interfaces';
@@ -157,7 +156,6 @@ export default class TouchEventManager extends EventManager<HTMLElement> {
157
156
  pointerId: event.changedTouches[index].identifier,
158
157
  eventType: eventType,
159
158
  pointerType: PointerType.TOUCH,
160
- buttons: MouseButtons.NONE,
161
159
  time: event.timeStamp,
162
160
  allTouches: event.touches,
163
161
  changedTouches: event.changedTouches,
@@ -1,95 +0,0 @@
1
-
2
-
3
- //
4
- // RNPinchHandler.m
5
- // RNGestureHandler
6
- //
7
- // Created by Krzysztof Magiera on 12/10/2017.
8
- // Copyright © 2017 Software Mansion. All rights reserved.
9
- //
10
-
11
- #import "RNPinchHandler.h"
12
-
13
- #if !TARGET_OS_TV
14
- @interface RNBetterPinchRecognizer : UIPinchGestureRecognizer
15
-
16
- - (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler;
17
-
18
- @end
19
-
20
- @implementation RNBetterPinchRecognizer {
21
- __weak RNGestureHandler *_gestureHandler;
22
- }
23
-
24
- - (id)initWithGestureHandler:(RNGestureHandler *)gestureHandler
25
- {
26
- if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) {
27
- _gestureHandler = gestureHandler;
28
- }
29
- return self;
30
- }
31
-
32
- - (void)handleGesture:(UIGestureRecognizer *)recognizer
33
- {
34
- if (self.state == UIGestureRecognizerStateBegan) {
35
- self.scale = 1;
36
- }
37
- [_gestureHandler handleGesture:recognizer];
38
- }
39
-
40
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
41
- {
42
- [super touchesBegan:touches withEvent:event];
43
- [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event];
44
- }
45
-
46
- - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
47
- {
48
- [super touchesMoved:touches withEvent:event];
49
- [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event];
50
- }
51
-
52
- - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
53
- {
54
- [super touchesEnded:touches withEvent:event];
55
- [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];
56
- }
57
-
58
- - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
59
- {
60
- [super touchesCancelled:touches withEvent:event];
61
- [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];
62
- }
63
-
64
- - (void)reset
65
- {
66
- [_gestureHandler.pointerTracker reset];
67
- [super reset];
68
- }
69
-
70
- @end
71
- #endif
72
-
73
- @implementation RNPinchGestureHandler
74
-
75
- - (instancetype)initWithTag:(NSNumber *)tag
76
- {
77
- if ((self = [super initWithTag:tag])) {
78
- #if !TARGET_OS_TV
79
- _recognizer = [[RNBetterPinchRecognizer alloc] initWithGestureHandler:self];
80
- #endif
81
- }
82
- return self;
83
- }
84
-
85
- #if !TARGET_OS_TV
86
- - (RNGestureHandlerEventExtraData *)eventExtraData:(UIPinchGestureRecognizer *)recognizer
87
- {
88
- return [RNGestureHandlerEventExtraData forPinch:recognizer.scale
89
- withFocalPoint:[recognizer locationInView:recognizer.view]
90
- withVelocity:recognizer.velocity
91
- withNumberOfTouches:recognizer.numberOfTouches];
92
- }
93
- #endif
94
-
95
- @end
@@ -1,7 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
- #import <React/RCTEventEmitter.h>
3
- #import <React/RCTUIManager.h>
4
-
5
- @interface RNGestureHandlerModule : RCTEventEmitter <RCTBridgeModule>
6
-
7
- @end
@@ -1,149 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.HammerGestures = exports.Gestures = void 0;
7
-
8
- var _EnableNewWebImplementation = require("./EnableNewWebImplementation");
9
-
10
- var _InteractionManager = _interopRequireDefault(require("./web/tools/InteractionManager"));
11
-
12
- var _NodeManager = _interopRequireDefault(require("./web/tools/NodeManager"));
13
-
14
- var _PanGestureHandler = _interopRequireDefault(require("./web/handlers/PanGestureHandler"));
15
-
16
- var _TapGestureHandler = _interopRequireDefault(require("./web/handlers/TapGestureHandler"));
17
-
18
- var _LongPressGestureHandler = _interopRequireDefault(require("./web/handlers/LongPressGestureHandler"));
19
-
20
- var _PinchGestureHandler = _interopRequireDefault(require("./web/handlers/PinchGestureHandler"));
21
-
22
- var _RotationGestureHandler = _interopRequireDefault(require("./web/handlers/RotationGestureHandler"));
23
-
24
- var _FlingGestureHandler = _interopRequireDefault(require("./web/handlers/FlingGestureHandler"));
25
-
26
- var _NativeViewGestureHandler = _interopRequireDefault(require("./web/handlers/NativeViewGestureHandler"));
27
-
28
- var _ManualGestureHandler = _interopRequireDefault(require("./web/handlers/ManualGestureHandler"));
29
-
30
- var HammerNodeManager = _interopRequireWildcard(require("./web_hammer/NodeManager"));
31
-
32
- var _NativeViewGestureHandler2 = _interopRequireDefault(require("./web_hammer/NativeViewGestureHandler"));
33
-
34
- var _PanGestureHandler2 = _interopRequireDefault(require("./web_hammer/PanGestureHandler"));
35
-
36
- var _TapGestureHandler2 = _interopRequireDefault(require("./web_hammer/TapGestureHandler"));
37
-
38
- var _LongPressGestureHandler2 = _interopRequireDefault(require("./web_hammer/LongPressGestureHandler"));
39
-
40
- var _PinchGestureHandler2 = _interopRequireDefault(require("./web_hammer/PinchGestureHandler"));
41
-
42
- var _RotationGestureHandler2 = _interopRequireDefault(require("./web_hammer/RotationGestureHandler"));
43
-
44
- var _FlingGestureHandler2 = _interopRequireDefault(require("./web_hammer/FlingGestureHandler"));
45
-
46
- var _GestureHandlerWebDelegate = require("./web/tools/GestureHandlerWebDelegate");
47
-
48
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
49
-
50
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
51
-
52
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
53
-
54
- //GestureHandlers
55
- //Hammer Handlers
56
- const Gestures = {
57
- NativeViewGestureHandler: _NativeViewGestureHandler.default,
58
- PanGestureHandler: _PanGestureHandler.default,
59
- TapGestureHandler: _TapGestureHandler.default,
60
- LongPressGestureHandler: _LongPressGestureHandler.default,
61
- PinchGestureHandler: _PinchGestureHandler.default,
62
- RotationGestureHandler: _RotationGestureHandler.default,
63
- FlingGestureHandler: _FlingGestureHandler.default,
64
- ManualGestureHandler: _ManualGestureHandler.default
65
- };
66
- exports.Gestures = Gestures;
67
- const HammerGestures = {
68
- NativeViewGestureHandler: _NativeViewGestureHandler2.default,
69
- PanGestureHandler: _PanGestureHandler2.default,
70
- TapGestureHandler: _TapGestureHandler2.default,
71
- LongPressGestureHandler: _LongPressGestureHandler2.default,
72
- PinchGestureHandler: _PinchGestureHandler2.default,
73
- RotationGestureHandler: _RotationGestureHandler2.default,
74
- FlingGestureHandler: _FlingGestureHandler2.default
75
- };
76
- exports.HammerGestures = HammerGestures;
77
- var _default = {
78
- handleSetJSResponder(_tag, _blockNativeResponder) {// NO-OP
79
- },
80
-
81
- handleClearJSResponder() {// NO-OP
82
- },
83
-
84
- createGestureHandler(handlerName, handlerTag, config) {
85
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
86
- if (!(handlerName in Gestures)) {
87
- throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
88
- }
89
-
90
- const GestureClass = Gestures[handlerName];
91
-
92
- _NodeManager.default.createGestureHandler(handlerTag, new GestureClass(new _GestureHandlerWebDelegate.GestureHandlerWebDelegate()));
93
-
94
- _InteractionManager.default.getInstance().configureInteractions(_NodeManager.default.getHandler(handlerTag), config);
95
- } else {
96
- if (!(handlerName in HammerGestures)) {
97
- throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
98
- } // @ts-ignore If it doesn't exist, the error is thrown
99
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
100
-
101
-
102
- const GestureClass = HammerGestures[handlerName]; // eslint-disable-next-line @typescript-eslint/no-unsafe-call
103
-
104
- HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());
105
- }
106
-
107
- this.updateGestureHandler(handlerTag, config);
108
- },
109
-
110
- attachGestureHandler(handlerTag, newView, _actionType, propsRef) {
111
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
112
- _NodeManager.default.getHandler(handlerTag).init(newView, propsRef);
113
- } else {
114
- HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
115
- }
116
- },
117
-
118
- updateGestureHandler(handlerTag, newConfig) {
119
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
120
- _NodeManager.default.getHandler(handlerTag).updateGestureConfig(newConfig);
121
-
122
- _InteractionManager.default.getInstance().configureInteractions(_NodeManager.default.getHandler(handlerTag), newConfig);
123
- } else {
124
- HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
125
- }
126
- },
127
-
128
- getGestureHandlerNode(handlerTag) {
129
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
130
- return _NodeManager.default.getHandler(handlerTag);
131
- } else {
132
- return HammerNodeManager.getHandler(handlerTag);
133
- }
134
- },
135
-
136
- dropGestureHandler(handlerTag) {
137
- if ((0, _EnableNewWebImplementation.isNewWebImplementationEnabled)()) {
138
- _NodeManager.default.dropGestureHandler(handlerTag);
139
- } else {
140
- HammerNodeManager.dropGestureHandler(handlerTag);
141
- }
142
- },
143
-
144
- // eslint-disable-next-line @typescript-eslint/no-empty-function
145
- flushOperations() {}
146
-
147
- };
148
- exports.default = _default;
149
- //# sourceMappingURL=RNGestureHandlerModule.macos.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["RNGestureHandlerModule.macos.ts"],"names":["Gestures","NativeViewGestureHandler","PanGestureHandler","TapGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","ManualGestureHandler","HammerGestures","HammerNativeViewGestureHandler","HammerPanGestureHandler","HammerTapGestureHandler","HammerLongPressGestureHandler","HammerPinchGestureHandler","HammerRotationGestureHandler","HammerFlingGestureHandler","handleSetJSResponder","_tag","_blockNativeResponder","handleClearJSResponder","createGestureHandler","handlerName","handlerTag","config","Error","GestureClass","NodeManager","GestureHandlerWebDelegate","InteractionManager","getInstance","configureInteractions","getHandler","HammerNodeManager","updateGestureHandler","attachGestureHandler","newView","_actionType","propsRef","init","setView","newConfig","updateGestureConfig","getGestureHandlerNode","dropGestureHandler","flushOperations"],"mappings":"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","sourcesContent":["import { ActionType } from './ActionType';\nimport { isNewWebImplementationEnabled } from './EnableNewWebImplementation';\n\n//GestureHandlers\nimport InteractionManager from './web/tools/InteractionManager';\nimport NodeManager from './web/tools/NodeManager';\nimport PanGestureHandler from './web/handlers/PanGestureHandler';\nimport TapGestureHandler from './web/handlers/TapGestureHandler';\nimport LongPressGestureHandler from './web/handlers/LongPressGestureHandler';\nimport PinchGestureHandler from './web/handlers/PinchGestureHandler';\nimport RotationGestureHandler from './web/handlers/RotationGestureHandler';\nimport FlingGestureHandler from './web/handlers/FlingGestureHandler';\nimport NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';\nimport ManualGestureHandler from './web/handlers/ManualGestureHandler';\n\n//Hammer Handlers\nimport * as HammerNodeManager from './web_hammer/NodeManager';\nimport HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';\nimport HammerPanGestureHandler from './web_hammer/PanGestureHandler';\nimport HammerTapGestureHandler from './web_hammer/TapGestureHandler';\nimport HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';\nimport HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';\nimport HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';\nimport HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';\nimport { Config } from './web/interfaces';\nimport { GestureHandlerWebDelegate } from './web/tools/GestureHandlerWebDelegate';\n\nexport const Gestures = {\n NativeViewGestureHandler,\n PanGestureHandler,\n TapGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n ManualGestureHandler,\n};\n\nexport const HammerGestures = {\n NativeViewGestureHandler: HammerNativeViewGestureHandler,\n PanGestureHandler: HammerPanGestureHandler,\n TapGestureHandler: HammerTapGestureHandler,\n LongPressGestureHandler: HammerLongPressGestureHandler,\n PinchGestureHandler: HammerPinchGestureHandler,\n RotationGestureHandler: HammerRotationGestureHandler,\n FlingGestureHandler: HammerFlingGestureHandler,\n};\n\nexport default {\n handleSetJSResponder(_tag: number, _blockNativeResponder: boolean) {\n // NO-OP\n },\n handleClearJSResponder() {\n // NO-OP\n },\n createGestureHandler<T>(\n handlerName: keyof typeof Gestures,\n handlerTag: number,\n config: T\n ) {\n if (isNewWebImplementationEnabled()) {\n if (!(handlerName in Gestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n const GestureClass = Gestures[handlerName];\n NodeManager.createGestureHandler(\n handlerTag,\n new GestureClass(new GestureHandlerWebDelegate())\n );\n InteractionManager.getInstance().configureInteractions(\n NodeManager.getHandler(handlerTag),\n config as unknown as Config\n );\n } else {\n if (!(handlerName in HammerGestures)) {\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n }\n\n // @ts-ignore If it doesn't exist, the error is thrown\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const GestureClass = HammerGestures[handlerName];\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());\n }\n\n this.updateGestureHandler(handlerTag, config as unknown as Config);\n },\n attachGestureHandler(\n handlerTag: number,\n newView: number,\n _actionType: ActionType,\n propsRef: React.RefObject<unknown>\n ) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).init(newView, propsRef);\n } else {\n HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);\n }\n },\n updateGestureHandler(handlerTag: number, newConfig: Config) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n\n InteractionManager.getInstance().configureInteractions(\n NodeManager.getHandler(handlerTag),\n newConfig\n );\n } else {\n HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n }\n },\n getGestureHandlerNode(handlerTag: number) {\n if (isNewWebImplementationEnabled()) {\n return NodeManager.getHandler(handlerTag);\n } else {\n return HammerNodeManager.getHandler(handlerTag);\n }\n },\n dropGestureHandler(handlerTag: number) {\n if (isNewWebImplementationEnabled()) {\n NodeManager.dropGestureHandler(handlerTag);\n } else {\n HammerNodeManager.dropGestureHandler(handlerTag);\n }\n },\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n flushOperations() {},\n};\n"]}