@react-native-oh-tpl/react-native-gesture-handler 2.12.6-2 → 2.12.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/harmony/gesture_handler/BuildProfile.ets +5 -0
- package/harmony/gesture_handler/build-profile.json5 +13 -2
- package/harmony/gesture_handler/hvigorfile.ts +1 -1
- package/harmony/gesture_handler/index.ets +1 -1
- package/harmony/gesture_handler/oh-package-lock.json5 +17 -0
- package/harmony/gesture_handler/oh-package.json5 +10 -11
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +75 -6
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +14 -8
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +4 -28
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentInstance.h +27 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonJSIBinder.h +32 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +17 -12
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +5 -2
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerPackage.h +72 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +4 -28
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentInstance.h +78 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewJSIBinder.h +25 -0
- package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +16 -1
- package/harmony/gesture_handler/src/main/ets/GestureHandler.ts +2 -2
- package/harmony/gesture_handler/src/main/ets/{GestureHandlerArkUIAdapter.ets → GestureHandlerArkUIAdapter.ts} +2 -1
- package/harmony/gesture_handler/src/main/ets/GestureHandlerPackage.ts +2 -2
- package/harmony/gesture_handler/src/main/ets/OutgoingEvent.ts +5 -5
- package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +20 -1
- package/harmony/gesture_handler/src/main/ets/{RNGHRootTouchHandler.ets → RNGHRootTouchHandlerArkTS.ts} +5 -3
- package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerCAPI.ts +87 -0
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerButton.ets +4 -3
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerModule.ts +65 -7
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerRootView.ets +7 -11
- package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +17 -5
- package/harmony/gesture_handler/src/main/ets/View.ts +1 -1
- package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +1 -1
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerButton.ts +140 -0
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerModule.ts +25 -0
- package/harmony/gesture_handler/src/main/ets/namespace/RNGestureHandlerRootView.ts +101 -0
- package/harmony/gesture_handler/src/main/ets/namespace/ts.ts +3 -0
- package/harmony/gesture_handler/src/main/ets/types.ts +25 -0
- package/harmony/gesture_handler/src/main/module.json5 +6 -6
- package/harmony/gesture_handler/ts.ts +2 -1
- package/harmony/gesture_handler.har +0 -0
- package/lib/commonjs/RNGestureHandlerModule.js +6 -3
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerRootView.js +5 -13
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +31 -28
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/index.js +42 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +10 -0
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js +11 -0
- package/lib/commonjs/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js +11 -0
- package/lib/commonjs/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.js +3 -2
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.js +3 -11
- package/lib/module/components/GestureHandlerRootView.js.map +1 -1
- package/lib/module/handlers/createHandler.js +20 -19
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/index.js +6 -14
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js +3 -0
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js +3 -0
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.js.map +1 -0
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js +3 -0
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.js.map +1 -0
- package/lib/typescript/RNGestureHandlerModule.d.ts +2 -6
- package/lib/typescript/RNGestureHandlerModule.d.ts.map +1 -1
- package/lib/typescript/components/GestureHandlerRootView.d.ts +6 -6
- package/lib/typescript/components/GestureHandlerRootView.d.ts.map +1 -1
- package/lib/typescript/handlers/createHandler.d.ts +11 -11
- package/lib/typescript/handlers/createHandler.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +9 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +15 -0
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts.map +1 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +15 -0
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +7 -0
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts.map +1 -0
- package/package.json +9 -13
- package/src/RNGestureHandlerModule.ts +3 -4
- package/src/components/GestureHandlerRootView.tsx +4 -15
- package/src/handlers/createHandler.tsx +4 -5
- package/src/index.ts +13 -13
- package/src/specs/NativeRNGestureHandlerModule.ts +26 -0
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +18 -0
- package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -0
- package/README.md +0 -1
- package/harmony/gesture_handler/LICENSE +0 -21
- package/harmony/gesture_handler/OAT.xml +0 -44
- package/harmony/gesture_handler/README.OpenSource +0 -11
- package/harmony/gesture_handler/README.md +0 -1
- package/lib/commonjs/components/GestureButtons.js +0 -186
- package/lib/commonjs/components/GestureButtons.js.map +0 -1
- package/lib/commonjs/components/GestureHandlerButton.js +0 -9
- package/lib/commonjs/components/GestureHandlerButton.js.map +0 -1
- package/lib/commonjs/components/RNGestureHandlerButton.js +0 -23
- package/lib/commonjs/components/RNGestureHandlerButton.js.map +0 -1
- package/lib/commonjs/components/touchables/GenericTouchable.js +0 -247
- package/lib/commonjs/components/touchables/GenericTouchable.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableOpacity.js +0 -58
- package/lib/commonjs/components/touchables/TouchableOpacity.js.map +0 -1
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js +0 -18
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +0 -1
- package/lib/commonjs/components/touchables/index.js +0 -21
- package/lib/commonjs/components/touchables/index.js.map +0 -1
- package/lib/commonjs/handlers/NativeViewGestureHandler.js +0 -19
- package/lib/commonjs/handlers/NativeViewGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/PanGestureHandler.js +0 -103
- package/lib/commonjs/handlers/PanGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/TapGestureHandler.js +0 -22
- package/lib/commonjs/handlers/TapGestureHandler.js.map +0 -1
- package/lib/commonjs/handlers/createNativeWrapper.js +0 -64
- package/lib/commonjs/handlers/createNativeWrapper.js.map +0 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +0 -22
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +0 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +0 -554
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +0 -1
- package/lib/commonjs/init.js +0 -24
- package/lib/commonjs/init.js.map +0 -1
- package/lib/module/components/GestureButtons.js +0 -168
- package/lib/module/components/GestureButtons.js.map +0 -1
- package/lib/module/components/GestureHandlerButton.js +0 -3
- package/lib/module/components/GestureHandlerButton.js.map +0 -1
- package/lib/module/components/RNGestureHandlerButton.js +0 -17
- package/lib/module/components/RNGestureHandlerButton.js.map +0 -1
- package/lib/module/components/touchables/GenericTouchable.js +0 -238
- package/lib/module/components/touchables/GenericTouchable.js.map +0 -1
- package/lib/module/components/touchables/TouchableOpacity.js +0 -49
- package/lib/module/components/touchables/TouchableOpacity.js.map +0 -1
- package/lib/module/components/touchables/TouchableWithoutFeedback.js +0 -9
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +0 -1
- package/lib/module/components/touchables/index.js +0 -8
- package/lib/module/components/touchables/index.js.map +0 -1
- package/lib/module/handlers/NativeViewGestureHandler.js +0 -12
- package/lib/module/handlers/NativeViewGestureHandler.js.map +0 -1
- package/lib/module/handlers/PanGestureHandler.js +0 -92
- package/lib/module/handlers/PanGestureHandler.js.map +0 -1
- package/lib/module/handlers/TapGestureHandler.js +0 -14
- package/lib/module/handlers/TapGestureHandler.js.map +0 -1
- package/lib/module/handlers/createNativeWrapper.js +0 -57
- package/lib/module/handlers/createNativeWrapper.js.map +0 -1
- package/lib/module/handlers/gestureHandlerCommon.js +0 -15
- package/lib/module/handlers/gestureHandlerCommon.js.map +0 -1
- package/lib/module/handlers/gestures/GestureDetector.js +0 -543
- package/lib/module/handlers/gestures/GestureDetector.js.map +0 -1
- package/lib/module/init.js +0 -17
- package/lib/module/init.js.map +0 -1
- package/lib/typescript/components/GestureButtons.d.ts +0 -122
- package/lib/typescript/components/GestureButtons.d.ts.map +0 -1
- package/lib/typescript/components/GestureHandlerButton.d.ts +0 -5
- package/lib/typescript/components/GestureHandlerButton.d.ts.map +0 -1
- package/lib/typescript/components/RNGestureHandlerButton.d.ts +0 -2
- package/lib/typescript/components/RNGestureHandlerButton.d.ts.map +0 -1
- package/lib/typescript/components/touchables/GenericTouchable.d.ts +0 -68
- package/lib/typescript/components/touchables/GenericTouchable.d.ts.map +0 -1
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts +0 -26
- package/lib/typescript/components/touchables/TouchableOpacity.d.ts.map +0 -1
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +0 -8
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts.map +0 -1
- package/lib/typescript/components/touchables/index.d.ts +0 -4
- package/lib/typescript/components/touchables/index.d.ts.map +0 -1
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +0 -29
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts.map +0 -1
- package/lib/typescript/handlers/PanGestureHandler.d.ts +0 -140
- package/lib/typescript/handlers/PanGestureHandler.d.ts.map +0 -1
- package/lib/typescript/handlers/TapGestureHandler.d.ts +0 -58
- package/lib/typescript/handlers/TapGestureHandler.d.ts.map +0 -1
- package/lib/typescript/handlers/createNativeWrapper.d.ts +0 -4
- package/lib/typescript/handlers/createNativeWrapper.d.ts.map +0 -1
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +0 -2
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts.map +0 -1
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +0 -24
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts.map +0 -1
- package/lib/typescript/init.d.ts +0 -3
- package/lib/typescript/init.d.ts.map +0 -1
- package/src/components/GestureButtons.tsx +0 -334
- package/src/components/GestureHandlerButton.tsx +0 -5
- package/src/components/RNGestureHandlerButton.tsx +0 -23
- package/src/components/touchables/GenericTouchable.tsx +0 -301
- package/src/components/touchables/TouchableOpacity.tsx +0 -76
- package/src/components/touchables/TouchableWithoutFeedback.tsx +0 -14
- package/src/components/touchables/index.ts +0 -7
- package/src/handlers/NativeViewGestureHandler.ts +0 -55
- package/src/handlers/PanGestureHandler.ts +0 -327
- package/src/handlers/TapGestureHandler.ts +0 -95
- package/src/handlers/createNativeWrapper.tsx +0 -81
- package/src/handlers/gestureHandlerCommon.ts +0 -15
- package/src/handlers/gestures/GestureDetector.tsx +0 -823
- package/src/init.ts +0 -18
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Animated,
|
|
3
|
-
Easing,
|
|
4
|
-
StyleSheet,
|
|
5
|
-
View,
|
|
6
|
-
TouchableOpacityProps as RNTouchableOpacityProps,
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
import GenericTouchable, {
|
|
9
|
-
TOUCHABLE_STATE,
|
|
10
|
-
GenericTouchableProps,
|
|
11
|
-
} from './GenericTouchable';
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
import { Component } from 'react';
|
|
14
|
-
|
|
15
|
-
export type TouchableOpacityProps = RNTouchableOpacityProps &
|
|
16
|
-
GenericTouchableProps & {
|
|
17
|
-
useNativeAnimations?: boolean;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* TouchableOpacity bases on timing animation which has been used in RN's core
|
|
22
|
-
*/
|
|
23
|
-
export default class TouchableOpacity extends Component<TouchableOpacityProps> {
|
|
24
|
-
static defaultProps = {
|
|
25
|
-
...GenericTouchable.defaultProps,
|
|
26
|
-
activeOpacity: 0.2,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// opacity is 1 one by default but could be overwritten
|
|
30
|
-
getChildStyleOpacityWithDefault = () => {
|
|
31
|
-
const childStyle = StyleSheet.flatten(this.props.style) || {};
|
|
32
|
-
return childStyle.opacity == null
|
|
33
|
-
? 1
|
|
34
|
-
: (childStyle.opacity.valueOf() as number);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
opacity = new Animated.Value(this.getChildStyleOpacityWithDefault());
|
|
38
|
-
|
|
39
|
-
setOpacityTo = (value: number, duration: number) => {
|
|
40
|
-
Animated.timing(this.opacity, {
|
|
41
|
-
toValue: value,
|
|
42
|
-
duration: duration,
|
|
43
|
-
easing: Easing.inOut(Easing.quad),
|
|
44
|
-
useNativeDriver: this.props.useNativeAnimations ?? true,
|
|
45
|
-
}).start();
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
onStateChange = (_from: number, to: number) => {
|
|
49
|
-
if (to === TOUCHABLE_STATE.BEGAN) {
|
|
50
|
-
this.setOpacityTo(this.props.activeOpacity!, 0);
|
|
51
|
-
} else if (
|
|
52
|
-
to === TOUCHABLE_STATE.UNDETERMINED ||
|
|
53
|
-
to === TOUCHABLE_STATE.MOVED_OUTSIDE
|
|
54
|
-
) {
|
|
55
|
-
this.setOpacityTo(this.getChildStyleOpacityWithDefault(), 150);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
render() {
|
|
60
|
-
const { style = {}, ...rest } = this.props;
|
|
61
|
-
return (
|
|
62
|
-
<GenericTouchable
|
|
63
|
-
{...rest}
|
|
64
|
-
style={[
|
|
65
|
-
style,
|
|
66
|
-
{
|
|
67
|
-
opacity: this.opacity as unknown as number, // TODO: fix this
|
|
68
|
-
},
|
|
69
|
-
]}
|
|
70
|
-
onStateChange={this.onStateChange}
|
|
71
|
-
>
|
|
72
|
-
{this.props.children ? this.props.children : <View />}
|
|
73
|
-
</GenericTouchable>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
|
-
import GenericTouchable, { GenericTouchableProps } from './GenericTouchable';
|
|
4
|
-
|
|
5
|
-
export type TouchableWithoutFeedbackProps = GenericTouchable;
|
|
6
|
-
|
|
7
|
-
const TouchableWithoutFeedback = React.forwardRef<
|
|
8
|
-
TouchableWithoutFeedbackProps,
|
|
9
|
-
PropsWithChildren<GenericTouchableProps>
|
|
10
|
-
>((props, ref) => <GenericTouchable ref={ref} {...props} />);
|
|
11
|
-
|
|
12
|
-
TouchableWithoutFeedback.defaultProps = GenericTouchable.defaultProps;
|
|
13
|
-
|
|
14
|
-
export default TouchableWithoutFeedback;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// export type { TouchableHighlightProps } from './TouchableHighlight';
|
|
2
|
-
export type { TouchableOpacityProps } from './TouchableOpacity';
|
|
3
|
-
// export type { TouchableWithoutFeedbackProps } from './TouchableWithoutFeedback';
|
|
4
|
-
// export { default as TouchableNativeFeedback } from './TouchableNativeFeedback';
|
|
5
|
-
export { default as TouchableWithoutFeedback } from './TouchableWithoutFeedback';
|
|
6
|
-
export { default as TouchableOpacity } from './TouchableOpacity';
|
|
7
|
-
// export { default as TouchableHighlight } from './TouchableHighlight';
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import createHandler from './createHandler';
|
|
2
|
-
import {
|
|
3
|
-
BaseGestureHandlerProps,
|
|
4
|
-
baseGestureHandlerProps,
|
|
5
|
-
} from 'react-native-gesture-handler/src/handlers/gestureHandlerCommon';
|
|
6
|
-
|
|
7
|
-
export const nativeViewGestureHandlerProps = [
|
|
8
|
-
'shouldActivateOnStart',
|
|
9
|
-
'disallowInterruption',
|
|
10
|
-
] as const;
|
|
11
|
-
|
|
12
|
-
export interface NativeViewGestureConfig {
|
|
13
|
-
/**
|
|
14
|
-
* Android only.
|
|
15
|
-
*
|
|
16
|
-
* Determines whether the handler should check for an existing touch event on
|
|
17
|
-
* instantiation.
|
|
18
|
-
*/
|
|
19
|
-
shouldActivateOnStart?: boolean;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* When `true`, cancels all other gesture handlers when this
|
|
23
|
-
* `NativeViewGestureHandler` receives an `ACTIVE` state event.
|
|
24
|
-
*/
|
|
25
|
-
disallowInterruption?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface NativeViewGestureHandlerProps
|
|
29
|
-
extends BaseGestureHandlerProps<NativeViewGestureHandlerPayload>,
|
|
30
|
-
NativeViewGestureConfig {}
|
|
31
|
-
|
|
32
|
-
export type NativeViewGestureHandlerPayload = {
|
|
33
|
-
/**
|
|
34
|
-
* True if gesture was performed inside of containing view, false otherwise.
|
|
35
|
-
*/
|
|
36
|
-
pointerInside: boolean;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const nativeViewProps = [
|
|
40
|
-
...baseGestureHandlerProps,
|
|
41
|
-
...nativeViewGestureHandlerProps,
|
|
42
|
-
] as const;
|
|
43
|
-
|
|
44
|
-
export const nativeViewHandlerName = 'NativeViewGestureHandler';
|
|
45
|
-
|
|
46
|
-
export type NativeViewGestureHandler = typeof NativeViewGestureHandler;
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
|
48
|
-
export const NativeViewGestureHandler = createHandler<
|
|
49
|
-
NativeViewGestureHandlerProps,
|
|
50
|
-
NativeViewGestureHandlerPayload
|
|
51
|
-
>({
|
|
52
|
-
name: nativeViewHandlerName,
|
|
53
|
-
allowedProps: nativeViewProps,
|
|
54
|
-
config: {},
|
|
55
|
-
});
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
// RNGH: patching to replace `createHandler`
|
|
2
|
-
|
|
3
|
-
import createHandler from './createHandler'; // RNGH: using local create handler
|
|
4
|
-
import {
|
|
5
|
-
BaseGestureHandlerProps,
|
|
6
|
-
baseGestureHandlerProps,
|
|
7
|
-
} from 'react-native-gesture-handler/src/handlers/gestureHandlerCommon';
|
|
8
|
-
|
|
9
|
-
export const panGestureHandlerProps = [
|
|
10
|
-
'activeOffsetY',
|
|
11
|
-
'activeOffsetX',
|
|
12
|
-
'failOffsetY',
|
|
13
|
-
'failOffsetX',
|
|
14
|
-
'minDist',
|
|
15
|
-
'minVelocity',
|
|
16
|
-
'minVelocityX',
|
|
17
|
-
'minVelocityY',
|
|
18
|
-
'minPointers',
|
|
19
|
-
'maxPointers',
|
|
20
|
-
'avgTouches',
|
|
21
|
-
'enableTrackpadTwoFingerGesture',
|
|
22
|
-
'activateAfterLongPress',
|
|
23
|
-
] as const;
|
|
24
|
-
|
|
25
|
-
export const panGestureHandlerCustomNativeProps = [
|
|
26
|
-
'activeOffsetYStart',
|
|
27
|
-
'activeOffsetYEnd',
|
|
28
|
-
'activeOffsetXStart',
|
|
29
|
-
'activeOffsetXEnd',
|
|
30
|
-
'failOffsetYStart',
|
|
31
|
-
'failOffsetYEnd',
|
|
32
|
-
'failOffsetXStart',
|
|
33
|
-
'failOffsetXEnd',
|
|
34
|
-
] as const;
|
|
35
|
-
|
|
36
|
-
export type PanGestureHandlerEventPayload = {
|
|
37
|
-
/**
|
|
38
|
-
* X coordinate of the current position of the pointer (finger or a leading
|
|
39
|
-
* pointer when there are multiple fingers placed) relative to the view
|
|
40
|
-
* attached to the handler. Expressed in point units.
|
|
41
|
-
*/
|
|
42
|
-
x: number;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Y coordinate of the current position of the pointer (finger or a leading
|
|
46
|
-
* pointer when there are multiple fingers placed) relative to the view
|
|
47
|
-
* attached to the handler. Expressed in point units.
|
|
48
|
-
*/
|
|
49
|
-
y: number;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* X coordinate of the current position of the pointer (finger or a leading
|
|
53
|
-
* pointer when there are multiple fingers placed) relative to the window.
|
|
54
|
-
* The value is expressed in point units. It is recommended to use it instead
|
|
55
|
-
* of `x` in cases when the original view can be transformed as an effect of
|
|
56
|
-
* the gesture.
|
|
57
|
-
*/
|
|
58
|
-
absoluteX: number;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Y coordinate of the current position of the pointer (finger or a leading
|
|
62
|
-
* pointer when there are multiple fingers placed) relative to the window.
|
|
63
|
-
* The value is expressed in point units. It is recommended to use it instead
|
|
64
|
-
* of `y` in cases when the original view can be transformed as an
|
|
65
|
-
* effect of the gesture.
|
|
66
|
-
*/
|
|
67
|
-
absoluteY: number;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Translation of the pan gesture along X axis accumulated over the time of
|
|
71
|
-
* the gesture. The value is expressed in the point units.
|
|
72
|
-
*/
|
|
73
|
-
translationX: number;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Translation of the pan gesture along Y axis accumulated over the time of
|
|
77
|
-
* the gesture. The value is expressed in the point units.
|
|
78
|
-
*/
|
|
79
|
-
translationY: number;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Velocity of the pan gesture along the X axis in the current moment. The
|
|
83
|
-
* value is expressed in point units per second.
|
|
84
|
-
*/
|
|
85
|
-
velocityX: number;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Velocity of the pan gesture along the Y axis in the current moment. The
|
|
89
|
-
* value is expressed in point units per second.
|
|
90
|
-
*/
|
|
91
|
-
velocityY: number;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
interface CommonPanProperties {
|
|
95
|
-
/**
|
|
96
|
-
* Minimum distance the finger (or multiple finger) need to travel before the
|
|
97
|
-
* handler activates. Expressed in points.
|
|
98
|
-
*/
|
|
99
|
-
minDist?: number;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Android only.
|
|
103
|
-
*/
|
|
104
|
-
avgTouches?: boolean;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Enables two-finger gestures on supported devices, for example iPads with
|
|
108
|
-
* trackpads. If not enabled the gesture will require click + drag, with
|
|
109
|
-
* enableTrackpadTwoFingerGesture swiping with two fingers will also trigger
|
|
110
|
-
* the gesture.
|
|
111
|
-
*/
|
|
112
|
-
enableTrackpadTwoFingerGesture?: boolean;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* A number of fingers that is required to be placed before handler can
|
|
116
|
-
* activate. Should be a higher or equal to 0 integer.
|
|
117
|
-
*/
|
|
118
|
-
minPointers?: number;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* When the given number of fingers is placed on the screen and handler hasn't
|
|
122
|
-
* yet activated it will fail recognizing the gesture. Should be a higher or
|
|
123
|
-
* equal to 0 integer.
|
|
124
|
-
*/
|
|
125
|
-
maxPointers?: number;
|
|
126
|
-
|
|
127
|
-
minVelocity?: number;
|
|
128
|
-
minVelocityX?: number;
|
|
129
|
-
minVelocityY?: number;
|
|
130
|
-
activateAfterLongPress?: number;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export interface PanGestureConfig extends CommonPanProperties {
|
|
134
|
-
activeOffsetYStart?: number;
|
|
135
|
-
activeOffsetYEnd?: number;
|
|
136
|
-
activeOffsetXStart?: number;
|
|
137
|
-
activeOffsetXEnd?: number;
|
|
138
|
-
failOffsetYStart?: number;
|
|
139
|
-
failOffsetYEnd?: number;
|
|
140
|
-
failOffsetXStart?: number;
|
|
141
|
-
failOffsetXEnd?: number;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface PanGestureHandlerProps
|
|
145
|
-
extends BaseGestureHandlerProps<PanGestureHandlerEventPayload>,
|
|
146
|
-
CommonPanProperties {
|
|
147
|
-
/**
|
|
148
|
-
* Range along X axis (in points) where fingers travels without activation of
|
|
149
|
-
* handler. Moving outside of this range implies activation of handler. Range
|
|
150
|
-
* can be given as an array or a single number. If range is set as an array,
|
|
151
|
-
* first value must be lower or equal to 0, a the second one higher or equal
|
|
152
|
-
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
|
153
|
-
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
|
154
|
-
*/
|
|
155
|
-
activeOffsetY?: number | number[];
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Range along X axis (in points) where fingers travels without activation of
|
|
159
|
-
* handler. Moving outside of this range implies activation of handler. Range
|
|
160
|
-
* can be given as an array or a single number. If range is set as an array,
|
|
161
|
-
* first value must be lower or equal to 0, a the second one higher or equal
|
|
162
|
-
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
|
163
|
-
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
|
164
|
-
*/
|
|
165
|
-
activeOffsetX?: number | number[];
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* When the finger moves outside this range (in points) along Y axis and
|
|
169
|
-
* handler hasn't yet activated it will fail recognizing the gesture. Range
|
|
170
|
-
* can be given as an array or a single number. If range is set as an array,
|
|
171
|
-
* first value must be lower or equal to 0, a the second one higher or equal
|
|
172
|
-
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
|
173
|
-
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
|
174
|
-
*/
|
|
175
|
-
failOffsetY?: number | number[];
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* When the finger moves outside this range (in points) along X axis and
|
|
179
|
-
* handler hasn't yet activated it will fail recognizing the gesture. Range
|
|
180
|
-
* can be given as an array or a single number. If range is set as an array,
|
|
181
|
-
* first value must be lower or equal to 0, a the second one higher or equal
|
|
182
|
-
* to 0. If only one number `p` is given a range of `(-inf, p)` will be used
|
|
183
|
-
* if `p` is higher or equal to 0 and `(-p, inf)` otherwise.
|
|
184
|
-
*/
|
|
185
|
-
failOffsetX?: number | number[];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export const panHandlerName = 'PanGestureHandler';
|
|
189
|
-
|
|
190
|
-
export type PanGestureHandler = typeof PanGestureHandler;
|
|
191
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
|
192
|
-
export const PanGestureHandler = createHandler<
|
|
193
|
-
PanGestureHandlerProps,
|
|
194
|
-
PanGestureHandlerEventPayload
|
|
195
|
-
>({
|
|
196
|
-
name: panHandlerName,
|
|
197
|
-
allowedProps: [
|
|
198
|
-
...baseGestureHandlerProps,
|
|
199
|
-
...panGestureHandlerProps,
|
|
200
|
-
] as const,
|
|
201
|
-
config: {},
|
|
202
|
-
transformProps: managePanProps,
|
|
203
|
-
customNativeProps: panGestureHandlerCustomNativeProps,
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
function validatePanGestureHandlerProps(props: PanGestureHandlerProps) {
|
|
207
|
-
if (
|
|
208
|
-
Array.isArray(props.activeOffsetX) &&
|
|
209
|
-
(props.activeOffsetX[0] > 0 || props.activeOffsetX[1] < 0)
|
|
210
|
-
) {
|
|
211
|
-
throw new Error(
|
|
212
|
-
`First element of activeOffsetX should be negative, a the second one should be positive`
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (
|
|
217
|
-
Array.isArray(props.activeOffsetY) &&
|
|
218
|
-
(props.activeOffsetY[0] > 0 || props.activeOffsetY[1] < 0)
|
|
219
|
-
) {
|
|
220
|
-
throw new Error(
|
|
221
|
-
`First element of activeOffsetY should be negative, a the second one should be positive`
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (
|
|
226
|
-
Array.isArray(props.failOffsetX) &&
|
|
227
|
-
(props.failOffsetX[0] > 0 || props.failOffsetX[1] < 0)
|
|
228
|
-
) {
|
|
229
|
-
throw new Error(
|
|
230
|
-
`First element of failOffsetX should be negative, a the second one should be positive`
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (
|
|
235
|
-
Array.isArray(props.failOffsetY) &&
|
|
236
|
-
(props.failOffsetY[0] > 0 || props.failOffsetY[1] < 0)
|
|
237
|
-
) {
|
|
238
|
-
throw new Error(
|
|
239
|
-
`First element of failOffsetY should be negative, a the second one should be positive`
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (props.minDist && (props.failOffsetX || props.failOffsetY)) {
|
|
244
|
-
throw new Error(
|
|
245
|
-
`It is not supported to use minDist with failOffsetX or failOffsetY, use activeOffsetX and activeOffsetY instead`
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (props.minDist && (props.activeOffsetX || props.activeOffsetY)) {
|
|
250
|
-
throw new Error(
|
|
251
|
-
`It is not supported to use minDist with activeOffsetX or activeOffsetY`
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function transformPanGestureHandlerProps(props: PanGestureHandlerProps) {
|
|
257
|
-
type InternalPanGHKeys =
|
|
258
|
-
| 'activeOffsetXStart'
|
|
259
|
-
| 'activeOffsetXEnd'
|
|
260
|
-
| 'failOffsetXStart'
|
|
261
|
-
| 'failOffsetXEnd'
|
|
262
|
-
| 'activeOffsetYStart'
|
|
263
|
-
| 'activeOffsetYEnd'
|
|
264
|
-
| 'failOffsetYStart'
|
|
265
|
-
| 'failOffsetYEnd';
|
|
266
|
-
type PanGestureHandlerInternalProps = PanGestureHandlerProps &
|
|
267
|
-
Partial<Record<InternalPanGHKeys, number>>;
|
|
268
|
-
|
|
269
|
-
const res: PanGestureHandlerInternalProps = { ...props };
|
|
270
|
-
|
|
271
|
-
if (props.activeOffsetX !== undefined) {
|
|
272
|
-
delete res.activeOffsetX;
|
|
273
|
-
if (Array.isArray(props.activeOffsetX)) {
|
|
274
|
-
res.activeOffsetXStart = props.activeOffsetX[0];
|
|
275
|
-
res.activeOffsetXEnd = props.activeOffsetX[1];
|
|
276
|
-
} else if (props.activeOffsetX < 0) {
|
|
277
|
-
res.activeOffsetXStart = props.activeOffsetX;
|
|
278
|
-
} else {
|
|
279
|
-
res.activeOffsetXEnd = props.activeOffsetX;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (props.activeOffsetY !== undefined) {
|
|
284
|
-
delete res.activeOffsetY;
|
|
285
|
-
if (Array.isArray(props.activeOffsetY)) {
|
|
286
|
-
res.activeOffsetYStart = props.activeOffsetY[0];
|
|
287
|
-
res.activeOffsetYEnd = props.activeOffsetY[1];
|
|
288
|
-
} else if (props.activeOffsetY < 0) {
|
|
289
|
-
res.activeOffsetYStart = props.activeOffsetY;
|
|
290
|
-
} else {
|
|
291
|
-
res.activeOffsetYEnd = props.activeOffsetY;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if (props.failOffsetX !== undefined) {
|
|
296
|
-
delete res.failOffsetX;
|
|
297
|
-
if (Array.isArray(props.failOffsetX)) {
|
|
298
|
-
res.failOffsetXStart = props.failOffsetX[0];
|
|
299
|
-
res.failOffsetXEnd = props.failOffsetX[1];
|
|
300
|
-
} else if (props.failOffsetX < 0) {
|
|
301
|
-
res.failOffsetXStart = props.failOffsetX;
|
|
302
|
-
} else {
|
|
303
|
-
res.failOffsetXEnd = props.failOffsetX;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
if (props.failOffsetY !== undefined) {
|
|
308
|
-
delete res.failOffsetY;
|
|
309
|
-
if (Array.isArray(props.failOffsetY)) {
|
|
310
|
-
res.failOffsetYStart = props.failOffsetY[0];
|
|
311
|
-
res.failOffsetYEnd = props.failOffsetY[1];
|
|
312
|
-
} else if (props.failOffsetY < 0) {
|
|
313
|
-
res.failOffsetYStart = props.failOffsetY;
|
|
314
|
-
} else {
|
|
315
|
-
res.failOffsetYEnd = props.failOffsetY;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
return res;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export function managePanProps(props: PanGestureHandlerProps) {
|
|
323
|
-
if (__DEV__) {
|
|
324
|
-
validatePanGestureHandlerProps(props);
|
|
325
|
-
}
|
|
326
|
-
return transformPanGestureHandlerProps(props);
|
|
327
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// RNGH: forking to use the forked createHandler
|
|
2
|
-
import createHandler from './createHandler';
|
|
3
|
-
import {
|
|
4
|
-
BaseGestureHandlerProps,
|
|
5
|
-
baseGestureHandlerProps,
|
|
6
|
-
} from 'react-native-gesture-handler/src/handlers/gestureHandlerCommon';
|
|
7
|
-
|
|
8
|
-
export const tapGestureHandlerProps = [
|
|
9
|
-
'maxDurationMs',
|
|
10
|
-
'maxDelayMs',
|
|
11
|
-
'numberOfTaps',
|
|
12
|
-
'maxDeltaX',
|
|
13
|
-
'maxDeltaY',
|
|
14
|
-
'maxDist',
|
|
15
|
-
'minPointers',
|
|
16
|
-
] as const;
|
|
17
|
-
|
|
18
|
-
export type TapGestureHandlerEventPayload = {
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
absoluteX: number;
|
|
22
|
-
absoluteY: number;
|
|
23
|
-
};
|
|
24
|
-
export interface TapGestureConfig {
|
|
25
|
-
/**
|
|
26
|
-
* Minimum number of pointers (fingers) required to be placed before the
|
|
27
|
-
* handler activates. Should be a positive integer.
|
|
28
|
-
* The default value is 1.
|
|
29
|
-
*/
|
|
30
|
-
minPointers?: number;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Maximum time, expressed in milliseconds, that defines how fast a finger
|
|
34
|
-
* must be released after a touch. The default value is 500.
|
|
35
|
-
*/
|
|
36
|
-
maxDurationMs?: number;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Maximum time, expressed in milliseconds, that can pass before the next tap
|
|
40
|
-
* if many taps are required. The default value is 500.
|
|
41
|
-
*/
|
|
42
|
-
maxDelayMs?: number;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Number of tap gestures required to activate the handler. The default value
|
|
46
|
-
* is 1.
|
|
47
|
-
*/
|
|
48
|
-
numberOfTaps?: number;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Maximum distance, expressed in points, that defines how far the finger is
|
|
52
|
-
* allowed to travel along the X axis during a tap gesture. If the finger
|
|
53
|
-
* travels further than the defined distance along the X axis and the handler
|
|
54
|
-
* hasn't yet activated, it will fail to recognize the gesture.
|
|
55
|
-
*/
|
|
56
|
-
maxDeltaX?: number;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Maximum distance, expressed in points, that defines how far the finger is
|
|
60
|
-
* allowed to travel along the Y axis during a tap gesture. If the finger
|
|
61
|
-
* travels further than the defined distance along the Y axis and the handler
|
|
62
|
-
* hasn't yet activated, it will fail to recognize the gesture.
|
|
63
|
-
*/
|
|
64
|
-
maxDeltaY?: number;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Maximum distance, expressed in points, that defines how far the finger is
|
|
68
|
-
* allowed to travel during a tap gesture. If the finger travels further than
|
|
69
|
-
* the defined distance and the handler hasn't yet
|
|
70
|
-
* activated, it will fail to recognize the gesture.
|
|
71
|
-
*/
|
|
72
|
-
maxDist?: number;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface TapGestureHandlerProps
|
|
76
|
-
extends BaseGestureHandlerProps<TapGestureHandlerEventPayload>,
|
|
77
|
-
TapGestureConfig {}
|
|
78
|
-
|
|
79
|
-
export const tapHandlerName = 'TapGestureHandler';
|
|
80
|
-
|
|
81
|
-
export type TapGestureHandler = typeof TapGestureHandler;
|
|
82
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
|
83
|
-
export const TapGestureHandler = createHandler<
|
|
84
|
-
TapGestureHandlerProps,
|
|
85
|
-
TapGestureHandlerEventPayload
|
|
86
|
-
>({
|
|
87
|
-
name: tapHandlerName,
|
|
88
|
-
allowedProps: [
|
|
89
|
-
...baseGestureHandlerProps,
|
|
90
|
-
...tapGestureHandlerProps,
|
|
91
|
-
] as const,
|
|
92
|
-
config: {
|
|
93
|
-
shouldCancelWhenOutside: true,
|
|
94
|
-
},
|
|
95
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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
|
-
}
|