@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.
- package/harmony/gesture_handler/LICENSE +21 -0
- package/harmony/gesture_handler/OAT.xml +44 -0
- package/harmony/gesture_handler/README.OpenSource +11 -0
- package/harmony/gesture_handler/README.md +1 -0
- package/harmony/gesture_handler/build-profile.json5 +7 -7
- package/harmony/gesture_handler/hvigorfile.ts +2 -2
- package/harmony/gesture_handler/index.ets +2 -2
- package/harmony/gesture_handler/oh-package.json5 +13 -11
- package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +8 -8
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +33 -33
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +14 -14
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +60 -60
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.cpp +17 -17
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +11 -11
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +60 -60
- package/harmony/gesture_handler/src/main/ets/CircularBuffer.ts +42 -42
- package/harmony/gesture_handler/src/main/ets/Event.ts +67 -67
- package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +37 -37
- package/harmony/gesture_handler/src/main/ets/GestureHandler.ts +663 -663
- package/harmony/gesture_handler/src/main/ets/GestureHandlerArkUIAdapter.ets +201 -201
- package/harmony/gesture_handler/src/main/ets/GestureHandlerFactory.ts +44 -44
- package/harmony/gesture_handler/src/main/ets/GestureHandlerOrchestrator.ts +280 -280
- package/harmony/gesture_handler/src/main/ets/GestureHandlerPackage.ts +22 -22
- package/harmony/gesture_handler/src/main/ets/GestureHandlerRegistry.ts +27 -27
- package/harmony/gesture_handler/src/main/ets/InteractionManager.ts +108 -108
- package/harmony/gesture_handler/src/main/ets/LeastSquareSolver.ts +182 -182
- package/harmony/gesture_handler/src/main/ets/NativeViewGestureHandler.ts +114 -114
- package/harmony/gesture_handler/src/main/ets/OutgoingEvent.ts +33 -33
- package/harmony/gesture_handler/src/main/ets/PanGestureHandler.ts +327 -327
- package/harmony/gesture_handler/src/main/ets/PointerTracker.ts +239 -239
- package/harmony/gesture_handler/src/main/ets/RNGHError.ts +4 -4
- package/harmony/gesture_handler/src/main/ets/RNGHLogger.ts +28 -28
- package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandler.ets +57 -57
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerButton.ets +36 -36
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerModule.ts +125 -125
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerRootView.ets +56 -55
- package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +10 -10
- package/harmony/gesture_handler/src/main/ets/State.ts +46 -46
- package/harmony/gesture_handler/src/main/ets/TapGestureHandler.ts +205 -205
- package/harmony/gesture_handler/src/main/ets/Vector2D.ts +36 -36
- package/harmony/gesture_handler/src/main/ets/VelocityTracker.ts +98 -98
- package/harmony/gesture_handler/src/main/ets/View.ts +70 -70
- package/harmony/gesture_handler/src/main/ets/ViewRegistry.ts +42 -42
- package/harmony/gesture_handler/src/main/ets/pages/Index.ets +16 -16
- package/harmony/gesture_handler/src/main/ets/webviewability/WebviewAbility.ts +41 -41
- package/harmony/gesture_handler/src/main/module.json5 +6 -6
- package/harmony/gesture_handler/src/main/resources/base/element/color.json +7 -7
- package/harmony/gesture_handler/src/main/resources/base/element/string.json +15 -15
- package/harmony/gesture_handler/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/gesture_handler/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/gesture_handler/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/gesture_handler.har +0 -0
- package/lib/commonjs/components/touchables/GenericTouchable.js +9 -9
- package/lib/commonjs/components/touchables/TouchableOpacity.js +2 -2
- package/lib/commonjs/handlers/createNativeWrapper.js +6 -6
- package/lib/commonjs/handlers/gestures/GestureDetector.js +3 -3
- package/lib/module/components/touchables/GenericTouchable.js +9 -9
- package/lib/module/components/touchables/TouchableOpacity.js +2 -2
- package/lib/module/handlers/createNativeWrapper.js +6 -6
- package/lib/module/handlers/gestures/GestureDetector.js +3 -3
- package/package.json +70 -70
- package/src/RNGestureHandlerModule.ts +6 -6
- package/src/components/GestureButtons.tsx +334 -334
- package/src/components/GestureHandlerButton.tsx +5 -5
- package/src/components/GestureHandlerRootView.tsx +34 -34
- package/src/components/RNGestureHandlerButton.tsx +23 -23
- package/src/components/touchables/GenericTouchable.tsx +301 -301
- package/src/components/touchables/TouchableOpacity.tsx +76 -76
- package/src/components/touchables/TouchableWithoutFeedback.tsx +14 -14
- package/src/components/touchables/index.ts +7 -7
- package/src/handlers/NativeViewGestureHandler.ts +55 -55
- package/src/handlers/PanGestureHandler.ts +327 -327
- package/src/handlers/TapGestureHandler.ts +95 -95
- package/src/handlers/createHandler.tsx +535 -535
- package/src/handlers/createNativeWrapper.tsx +81 -81
- package/src/handlers/gestureHandlerCommon.ts +15 -15
- package/src/handlers/gestures/GestureDetector.tsx +823 -823
- package/src/index.ts +172 -172
- package/src/init.ts +18 -18
|
@@ -1,76 +1,76 @@
|
|
|
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
|
+
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 +1,14 @@
|
|
|
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
|
+
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 +1,7 @@
|
|
|
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
|
+
// 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 +1,55 @@
|
|
|
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
|
+
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
|
+
});
|