@react-native-oh-tpl/react-native-gesture-handler 2.12.6-1 → 2.12.6-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 (79) hide show
  1. package/harmony/gesture_handler/LICENSE +21 -0
  2. package/harmony/gesture_handler/OAT.xml +44 -0
  3. package/harmony/gesture_handler/README.OpenSource +11 -0
  4. package/harmony/gesture_handler/README.md +1 -0
  5. package/harmony/gesture_handler/build-profile.json5 +7 -7
  6. package/harmony/gesture_handler/hvigorfile.ts +2 -2
  7. package/harmony/gesture_handler/index.ets +2 -2
  8. package/harmony/gesture_handler/oh-package.json5 +13 -11
  9. package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +8 -8
  10. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +33 -33
  11. package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +14 -14
  12. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +60 -60
  13. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +17 -17
  14. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +11 -11
  15. package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +60 -60
  16. package/harmony/gesture_handler/src/main/ets/CircularBuffer.ts +42 -42
  17. package/harmony/gesture_handler/src/main/ets/Event.ts +67 -67
  18. package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +37 -37
  19. package/harmony/gesture_handler/src/main/ets/GestureHandler.ts +663 -663
  20. package/harmony/gesture_handler/src/main/ets/GestureHandlerArkUIAdapter.ets +201 -201
  21. package/harmony/gesture_handler/src/main/ets/GestureHandlerFactory.ts +44 -44
  22. package/harmony/gesture_handler/src/main/ets/GestureHandlerOrchestrator.ts +280 -280
  23. package/harmony/gesture_handler/src/main/ets/GestureHandlerPackage.ts +22 -22
  24. package/harmony/gesture_handler/src/main/ets/GestureHandlerRegistry.ts +27 -27
  25. package/harmony/gesture_handler/src/main/ets/InteractionManager.ts +108 -108
  26. package/harmony/gesture_handler/src/main/ets/LeastSquareSolver.ts +182 -182
  27. package/harmony/gesture_handler/src/main/ets/NativeViewGestureHandler.ts +114 -114
  28. package/harmony/gesture_handler/src/main/ets/OutgoingEvent.ts +33 -33
  29. package/harmony/gesture_handler/src/main/ets/PanGestureHandler.ts +327 -327
  30. package/harmony/gesture_handler/src/main/ets/PointerTracker.ts +239 -239
  31. package/harmony/gesture_handler/src/main/ets/RNGHError.ts +4 -4
  32. package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +28 -28
  33. package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandler.ets +57 -57
  34. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerButton.ets +36 -36
  35. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerModule.ts +125 -125
  36. package/harmony/gesture_handler/src/main/ets/RNGestureHandlerRootView.ets +56 -55
  37. package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +10 -10
  38. package/harmony/gesture_handler/src/main/ets/State.ts +46 -46
  39. package/harmony/gesture_handler/src/main/ets/TapGestureHandler.ts +205 -205
  40. package/harmony/gesture_handler/src/main/ets/Vector2D.ts +36 -36
  41. package/harmony/gesture_handler/src/main/ets/VelocityTracker.ts +98 -98
  42. package/harmony/gesture_handler/src/main/ets/View.ts +70 -70
  43. package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +42 -42
  44. package/harmony/gesture_handler/src/main/ets/pages/Index.ets +16 -16
  45. package/harmony/gesture_handler/src/main/ets/webviewability/WebviewAbility.ts +41 -41
  46. package/harmony/gesture_handler/src/main/module.json5 +6 -6
  47. package/harmony/gesture_handler/src/main/resources/base/element/color.json +7 -7
  48. package/harmony/gesture_handler/src/main/resources/base/element/string.json +15 -15
  49. package/harmony/gesture_handler/src/main/resources/base/profile/main_pages.json +5 -5
  50. package/harmony/gesture_handler/src/main/resources/en_US/element/string.json +15 -15
  51. package/harmony/gesture_handler/src/main/resources/zh_CN/element/string.json +15 -15
  52. package/harmony/gesture_handler.har +0 -0
  53. package/lib/commonjs/components/touchables/GenericTouchable.js +9 -9
  54. package/lib/commonjs/components/touchables/TouchableOpacity.js +2 -2
  55. package/lib/commonjs/handlers/createNativeWrapper.js +6 -6
  56. package/lib/commonjs/handlers/gestures/GestureDetector.js +3 -3
  57. package/lib/module/components/touchables/GenericTouchable.js +9 -9
  58. package/lib/module/components/touchables/TouchableOpacity.js +2 -2
  59. package/lib/module/handlers/createNativeWrapper.js +6 -6
  60. package/lib/module/handlers/gestures/GestureDetector.js +3 -3
  61. package/package.json +70 -70
  62. package/src/RNGestureHandlerModule.ts +6 -6
  63. package/src/components/GestureButtons.tsx +334 -334
  64. package/src/components/GestureHandlerButton.tsx +5 -5
  65. package/src/components/GestureHandlerRootView.tsx +34 -34
  66. package/src/components/RNGestureHandlerButton.tsx +23 -23
  67. package/src/components/touchables/GenericTouchable.tsx +301 -301
  68. package/src/components/touchables/TouchableOpacity.tsx +76 -76
  69. package/src/components/touchables/TouchableWithoutFeedback.tsx +14 -14
  70. package/src/components/touchables/index.ts +7 -7
  71. package/src/handlers/NativeViewGestureHandler.ts +55 -55
  72. package/src/handlers/PanGestureHandler.ts +327 -327
  73. package/src/handlers/TapGestureHandler.ts +95 -95
  74. package/src/handlers/createHandler.tsx +535 -535
  75. package/src/handlers/createNativeWrapper.tsx +81 -81
  76. package/src/handlers/gestureHandlerCommon.ts +15 -15
  77. package/src/handlers/gestures/GestureDetector.tsx +823 -823
  78. package/src/index.ts +172 -172
  79. package/src/init.ts +18 -18
