@react-native-oh-tpl/react-native-gesture-handler 2.12.6-1 → 2.12.9
Sign up to get free protection for your applications and to get access to all the features.
- package/harmony/gesture_handler/BuildProfile.ets +5 -0
- package/harmony/gesture_handler/build-profile.json5 +18 -7
- package/harmony/gesture_handler/hvigorfile.ts +2 -2
- package/harmony/gesture_handler/index.ets +3 -3
- package/harmony/gesture_handler/oh-package-lock.json5 +17 -0
- package/harmony/gesture_handler/oh-package.json5 +12 -11
- package/harmony/gesture_handler/src/main/cpp/CMakeLists.txt +8 -8
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.cpp +103 -34
- package/harmony/gesture_handler/src/main/cpp/GestureHandlerPackage.h +21 -15
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerButtonComponentDescriptor.h +36 -60
- 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 +22 -17
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerModule.h +15 -12
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerPackage.h +72 -0
- package/harmony/gesture_handler/src/main/cpp/RNGestureHandlerRootViewComponentDescriptor.h +36 -60
- 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/CircularBuffer.ts +42 -42
- package/harmony/gesture_handler/src/main/ets/Event.ts +67 -67
- package/harmony/gesture_handler/src/main/ets/EventDispatcher.ts +52 -37
- package/harmony/gesture_handler/src/main/ets/GestureHandler.ts +663 -663
- package/harmony/gesture_handler/src/main/ets/{GestureHandlerArkUIAdapter.ets → GestureHandlerArkUIAdapter.ts} +202 -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 +47 -28
- package/harmony/gesture_handler/src/main/ets/{RNGHRootTouchHandler.ets → RNGHRootTouchHandlerArkTS.ts} +59 -57
- package/harmony/gesture_handler/src/main/ets/RNGHRootTouchHandlerCAPI.ts +87 -0
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerButton.ets +37 -36
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerModule.ts +183 -125
- package/harmony/gesture_handler/src/main/ets/RNGestureHandlerRootView.ets +52 -55
- package/harmony/gesture_handler/src/main/ets/RNOHScrollLocker.ts +23 -11
- 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/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/pages/Index.ets +16 -16
- package/harmony/gesture_handler/src/main/ets/types.ts +25 -0
- package/harmony/gesture_handler/src/main/ets/webviewability/WebviewAbility.ts +41 -41
- package/harmony/gesture_handler/src/main/module.json5 +7 -7
- 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/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 +66 -70
- package/src/RNGestureHandlerModule.ts +5 -6
- package/src/components/GestureHandlerRootView.tsx +23 -34
- package/src/handlers/createHandler.tsx +534 -535
- package/src/index.ts +172 -172
- 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/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
package/lib/commonjs/init.js
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.initialize = initialize;
|
7
|
-
exports.maybeInitializeFabric = maybeInitializeFabric;
|
8
|
-
var _eventReceiver = require("react-native-gesture-handler/src/handlers/gestures/eventReceiver");
|
9
|
-
var _RNGestureHandlerModule = require("./RNGestureHandlerModule");
|
10
|
-
var _utils = require("react-native-gesture-handler/src/utils");
|
11
|
-
let fabricInitialized = false;
|
12
|
-
function initialize() {
|
13
|
-
(0, _eventReceiver.startListening)();
|
14
|
-
}
|
15
|
-
|
16
|
-
// since isFabric() may give wrong results before the first render, we call this
|
17
|
-
// method during render of GestureHandlerRootView
|
18
|
-
function maybeInitializeFabric() {
|
19
|
-
if ((0, _utils.isFabric)() && !fabricInitialized) {
|
20
|
-
_RNGestureHandlerModule.RNGestureHandlerModule.install();
|
21
|
-
fabricInitialized = true;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
//# sourceMappingURL=init.js.map
|
package/lib/commonjs/init.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_eventReceiver","require","_RNGestureHandlerModule","_utils","fabricInitialized","initialize","startListening","maybeInitializeFabric","isFabric","RNGestureHandlerModule","install"],"sourceRoot":"..\\..\\src","sources":["init.ts"],"mappings":";;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAIG,iBAAiB,GAAG,KAAK;AAEtB,SAASC,UAAUA,CAAA,EAAG;EAC3B,IAAAC,6BAAc,EAAC,CAAC;AAClB;;AAEA;AACA;AACO,SAASC,qBAAqBA,CAAA,EAAG;EACtC,IAAI,IAAAC,eAAQ,EAAC,CAAC,IAAI,CAACJ,iBAAiB,EAAE;IACpCK,8CAAsB,CAACC,OAAO,CAAC,CAAC;IAChCN,iBAAiB,GAAG,IAAI;EAC1B;AACF"}
|
@@ -1,168 +0,0 @@
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
-
import * as React from 'react';
|
3
|
-
import { Animated, Platform, processColor, StyleSheet } from 'react-native';
|
4
|
-
import createNativeWrapper from '../handlers/createNativeWrapper';
|
5
|
-
import GestureHandlerButton from './GestureHandlerButton';
|
6
|
-
import { State } from 'react-native-gesture-handler/src/State';
|
7
|
-
export const RawButton = createNativeWrapper(GestureHandlerButton, {
|
8
|
-
shouldCancelWhenOutside: false,
|
9
|
-
shouldActivateOnStart: false
|
10
|
-
});
|
11
|
-
export class BaseButton extends React.Component {
|
12
|
-
static defaultProps = {
|
13
|
-
delayLongPress: 600
|
14
|
-
};
|
15
|
-
constructor(props) {
|
16
|
-
super(props);
|
17
|
-
this.lastActive = false;
|
18
|
-
this.longPressDetected = false;
|
19
|
-
}
|
20
|
-
handleEvent = ({
|
21
|
-
nativeEvent
|
22
|
-
}) => {
|
23
|
-
const {
|
24
|
-
state,
|
25
|
-
oldState,
|
26
|
-
pointerInside
|
27
|
-
} = nativeEvent;
|
28
|
-
const active = pointerInside && state === State.ACTIVE;
|
29
|
-
if (active !== this.lastActive && this.props.onActiveStateChange) {
|
30
|
-
this.props.onActiveStateChange(active);
|
31
|
-
}
|
32
|
-
if (!this.longPressDetected && oldState === State.ACTIVE && state !== State.CANCELLED && this.lastActive && this.props.onPress) {
|
33
|
-
this.props.onPress(active);
|
34
|
-
}
|
35
|
-
if (!this.lastActive &&
|
36
|
-
// NativeViewGestureHandler sends different events based on platform
|
37
|
-
state === (Platform.OS !== 'android' ? State.ACTIVE : State.BEGAN) && pointerInside) {
|
38
|
-
this.longPressDetected = false;
|
39
|
-
if (this.props.onLongPress) {
|
40
|
-
this.longPressTimeout = setTimeout(this.onLongPress, this.props.delayLongPress);
|
41
|
-
}
|
42
|
-
} else if (
|
43
|
-
// cancel longpress timeout if it's set and the finger moved out of the view
|
44
|
-
state === State.ACTIVE && !pointerInside && this.longPressTimeout !== undefined) {
|
45
|
-
clearTimeout(this.longPressTimeout);
|
46
|
-
this.longPressTimeout = undefined;
|
47
|
-
} else if (
|
48
|
-
// cancel longpress timeout if it's set and the gesture has finished
|
49
|
-
this.longPressTimeout !== undefined && (state === State.END || state === State.CANCELLED || state === State.FAILED)) {
|
50
|
-
clearTimeout(this.longPressTimeout);
|
51
|
-
this.longPressTimeout = undefined;
|
52
|
-
}
|
53
|
-
this.lastActive = active;
|
54
|
-
};
|
55
|
-
onLongPress = () => {
|
56
|
-
var _this$props$onLongPre, _this$props;
|
57
|
-
this.longPressDetected = true;
|
58
|
-
(_this$props$onLongPre = (_this$props = this.props).onLongPress) === null || _this$props$onLongPre === void 0 || _this$props$onLongPre.call(_this$props);
|
59
|
-
};
|
60
|
-
|
61
|
-
// Normally, the parent would execute it's handler first, then forward the
|
62
|
-
// event to listeners. However, here our handler is virtually only forwarding
|
63
|
-
// events to listeners, so we reverse the order to keep the proper order of
|
64
|
-
// the callbacks (from "raw" ones to "processed").
|
65
|
-
onHandlerStateChange = e => {
|
66
|
-
var _this$props$onHandler, _this$props2;
|
67
|
-
(_this$props$onHandler = (_this$props2 = this.props).onHandlerStateChange) === null || _this$props$onHandler === void 0 || _this$props$onHandler.call(_this$props2, e);
|
68
|
-
this.handleEvent(e);
|
69
|
-
};
|
70
|
-
onGestureEvent = e => {
|
71
|
-
var _this$props$onGesture, _this$props3;
|
72
|
-
(_this$props$onGesture = (_this$props3 = this.props).onGestureEvent) === null || _this$props$onGesture === void 0 || _this$props$onGesture.call(_this$props3, e);
|
73
|
-
this.handleEvent(e); // TODO: maybe it is not correct
|
74
|
-
};
|
75
|
-
render() {
|
76
|
-
const {
|
77
|
-
rippleColor,
|
78
|
-
...rest
|
79
|
-
} = this.props;
|
80
|
-
return /*#__PURE__*/React.createElement(RawButton, _extends({
|
81
|
-
rippleColor: processColor(rippleColor)
|
82
|
-
}, rest, {
|
83
|
-
onGestureEvent: this.onGestureEvent,
|
84
|
-
onHandlerStateChange: this.onHandlerStateChange
|
85
|
-
}));
|
86
|
-
}
|
87
|
-
}
|
88
|
-
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
89
|
-
const btnStyles = StyleSheet.create({
|
90
|
-
underlay: {
|
91
|
-
position: 'absolute',
|
92
|
-
left: 0,
|
93
|
-
right: 0,
|
94
|
-
bottom: 0,
|
95
|
-
top: 0
|
96
|
-
}
|
97
|
-
});
|
98
|
-
export class RectButton extends React.Component {
|
99
|
-
static defaultProps = {
|
100
|
-
activeOpacity: 0.105,
|
101
|
-
underlayColor: 'black'
|
102
|
-
};
|
103
|
-
constructor(props) {
|
104
|
-
super(props);
|
105
|
-
this.opacity = new Animated.Value(0);
|
106
|
-
}
|
107
|
-
onActiveStateChange = active => {
|
108
|
-
var _this$props$onActiveS, _this$props4;
|
109
|
-
if (Platform.OS !== 'android') {
|
110
|
-
this.opacity.setValue(active ? this.props.activeOpacity : 0);
|
111
|
-
}
|
112
|
-
(_this$props$onActiveS = (_this$props4 = this.props).onActiveStateChange) === null || _this$props$onActiveS === void 0 || _this$props$onActiveS.call(_this$props4, active);
|
113
|
-
};
|
114
|
-
render() {
|
115
|
-
const {
|
116
|
-
children,
|
117
|
-
style,
|
118
|
-
...rest
|
119
|
-
} = this.props;
|
120
|
-
const resolvedStyle = StyleSheet.flatten(style ?? {});
|
121
|
-
return /*#__PURE__*/React.createElement(BaseButton, _extends({}, rest, {
|
122
|
-
style: resolvedStyle,
|
123
|
-
onActiveStateChange: this.onActiveStateChange
|
124
|
-
}), /*#__PURE__*/React.createElement(Animated.View, {
|
125
|
-
style: [btnStyles.underlay, {
|
126
|
-
opacity: this.opacity,
|
127
|
-
backgroundColor: this.props.underlayColor,
|
128
|
-
borderRadius: resolvedStyle.borderRadius,
|
129
|
-
borderTopLeftRadius: resolvedStyle.borderTopLeftRadius,
|
130
|
-
borderTopRightRadius: resolvedStyle.borderTopRightRadius,
|
131
|
-
borderBottomLeftRadius: resolvedStyle.borderBottomLeftRadius,
|
132
|
-
borderBottomRightRadius: resolvedStyle.borderBottomRightRadius
|
133
|
-
}]
|
134
|
-
}), children);
|
135
|
-
}
|
136
|
-
}
|
137
|
-
export class BorderlessButton extends React.Component {
|
138
|
-
static defaultProps = {
|
139
|
-
activeOpacity: 0.3,
|
140
|
-
borderless: true
|
141
|
-
};
|
142
|
-
constructor(props) {
|
143
|
-
super(props);
|
144
|
-
this.opacity = new Animated.Value(1);
|
145
|
-
}
|
146
|
-
onActiveStateChange = active => {
|
147
|
-
var _this$props$onActiveS2, _this$props5;
|
148
|
-
if (Platform.OS !== 'android') {
|
149
|
-
this.opacity.setValue(active ? this.props.activeOpacity : 1);
|
150
|
-
}
|
151
|
-
(_this$props$onActiveS2 = (_this$props5 = this.props).onActiveStateChange) === null || _this$props$onActiveS2 === void 0 || _this$props$onActiveS2.call(_this$props5, active);
|
152
|
-
};
|
153
|
-
render() {
|
154
|
-
const {
|
155
|
-
children,
|
156
|
-
style,
|
157
|
-
...rest
|
158
|
-
} = this.props;
|
159
|
-
return /*#__PURE__*/React.createElement(AnimatedBaseButton, _extends({}, rest, {
|
160
|
-
onActiveStateChange: this.onActiveStateChange,
|
161
|
-
style: [style, Platform.OS === 'ios' && {
|
162
|
-
opacity: this.opacity
|
163
|
-
}]
|
164
|
-
}), children);
|
165
|
-
}
|
166
|
-
}
|
167
|
-
export { default as PureNativeButton } from './GestureHandlerButton';
|
168
|
-
//# sourceMappingURL=GestureButtons.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["React","Animated","Platform","processColor","StyleSheet","createNativeWrapper","GestureHandlerButton","State","RawButton","shouldCancelWhenOutside","shouldActivateOnStart","BaseButton","Component","defaultProps","delayLongPress","constructor","props","lastActive","longPressDetected","handleEvent","nativeEvent","state","oldState","pointerInside","active","ACTIVE","onActiveStateChange","CANCELLED","onPress","OS","BEGAN","onLongPress","longPressTimeout","setTimeout","undefined","clearTimeout","END","FAILED","_this$props$onLongPre","_this$props","call","onHandlerStateChange","e","_this$props$onHandler","_this$props2","onGestureEvent","_this$props$onGesture","_this$props3","render","rippleColor","rest","createElement","_extends","AnimatedBaseButton","createAnimatedComponent","btnStyles","create","underlay","position","left","right","bottom","top","RectButton","activeOpacity","underlayColor","opacity","Value","_this$props$onActiveS","_this$props4","setValue","children","style","resolvedStyle","flatten","View","backgroundColor","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","BorderlessButton","borderless","_this$props$onActiveS2","_this$props5","default","PureNativeButton"],"sourceRoot":"..\\..\\..\\src","sources":["components/GestureButtons.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,QAAQ,EACRC,YAAY,EACZC,UAAU,QAGL,cAAc;AAErB,OAAOC,mBAAmB,MAAM,iCAAiC;AACjE,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,SAASC,KAAK,QAAQ,wCAAwC;AA2G9D,OAAO,MAAMC,SAAS,GAAGH,mBAAmB,CAACC,oBAAoB,EAAE;EACjEG,uBAAuB,EAAE,KAAK;EAC9BC,qBAAqB,EAAE;AACzB,CAAC,CAAC;AAEF,OAAO,MAAMC,UAAU,SAASX,KAAK,CAACY,SAAS,CAAkB;EAC/D,OAAOC,YAAY,GAAG;IACpBC,cAAc,EAAE;EAClB,CAAC;EAMDC,WAAWA,CAACC,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,UAAU,GAAG,KAAK;IACvB,IAAI,CAACC,iBAAiB,GAAG,KAAK;EAChC;EAEQC,WAAW,GAAGA,CAAC;IACrBC;EACwD,CAAC,KAAK;IAC9D,MAAM;MAAEC,KAAK;MAAEC,QAAQ;MAAEC;IAAc,CAAC,GAAGH,WAAW;IACtD,MAAMI,MAAM,GAAGD,aAAa,IAAIF,KAAK,KAAKd,KAAK,CAACkB,MAAM;IAEtD,I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;EAC1C,CAAC;EAEDwB,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEuB,QAAQ;MAAEC,KAAK;MAAE,GAAGtB;IAAK,CAAC,GAAG,IAAI,CAAClC,KAAK;IAE/C,oBACEhB,KAAA,CAAAmD,aAAA,CAACE,kBAAkB,EAAAD,QAAA,KACbF,IAAI;MACRxB,mBAAmB,EAAE,IAAI,CAACA,mBAAoB;MAC9C8C,KAAK,EAAE,CAACA,KAAK,EAAEtE,QAAQ,CAAC2B,EAAE,KAAK,KAAK,IAAI;QAAEqC,OAAO,EAAE,IAAI,CAACA;MAAQ,CAAC;IAAE,IAElEK,QACiB,CAAC;EAEzB;AACF;AAEA,SAASe,OAAO,IAAIC,gBAAgB,QAAQ,wBAAwB"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["RNGestureHandlerButton"],"sourceRoot":"..\\..\\..\\src","sources":["components/GestureHandlerButton.tsx"],"mappings":"AAEA,SAASA,sBAAsB,QAAQ,0BAA0B;AAEjE,eAAeA,sBAAsB"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { registerViewConfig, ReactNativeViewAttributes } from 'react-native-harmony';
|
2
|
-
export const RNGestureHandlerButton = registerViewConfig('RNGestureHandlerButton', () => ({
|
3
|
-
uiViewClassName: 'RNGestureHandlerButton',
|
4
|
-
bubblingEventTypes: {},
|
5
|
-
directEventTypes: {},
|
6
|
-
validAttributes: {
|
7
|
-
...ReactNativeViewAttributes.UIView,
|
8
|
-
exclusive: true,
|
9
|
-
foreground: true,
|
10
|
-
borderless: true,
|
11
|
-
enabled: true,
|
12
|
-
rippleColor: true,
|
13
|
-
rippleRadius: true,
|
14
|
-
touchSoundDisabled: true
|
15
|
-
}
|
16
|
-
}));
|
17
|
-
//# sourceMappingURL=RNGestureHandlerButton.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["registerViewConfig","ReactNativeViewAttributes","RNGestureHandlerButton","uiViewClassName","bubblingEventTypes","directEventTypes","validAttributes","UIView","exclusive","foreground","borderless","enabled","rippleColor","rippleRadius","touchSoundDisabled"],"sourceRoot":"..\\..\\..\\src","sources":["components/RNGestureHandlerButton.tsx"],"mappings":"AAAA,SACEA,kBAAkB,EAClBC,yBAAyB,QACpB,sBAAsB;AAE7B,OAAO,MAAMC,sBAAsB,GAAGF,kBAAkB,CACtD,wBAAwB,EACxB,OAAO;EACLG,eAAe,EAAE,wBAAwB;EACzCC,kBAAkB,EAAE,CAAC,CAAC;EACtBC,gBAAgB,EAAE,CAAC,CAAC;EACpBC,eAAe,EAAE;IACf,GAAGL,yBAAyB,CAACM,MAAM;IACnCC,SAAS,EAAE,IAAI;IACfC,UAAU,EAAE,IAAI;IAChBC,UAAU,EAAE,IAAI;IAChBC,OAAO,EAAE,IAAI;IACbC,WAAW,EAAE,IAAI;IACjBC,YAAY,EAAE,IAAI;IAClBC,kBAAkB,EAAE;EACtB;AACF,CAAC,CACH,CAAC"}
|
@@ -1,238 +0,0 @@
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
-
import * as React from 'react';
|
3
|
-
import { Component } from 'react';
|
4
|
-
import { Animated, Platform } from 'react-native';
|
5
|
-
import { State } from 'react-native-gesture-handler/src/State';
|
6
|
-
import { BaseButton } from '../GestureButtons';
|
7
|
-
/**
|
8
|
-
* Each touchable is a states' machine which preforms transitions.
|
9
|
-
* On very beginning (and on the very end or recognition) touchable is
|
10
|
-
* UNDETERMINED. Then it moves to BEGAN. If touchable recognizes that finger
|
11
|
-
* travel outside it transits to special MOVED_OUTSIDE state. Gesture recognition
|
12
|
-
* finishes in UNDETERMINED state.
|
13
|
-
*/
|
14
|
-
export const TOUCHABLE_STATE = {
|
15
|
-
UNDETERMINED: 0,
|
16
|
-
BEGAN: 1,
|
17
|
-
MOVED_OUTSIDE: 2
|
18
|
-
};
|
19
|
-
|
20
|
-
// TODO: maybe can be better
|
21
|
-
// TODO: all clearTimeout have ! added, maybe they shouldn't ?
|
22
|
-
|
23
|
-
/**
|
24
|
-
* GenericTouchable is not intented to be used as it is.
|
25
|
-
* Should be treated as a source for the rest of touchables
|
26
|
-
*/
|
27
|
-
|
28
|
-
export default class GenericTouchable extends Component {
|
29
|
-
static defaultProps = {
|
30
|
-
delayLongPress: 600,
|
31
|
-
extraButtonProps: {
|
32
|
-
rippleColor: 'transparent',
|
33
|
-
exclusive: true
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
// timeout handlers
|
38
|
-
|
39
|
-
// This flag is required since recognition of longPress implies not-invoking onPress
|
40
|
-
longPressDetected = false;
|
41
|
-
pointerInside = true;
|
42
|
-
|
43
|
-
// State of touchable
|
44
|
-
STATE = TOUCHABLE_STATE.UNDETERMINED;
|
45
|
-
|
46
|
-
// handlePressIn in called on first touch on traveling inside component.
|
47
|
-
// Handles state transition with delay.
|
48
|
-
handlePressIn() {
|
49
|
-
if (this.props.delayPressIn) {
|
50
|
-
this.pressInTimeout = setTimeout(() => {
|
51
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
52
|
-
this.pressInTimeout = null;
|
53
|
-
}, this.props.delayPressIn);
|
54
|
-
} else {
|
55
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
56
|
-
}
|
57
|
-
if (this.props.onLongPress) {
|
58
|
-
const time = (this.props.delayPressIn || 0) + (this.props.delayLongPress || 0);
|
59
|
-
this.longPressTimeout = setTimeout(this.onLongPressDetected, time);
|
60
|
-
}
|
61
|
-
}
|
62
|
-
// handleMoveOutside in called on traveling outside component.
|
63
|
-
// Handles state transition with delay.
|
64
|
-
handleMoveOutside() {
|
65
|
-
if (this.props.delayPressOut) {
|
66
|
-
this.pressOutTimeout = this.pressOutTimeout || setTimeout(() => {
|
67
|
-
this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
|
68
|
-
this.pressOutTimeout = null;
|
69
|
-
}, this.props.delayPressOut);
|
70
|
-
} else {
|
71
|
-
this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
// handleGoToUndetermined transits to UNDETERMINED state with proper delay
|
76
|
-
handleGoToUndetermined() {
|
77
|
-
clearTimeout(this.pressOutTimeout); // TODO: maybe it can be undefined
|
78
|
-
if (this.props.delayPressOut) {
|
79
|
-
this.pressOutTimeout = setTimeout(() => {
|
80
|
-
if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
|
81
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
82
|
-
}
|
83
|
-
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
84
|
-
this.pressOutTimeout = null;
|
85
|
-
}, this.props.delayPressOut);
|
86
|
-
} else {
|
87
|
-
if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
|
88
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
89
|
-
}
|
90
|
-
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
91
|
-
}
|
92
|
-
}
|
93
|
-
componentDidMount() {
|
94
|
-
this.reset();
|
95
|
-
}
|
96
|
-
// reset timeout to prevent memory leaks.
|
97
|
-
reset() {
|
98
|
-
this.longPressDetected = false;
|
99
|
-
this.pointerInside = true;
|
100
|
-
clearTimeout(this.pressInTimeout);
|
101
|
-
clearTimeout(this.pressOutTimeout);
|
102
|
-
clearTimeout(this.longPressTimeout);
|
103
|
-
this.pressOutTimeout = null;
|
104
|
-
this.longPressTimeout = null;
|
105
|
-
this.pressInTimeout = null;
|
106
|
-
}
|
107
|
-
|
108
|
-
// All states' transitions are defined here.
|
109
|
-
moveToState(newState) {
|
110
|
-
var _this$props$onStateCh, _this$props4;
|
111
|
-
if (newState === this.STATE) {
|
112
|
-
// Ignore dummy transitions
|
113
|
-
return;
|
114
|
-
}
|
115
|
-
if (newState === TOUCHABLE_STATE.BEGAN) {
|
116
|
-
var _this$props$onPressIn, _this$props;
|
117
|
-
// First touch and moving inside
|
118
|
-
(_this$props$onPressIn = (_this$props = this.props).onPressIn) === null || _this$props$onPressIn === void 0 || _this$props$onPressIn.call(_this$props);
|
119
|
-
} else if (newState === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
120
|
-
var _this$props$onPressOu, _this$props2;
|
121
|
-
// Moving outside
|
122
|
-
(_this$props$onPressOu = (_this$props2 = this.props).onPressOut) === null || _this$props$onPressOu === void 0 || _this$props$onPressOu.call(_this$props2);
|
123
|
-
} else if (newState === TOUCHABLE_STATE.UNDETERMINED) {
|
124
|
-
// Need to reset each time on transition to UNDETERMINED
|
125
|
-
this.reset();
|
126
|
-
if (this.STATE === TOUCHABLE_STATE.BEGAN) {
|
127
|
-
var _this$props$onPressOu2, _this$props3;
|
128
|
-
// ... and if it happens inside button.
|
129
|
-
(_this$props$onPressOu2 = (_this$props3 = this.props).onPressOut) === null || _this$props$onPressOu2 === void 0 || _this$props$onPressOu2.call(_this$props3);
|
130
|
-
}
|
131
|
-
}
|
132
|
-
// Finally call lister (used by subclasses)
|
133
|
-
(_this$props$onStateCh = (_this$props4 = this.props).onStateChange) === null || _this$props$onStateCh === void 0 || _this$props$onStateCh.call(_this$props4, this.STATE, newState);
|
134
|
-
// ... and make transition.
|
135
|
-
this.STATE = newState;
|
136
|
-
}
|
137
|
-
onGestureEvent = ({
|
138
|
-
nativeEvent: {
|
139
|
-
pointerInside
|
140
|
-
}
|
141
|
-
}) => {
|
142
|
-
if (this.pointerInside !== pointerInside) {
|
143
|
-
if (pointerInside) {
|
144
|
-
this.onMoveIn();
|
145
|
-
} else {
|
146
|
-
this.onMoveOut();
|
147
|
-
}
|
148
|
-
}
|
149
|
-
this.pointerInside = pointerInside;
|
150
|
-
};
|
151
|
-
onHandlerStateChange = ({
|
152
|
-
nativeEvent
|
153
|
-
}) => {
|
154
|
-
const {
|
155
|
-
state
|
156
|
-
} = nativeEvent;
|
157
|
-
if (state === State.CANCELLED || state === State.FAILED) {
|
158
|
-
// Need to handle case with external cancellation (e.g. by ScrollView)
|
159
|
-
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
160
|
-
} else if (
|
161
|
-
// This platform check is an implication of slightly different behavior of handlers on different platform.
|
162
|
-
// And Android "Active" state is achieving on first move of a finger, not on press in.
|
163
|
-
// On iOS event on "Began" is not delivered.
|
164
|
-
state === (Platform.OS !== 'android' ? State.ACTIVE : State.BEGAN) && this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
|
165
|
-
// Moving inside requires
|
166
|
-
this.handlePressIn();
|
167
|
-
} else if (state === State.END) {
|
168
|
-
const shouldCallOnPress = !this.longPressDetected && this.STATE !== TOUCHABLE_STATE.MOVED_OUTSIDE && this.pressOutTimeout === null;
|
169
|
-
this.handleGoToUndetermined();
|
170
|
-
if (shouldCallOnPress) {
|
171
|
-
var _this$props$onPress, _this$props5;
|
172
|
-
// Calls only inside component whether no long press was called previously
|
173
|
-
(_this$props$onPress = (_this$props5 = this.props).onPress) === null || _this$props$onPress === void 0 || _this$props$onPress.call(_this$props5);
|
174
|
-
}
|
175
|
-
}
|
176
|
-
};
|
177
|
-
onLongPressDetected = () => {
|
178
|
-
var _this$props$onLongPre, _this$props6;
|
179
|
-
this.longPressDetected = true;
|
180
|
-
// checked for in the caller of `onLongPressDetected`, but better to check twice
|
181
|
-
(_this$props$onLongPre = (_this$props6 = this.props).onLongPress) === null || _this$props$onLongPre === void 0 || _this$props$onLongPre.call(_this$props6);
|
182
|
-
};
|
183
|
-
componentWillUnmount() {
|
184
|
-
// to prevent memory leaks
|
185
|
-
this.reset();
|
186
|
-
}
|
187
|
-
onMoveIn() {
|
188
|
-
if (this.STATE === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
189
|
-
// This call is not throttled with delays (like in RN's implementation).
|
190
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
191
|
-
}
|
192
|
-
}
|
193
|
-
onMoveOut() {
|
194
|
-
// long press should no longer be detected
|
195
|
-
clearTimeout(this.longPressTimeout);
|
196
|
-
this.longPressTimeout = null;
|
197
|
-
if (this.STATE === TOUCHABLE_STATE.BEGAN) {
|
198
|
-
this.handleMoveOutside();
|
199
|
-
}
|
200
|
-
}
|
201
|
-
render() {
|
202
|
-
const hitSlop = (typeof this.props.hitSlop === 'number' ? {
|
203
|
-
top: this.props.hitSlop,
|
204
|
-
left: this.props.hitSlop,
|
205
|
-
bottom: this.props.hitSlop,
|
206
|
-
right: this.props.hitSlop
|
207
|
-
} : this.props.hitSlop) ?? undefined;
|
208
|
-
const coreProps = {
|
209
|
-
accessible: this.props.accessible !== false,
|
210
|
-
accessibilityLabel: this.props.accessibilityLabel,
|
211
|
-
accessibilityHint: this.props.accessibilityHint,
|
212
|
-
accessibilityRole: this.props.accessibilityRole,
|
213
|
-
// TODO: check if changed to no 's' correctly, also removed 2 props that are no longer available: `accessibilityComponentType` and `accessibilityTraits`,
|
214
|
-
// would be good to check if it is ok for sure, see: https://github.com/facebook/react-native/issues/24016
|
215
|
-
accessibilityState: this.props.accessibilityState,
|
216
|
-
accessibilityActions: this.props.accessibilityActions,
|
217
|
-
onAccessibilityAction: this.props.onAccessibilityAction,
|
218
|
-
nativeID: this.props.nativeID,
|
219
|
-
onLayout: this.props.onLayout
|
220
|
-
};
|
221
|
-
return /*#__PURE__*/React.createElement(BaseButton, _extends({
|
222
|
-
style: this.props.containerStyle,
|
223
|
-
onHandlerStateChange:
|
224
|
-
// TODO: not sure if it can be undefined instead of null
|
225
|
-
this.props.disabled ? undefined : this.onHandlerStateChange,
|
226
|
-
onGestureEvent: this.onGestureEvent,
|
227
|
-
hitSlop: hitSlop,
|
228
|
-
shouldActivateOnStart: this.props.shouldActivateOnStart,
|
229
|
-
disallowInterruption: this.props.disallowInterruption,
|
230
|
-
testID: this.props.testID,
|
231
|
-
touchSoundDisabled: this.props.touchSoundDisabled ?? false,
|
232
|
-
enabled: !this.props.disabled
|
233
|
-
}, this.props.extraButtonProps), /*#__PURE__*/React.createElement(Animated.View, _extends({}, coreProps, {
|
234
|
-
style: this.props.style
|
235
|
-
}), this.props.children));
|
236
|
-
}
|
237
|
-
}
|
238
|
-
//# sourceMappingURL=GenericTouchable.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["React","Component","Animated","Platform","State","BaseButton","TOUCHABLE_STATE","UNDETERMINED","BEGAN","MOVED_OUTSIDE","GenericTouchable","defaultProps","delayLongPress","extraButtonProps","rippleColor","exclusive","longPressDetected","pointerInside","STATE","handlePressIn","props","delayPressIn","pressInTimeout","setTimeout","moveToState","onLongPress","time","longPressTimeout","onLongPressDetected","handleMoveOutside","delayPressOut","pressOutTimeout","handleGoToUndetermined","clearTimeout","componentDidMount","reset","newState","_this$props$onStateCh","_this$props4","_this$props$onPressIn","_this$props","onPressIn","call","_this$props$onPressOu","_this$props2","onPressOut","_this$props$onPressOu2","_this$props3","onStateChange","onGestureEvent","nativeEvent","onMoveIn","onMoveOut","onHandlerStateChange","state","CANCELLED","FAILED","OS","ACTIVE","END","shouldCallOnPress","_this$props$onPress","_this$props5","onPress","_this$props$onLongPre","_this$props6","componentWillUnmount","render","hitSlop","top","left","bottom","right","undefined","coreProps","accessible","accessibilityLabel","accessibilityHint","accessibilityRole","accessibilityState","accessibilityActions","onAccessibilityAction","nativeID","onLayout","createElement","_extends","style","containerStyle","disabled","shouldActivateOnStart","disallowInterruption","testID","touchSoundDisabled","enabled","View","children"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/touchables/GenericTouchable.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,QAAQ,OAAO;AACjC,SACEC,QAAQ,EACRC,QAAQ,QAKH,cAAc;AAErB,SAASC,KAAK,QAAQ,wCAAwC;AAC9D,SAASC,UAAU,QAAQ,mBAAmB;AAQ9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,M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AT,QAAA,KAAKX,SAAS;MAAEY,KAAK,EAAE,IAAI,CAAClE,KAAK,CAACkE;IAAM,IACnD,IAAI,CAAClE,KAAK,CAAC2E,QACC,CACL,CAAC;EAEjB;AACF"}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
-
import { Animated, Easing, StyleSheet, View } from 'react-native';
|
3
|
-
import GenericTouchable, { TOUCHABLE_STATE } from './GenericTouchable';
|
4
|
-
import * as React from 'react';
|
5
|
-
import { Component } from 'react';
|
6
|
-
/**
|
7
|
-
* TouchableOpacity bases on timing animation which has been used in RN's core
|
8
|
-
*/
|
9
|
-
export default class TouchableOpacity extends Component {
|
10
|
-
static defaultProps = {
|
11
|
-
...GenericTouchable.defaultProps,
|
12
|
-
activeOpacity: 0.2
|
13
|
-
};
|
14
|
-
|
15
|
-
// opacity is 1 one by default but could be overwritten
|
16
|
-
getChildStyleOpacityWithDefault = () => {
|
17
|
-
const childStyle = StyleSheet.flatten(this.props.style) || {};
|
18
|
-
return childStyle.opacity == null ? 1 : childStyle.opacity.valueOf();
|
19
|
-
};
|
20
|
-
opacity = new Animated.Value(this.getChildStyleOpacityWithDefault());
|
21
|
-
setOpacityTo = (value, duration) => {
|
22
|
-
Animated.timing(this.opacity, {
|
23
|
-
toValue: value,
|
24
|
-
duration: duration,
|
25
|
-
easing: Easing.inOut(Easing.quad),
|
26
|
-
useNativeDriver: this.props.useNativeAnimations ?? true
|
27
|
-
}).start();
|
28
|
-
};
|
29
|
-
onStateChange = (_from, to) => {
|
30
|
-
if (to === TOUCHABLE_STATE.BEGAN) {
|
31
|
-
this.setOpacityTo(this.props.activeOpacity, 0);
|
32
|
-
} else if (to === TOUCHABLE_STATE.UNDETERMINED || to === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
33
|
-
this.setOpacityTo(this.getChildStyleOpacityWithDefault(), 150);
|
34
|
-
}
|
35
|
-
};
|
36
|
-
render() {
|
37
|
-
const {
|
38
|
-
style = {},
|
39
|
-
...rest
|
40
|
-
} = this.props;
|
41
|
-
return /*#__PURE__*/React.createElement(GenericTouchable, _extends({}, rest, {
|
42
|
-
style: [style, {
|
43
|
-
opacity: this.opacity // TODO: fix this
|
44
|
-
}],
|
45
|
-
onStateChange: this.onStateChange
|
46
|
-
}), this.props.children ? this.props.children : /*#__PURE__*/React.createElement(View, null));
|
47
|
-
}
|
48
|
-
}
|
49
|
-
//# sourceMappingURL=TouchableOpacity.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["Animated","Easing","StyleSheet","View","GenericTouchable","TOUCHABLE_STATE","React","Component","TouchableOpacity","defaultProps","activeOpacity","getChildStyleOpacityWithDefault","childStyle","flatten","props","style","opacity","valueOf","Value","setOpacityTo","value","duration","timing","toValue","easing","inOut","quad","useNativeDriver","useNativeAnimations","start","onStateChange","_from","to","BEGAN","UNDETERMINED","MOVED_OUTSIDE","render","rest","createElement","_extends","children"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/touchables/TouchableOpacity.tsx"],"mappings":";AAAA,SACEA,QAAQ,EACRC,MAAM,EACNC,UAAU,EACVC,IAAI,QAEC,cAAc;AACrB,OAAOC,gBAAgB,IACrBC,eAAe,QAEV,oBAAoB;AAC3B,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,QAAQ,OAAO;AAOjC;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASD,SAAS,CAAwB;EAC7E,OAAOE,YAAY,GAAG;IACpB,GAAGL,gBAAgB,CAACK,YAAY;IAChCC,aAAa,EAAE;EACjB,CAAC;;EAED;EACAC,+BAA+B,GAAGA,CAAA,KAAM;IACtC,MAAMC,UAAU,GAAGV,UAAU,CAACW,OAAO,CAAC,IAAI,CAACC,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ACL;QACEC,OAAO,EAAE,IAAI,CAACA,OAA4B,CAAE;MAC9C,CAAC,CACD;MACFc,aAAa,EAAE,IAAI,CAACA;IAAc,IAEjC,IAAI,CAAChB,KAAK,CAAC0B,QAAQ,GAAG,IAAI,CAAC1B,KAAK,CAAC0B,QAAQ,gBAAGlC,KAAA,CAAAgC,aAAA,CAACnC,IAAI,MAAE,CACpC,CAAC;EAEvB;AACF"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2
|
-
import * as React from 'react';
|
3
|
-
import GenericTouchable from './GenericTouchable';
|
4
|
-
const TouchableWithoutFeedback = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(GenericTouchable, _extends({
|
5
|
-
ref: ref
|
6
|
-
}, props)));
|
7
|
-
TouchableWithoutFeedback.defaultProps = GenericTouchable.defaultProps;
|
8
|
-
export default TouchableWithoutFeedback;
|
9
|
-
//# sourceMappingURL=TouchableWithoutFeedback.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["React","GenericTouchable","TouchableWithoutFeedback","forwardRef","props","ref","createElement","_extends","defaultProps"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/touchables/TouchableWithoutFeedback.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,gBAAgB,MAAiC,oBAAoB;AAI5E,MAAMC,wBAAwB,gBAAGF,KAAK,CAACG,UAAU,CAG/C,CAACC,KAAK,EAAEC,GAAG,kBAAKL,KAAA,CAAAM,aAAA,CAACL,gBAAgB,EAAAM,QAAA;EAACF,GAAG,EAAEA;AAAI,GAAKD,KAAK,CAAG,CAAC,CAAC;AAE5DF,wBAAwB,CAACM,YAAY,GAAGP,gBAAgB,CAACO,YAAY;AAErE,eAAeN,wBAAwB"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
// export type { TouchableHighlightProps } from './TouchableHighlight';
|
2
|
-
|
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';
|
8
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["default","TouchableWithoutFeedback","TouchableOpacity"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/touchables/index.ts"],"mappings":"AAAA;;AAEA;AACA;AACA,SAASA,OAAO,IAAIC,wBAAwB,QAAQ,4BAA4B;AAChF,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,oBAAoB;AAChE"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import createHandler from './createHandler';
|
2
|
-
import { baseGestureHandlerProps } from 'react-native-gesture-handler/src/handlers/gestureHandlerCommon';
|
3
|
-
export const nativeViewGestureHandlerProps = ['shouldActivateOnStart', 'disallowInterruption'];
|
4
|
-
export const nativeViewProps = [...baseGestureHandlerProps, ...nativeViewGestureHandlerProps];
|
5
|
-
export const nativeViewHandlerName = 'NativeViewGestureHandler';
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
7
|
-
export const NativeViewGestureHandler = createHandler({
|
8
|
-
name: nativeViewHandlerName,
|
9
|
-
allowedProps: nativeViewProps,
|
10
|
-
config: {}
|
11
|
-
});
|
12
|
-
//# sourceMappingURL=NativeViewGestureHandler.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["createHandler","baseGestureHandlerProps","nativeViewGestureHandlerProps","nativeViewProps","nativeViewHandlerName","NativeViewGestureHandler","name","allowedProps","config"],"sourceRoot":"..\\..\\..\\src","sources":["handlers/NativeViewGestureHandler.ts"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAC3C,SAEEC,uBAAuB,QAClB,gEAAgE;AAEvE,OAAO,MAAMC,6BAA6B,GAAG,CAC3C,uBAAuB,EACvB,sBAAsB,CACd;AA6BV,OAAO,MAAMC,eAAe,GAAG,CAC7B,GAAGF,uBAAuB,EAC1B,GAAGC,6BAA6B,CACxB;AAEV,OAAO,MAAME,qBAAqB,GAAG,0BAA0B;AAG/D;AACA,OAAO,MAAMC,wBAAwB,GAAGL,aAAa,CAGnD;EACAM,IAAI,EAAEF,qBAAqB;EAC3BG,YAAY,EAAEJ,eAAe;EAC7BK,MAAM,EAAE,CAAC;AACX,CAAC,CAAC"}
|