@@ -1,81 +1,81 @@
1
- import * as React from 'react';
2
- import { useImperativeHandle, useRef } from 'react';
3
-
4
- import {
5
- NativeViewGestureHandler,
6
- NativeViewGestureHandlerProps,
7
- nativeViewProps,
8
- } from './NativeViewGestureHandler';
9
-
10
- /*
11
- * This array should consist of:
12
- * - All keys in propTypes from NativeGestureHandler
13
- * (and all keys in GestureHandlerPropTypes)
14
- * - 'onGestureHandlerEvent'
15
- * - 'onGestureHandlerStateChange'
16
- */
17
- const NATIVE_WRAPPER_PROPS_FILTER = [
18
- ...nativeViewProps,
19
- 'onGestureHandlerEvent',
20
- 'onGestureHandlerStateChange',
21
- ] as const;
22
-
23
- export default function createNativeWrapper<P>(
24
- Component: React.ComponentType<P>,
25
- config: Readonly<NativeViewGestureHandlerProps> = {}
26
- ) {
27
- const ComponentWrapper = React.forwardRef<
28
- React.ComponentType<any>,
29
- P & NativeViewGestureHandlerProps
30
- >((props, ref) => {
31
- // filter out props that should be passed to gesture handler wrapper
32
- const gestureHandlerProps = Object.keys(props).reduce(
33
- (res, key) => {
34
- // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info
35
- const allowedKeys: readonly string[] = NATIVE_WRAPPER_PROPS_FILTER;
36
- if (allowedKeys.includes(key)) {
37
- // @ts-ignore FIXME(TS)
38
- res[key] = props[key];
39
- }
40
- return res;
41
- },
42
- { ...config } // watch out not to modify config
43
- );
44
- const _ref = useRef<React.ComponentType<P>>();
45
- const _gestureHandlerRef = useRef<React.ComponentType<P>>();
46
- useImperativeHandle(
47
- ref,
48
- // @ts-ignore TODO(TS) decide how nulls work in this context
49
- () => {
50
- const node = _gestureHandlerRef.current;
51
- // add handlerTag for relations config
52
- if (_ref.current && node) {
53
- // @ts-ignore FIXME(TS) think about createHandler return type
54
- _ref.current.handlerTag = node.handlerTag;
55
- return _ref.current;
56
- }
57
- return null;
58
- },
59
- [_ref, _gestureHandlerRef]
60
- );
61
- return (
62
- <NativeViewGestureHandler
63
- {...gestureHandlerProps}
64
- // @ts-ignore TODO(TS)
65
- ref={_gestureHandlerRef}
66
- >
67
- <Component {...props} ref={_ref} />
68
- </NativeViewGestureHandler>
69
- );
70
- });
71
-
72
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
73
- ComponentWrapper.displayName =
74
- Component?.displayName ||
75
- // @ts-ignore if render doesn't exist it will return undefined and go further
76
- Component?.render?.name ||
77
- (typeof Component === 'string' && Component) ||
78
- 'ComponentWrapper';
79
-
80
- return ComponentWrapper;
81
- }
1
+ import * as React from 'react';
2
+ import { useImperativeHandle, useRef } from 'react';
3
+
4
+ import {
5
+ NativeViewGestureHandler,
6
+ NativeViewGestureHandlerProps,
7
+ nativeViewProps,
8
+ } from './NativeViewGestureHandler';
9
+
10
+ /*
11
+ * This array should consist of:
12
+ * - All keys in propTypes from NativeGestureHandler
13
+ * (and all keys in GestureHandlerPropTypes)
14
+ * - 'onGestureHandlerEvent'
15
+ * - 'onGestureHandlerStateChange'
16
+ */
17
+ const NATIVE_WRAPPER_PROPS_FILTER = [
18
+ ...nativeViewProps,
19
+ 'onGestureHandlerEvent',
20
+ 'onGestureHandlerStateChange',
21
+ ] as const;
22
+
23
+ export default function createNativeWrapper<P>(
24
+ Component: React.ComponentType<P>,
25
+ config: Readonly<NativeViewGestureHandlerProps> = {}
26
+ ) {
27
+ const ComponentWrapper = React.forwardRef<
28
+ React.ComponentType<any>,
29
+ P & NativeViewGestureHandlerProps
30
+ >((props, ref) => {
31
+ // filter out props that should be passed to gesture handler wrapper
32
+ const gestureHandlerProps = Object.keys(props).reduce(
33
+ (res, key) => {
34
+ // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info
35
+ const allowedKeys: readonly string[] = NATIVE_WRAPPER_PROPS_FILTER;
36
+ if (allowedKeys.includes(key)) {
37
+ // @ts-ignore FIXME(TS)
38
+ res[key] = props[key];
39
+ }
40
+ return res;
41
+ },
42
+ { ...config } // watch out not to modify config
43
+ );
44
+ const _ref = useRef<React.ComponentType<P>>();
45
+ const _gestureHandlerRef = useRef<React.ComponentType<P>>();
46
+ useImperativeHandle(
47
+ ref,
48
+ // @ts-ignore TODO(TS) decide how nulls work in this context
49
+ () => {
50
+ const node = _gestureHandlerRef.current;
51
+ // add handlerTag for relations config
52
+ if (_ref.current && node) {
53
+ // @ts-ignore FIXME(TS) think about createHandler return type
54
+ _ref.current.handlerTag = node.handlerTag;
55
+ return _ref.current;
56
+ }
57
+ return null;
58
+ },
59
+ [_ref, _gestureHandlerRef]
60
+ );
61
+ return (
62
+ <NativeViewGestureHandler
63
+ {...gestureHandlerProps}
64
+ // @ts-ignore TODO(TS)
65
+ ref={_gestureHandlerRef}
66
+ >
67
+ <Component {...props} ref={_ref} />
68
+ </NativeViewGestureHandler>
69
+ );
70
+ });
71
+
72
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
73
+ ComponentWrapper.displayName =
74
+ Component?.displayName ||
75
+ // @ts-ignore if render doesn't exist it will return undefined and go further
76
+ Component?.render?.name ||
77
+ (typeof Component === 'string' && Component) ||
78
+ 'ComponentWrapper';
79
+
80
+ return ComponentWrapper;
81
+ }
@@ -1,15 +1,15 @@
1
- import { RNGestureHandlerModule } from '../RNGestureHandlerModule'; // RNGH: patch
2
-
3
- let flushOperationsScheduled = false;
4
-
5
- export function scheduleFlushOperations() {
6
- if (!flushOperationsScheduled) {
7
- flushOperationsScheduled = true;
8
- queueMicrotask(() => {
9
- if (RNGestureHandlerModule) {
10
- RNGestureHandlerModule.flushOperations();
11
- }
12
- flushOperationsScheduled = false;
13
- });
14
- }
15
- }
1
+ import { RNGestureHandlerModule } from '../RNGestureHandlerModule'; // RNGH: patch
2
+
3
+ let flushOperationsScheduled = false;
4
+
5
+ export function scheduleFlushOperations() {
6
+ if (!flushOperationsScheduled) {
7
+ flushOperationsScheduled = true;
8
+ queueMicrotask(() => {
9
+ if (RNGestureHandlerModule) {
10
+ RNGestureHandlerModule.flushOperations();
11
+ }
12
+ flushOperationsScheduled = false;
13
+ });
14
+ }
15
+ }