@react-native-oh-tpl/react-native-gesture-handler 2.12.6-2 → 2.12.9-1
Sign up to get free protection for your applications and to get access to all the features.
- package/harmony/gesture_handler/BuildProfile.ets +6 -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 +18 -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 +123 -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,247 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = exports.TOUCHABLE_STATE = void 0;
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
8
|
-
var React = _react;
|
9
|
-
var _reactNative = require("react-native");
|
10
|
-
var _State = require("react-native-gesture-handler/src/State");
|
11
|
-
var _GestureButtons = require("../GestureButtons");
|
12
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
14
|
-
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); }
|
15
|
-
/**
|
16
|
-
* Each touchable is a states' machine which preforms transitions.
|
17
|
-
* On very beginning (and on the very end or recognition) touchable is
|
18
|
-
* UNDETERMINED. Then it moves to BEGAN. If touchable recognizes that finger
|
19
|
-
* travel outside it transits to special MOVED_OUTSIDE state. Gesture recognition
|
20
|
-
* finishes in UNDETERMINED state.
|
21
|
-
*/
|
22
|
-
const TOUCHABLE_STATE = exports.TOUCHABLE_STATE = {
|
23
|
-
UNDETERMINED: 0,
|
24
|
-
BEGAN: 1,
|
25
|
-
MOVED_OUTSIDE: 2
|
26
|
-
};
|
27
|
-
|
28
|
-
// TODO: maybe can be better
|
29
|
-
// TODO: all clearTimeout have ! added, maybe they shouldn't ?
|
30
|
-
|
31
|
-
/**
|
32
|
-
* GenericTouchable is not intented to be used as it is.
|
33
|
-
* Should be treated as a source for the rest of touchables
|
34
|
-
*/
|
35
|
-
|
36
|
-
class GenericTouchable extends _react.Component {
|
37
|
-
static defaultProps = {
|
38
|
-
delayLongPress: 600,
|
39
|
-
extraButtonProps: {
|
40
|
-
rippleColor: 'transparent',
|
41
|
-
exclusive: true
|
42
|
-
}
|
43
|
-
};
|
44
|
-
|
45
|
-
// timeout handlers
|
46
|
-
|
47
|
-
// This flag is required since recognition of longPress implies not-invoking onPress
|
48
|
-
longPressDetected = false;
|
49
|
-
pointerInside = true;
|
50
|
-
|
51
|
-
// State of touchable
|
52
|
-
STATE = TOUCHABLE_STATE.UNDETERMINED;
|
53
|
-
|
54
|
-
// handlePressIn in called on first touch on traveling inside component.
|
55
|
-
// Handles state transition with delay.
|
56
|
-
handlePressIn() {
|
57
|
-
if (this.props.delayPressIn) {
|
58
|
-
this.pressInTimeout = setTimeout(() => {
|
59
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
60
|
-
this.pressInTimeout = null;
|
61
|
-
}, this.props.delayPressIn);
|
62
|
-
} else {
|
63
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
64
|
-
}
|
65
|
-
if (this.props.onLongPress) {
|
66
|
-
const time = (this.props.delayPressIn || 0) + (this.props.delayLongPress || 0);
|
67
|
-
this.longPressTimeout = setTimeout(this.onLongPressDetected, time);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
// handleMoveOutside in called on traveling outside component.
|
71
|
-
// Handles state transition with delay.
|
72
|
-
handleMoveOutside() {
|
73
|
-
if (this.props.delayPressOut) {
|
74
|
-
this.pressOutTimeout = this.pressOutTimeout || setTimeout(() => {
|
75
|
-
this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
|
76
|
-
this.pressOutTimeout = null;
|
77
|
-
}, this.props.delayPressOut);
|
78
|
-
} else {
|
79
|
-
this.moveToState(TOUCHABLE_STATE.MOVED_OUTSIDE);
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
// handleGoToUndetermined transits to UNDETERMINED state with proper delay
|
84
|
-
handleGoToUndetermined() {
|
85
|
-
clearTimeout(this.pressOutTimeout); // TODO: maybe it can be undefined
|
86
|
-
if (this.props.delayPressOut) {
|
87
|
-
this.pressOutTimeout = setTimeout(() => {
|
88
|
-
if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
|
89
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
90
|
-
}
|
91
|
-
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
92
|
-
this.pressOutTimeout = null;
|
93
|
-
}, this.props.delayPressOut);
|
94
|
-
} else {
|
95
|
-
if (this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
|
96
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
97
|
-
}
|
98
|
-
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
99
|
-
}
|
100
|
-
}
|
101
|
-
componentDidMount() {
|
102
|
-
this.reset();
|
103
|
-
}
|
104
|
-
// reset timeout to prevent memory leaks.
|
105
|
-
reset() {
|
106
|
-
this.longPressDetected = false;
|
107
|
-
this.pointerInside = true;
|
108
|
-
clearTimeout(this.pressInTimeout);
|
109
|
-
clearTimeout(this.pressOutTimeout);
|
110
|
-
clearTimeout(this.longPressTimeout);
|
111
|
-
this.pressOutTimeout = null;
|
112
|
-
this.longPressTimeout = null;
|
113
|
-
this.pressInTimeout = null;
|
114
|
-
}
|
115
|
-
|
116
|
-
// All states' transitions are defined here.
|
117
|
-
moveToState(newState) {
|
118
|
-
var _this$props$onStateCh, _this$props4;
|
119
|
-
if (newState === this.STATE) {
|
120
|
-
// Ignore dummy transitions
|
121
|
-
return;
|
122
|
-
}
|
123
|
-
if (newState === TOUCHABLE_STATE.BEGAN) {
|
124
|
-
var _this$props$onPressIn, _this$props;
|
125
|
-
// First touch and moving inside
|
126
|
-
(_this$props$onPressIn = (_this$props = this.props).onPressIn) === null || _this$props$onPressIn === void 0 || _this$props$onPressIn.call(_this$props);
|
127
|
-
} else if (newState === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
128
|
-
var _this$props$onPressOu, _this$props2;
|
129
|
-
// Moving outside
|
130
|
-
(_this$props$onPressOu = (_this$props2 = this.props).onPressOut) === null || _this$props$onPressOu === void 0 || _this$props$onPressOu.call(_this$props2);
|
131
|
-
} else if (newState === TOUCHABLE_STATE.UNDETERMINED) {
|
132
|
-
// Need to reset each time on transition to UNDETERMINED
|
133
|
-
this.reset();
|
134
|
-
if (this.STATE === TOUCHABLE_STATE.BEGAN) {
|
135
|
-
var _this$props$onPressOu2, _this$props3;
|
136
|
-
// ... and if it happens inside button.
|
137
|
-
(_this$props$onPressOu2 = (_this$props3 = this.props).onPressOut) === null || _this$props$onPressOu2 === void 0 || _this$props$onPressOu2.call(_this$props3);
|
138
|
-
}
|
139
|
-
}
|
140
|
-
// Finally call lister (used by subclasses)
|
141
|
-
(_this$props$onStateCh = (_this$props4 = this.props).onStateChange) === null || _this$props$onStateCh === void 0 || _this$props$onStateCh.call(_this$props4, this.STATE, newState);
|
142
|
-
// ... and make transition.
|
143
|
-
this.STATE = newState;
|
144
|
-
}
|
145
|
-
onGestureEvent = ({
|
146
|
-
nativeEvent: {
|
147
|
-
pointerInside
|
148
|
-
}
|
149
|
-
}) => {
|
150
|
-
if (this.pointerInside !== pointerInside) {
|
151
|
-
if (pointerInside) {
|
152
|
-
this.onMoveIn();
|
153
|
-
} else {
|
154
|
-
this.onMoveOut();
|
155
|
-
}
|
156
|
-
}
|
157
|
-
this.pointerInside = pointerInside;
|
158
|
-
};
|
159
|
-
onHandlerStateChange = ({
|
160
|
-
nativeEvent
|
161
|
-
}) => {
|
162
|
-
const {
|
163
|
-
state
|
164
|
-
} = nativeEvent;
|
165
|
-
if (state === _State.State.CANCELLED || state === _State.State.FAILED) {
|
166
|
-
// Need to handle case with external cancellation (e.g. by ScrollView)
|
167
|
-
this.moveToState(TOUCHABLE_STATE.UNDETERMINED);
|
168
|
-
} else if (
|
169
|
-
// This platform check is an implication of slightly different behavior of handlers on different platform.
|
170
|
-
// And Android "Active" state is achieving on first move of a finger, not on press in.
|
171
|
-
// On iOS event on "Began" is not delivered.
|
172
|
-
state === (_reactNative.Platform.OS !== 'android' ? _State.State.ACTIVE : _State.State.BEGAN) && this.STATE === TOUCHABLE_STATE.UNDETERMINED) {
|
173
|
-
// Moving inside requires
|
174
|
-
this.handlePressIn();
|
175
|
-
} else if (state === _State.State.END) {
|
176
|
-
const shouldCallOnPress = !this.longPressDetected && this.STATE !== TOUCHABLE_STATE.MOVED_OUTSIDE && this.pressOutTimeout === null;
|
177
|
-
this.handleGoToUndetermined();
|
178
|
-
if (shouldCallOnPress) {
|
179
|
-
var _this$props$onPress, _this$props5;
|
180
|
-
// Calls only inside component whether no long press was called previously
|
181
|
-
(_this$props$onPress = (_this$props5 = this.props).onPress) === null || _this$props$onPress === void 0 || _this$props$onPress.call(_this$props5);
|
182
|
-
}
|
183
|
-
}
|
184
|
-
};
|
185
|
-
onLongPressDetected = () => {
|
186
|
-
var _this$props$onLongPre, _this$props6;
|
187
|
-
this.longPressDetected = true;
|
188
|
-
// checked for in the caller of `onLongPressDetected`, but better to check twice
|
189
|
-
(_this$props$onLongPre = (_this$props6 = this.props).onLongPress) === null || _this$props$onLongPre === void 0 || _this$props$onLongPre.call(_this$props6);
|
190
|
-
};
|
191
|
-
componentWillUnmount() {
|
192
|
-
// to prevent memory leaks
|
193
|
-
this.reset();
|
194
|
-
}
|
195
|
-
onMoveIn() {
|
196
|
-
if (this.STATE === TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
197
|
-
// This call is not throttled with delays (like in RN's implementation).
|
198
|
-
this.moveToState(TOUCHABLE_STATE.BEGAN);
|
199
|
-
}
|
200
|
-
}
|
201
|
-
onMoveOut() {
|
202
|
-
// long press should no longer be detected
|
203
|
-
clearTimeout(this.longPressTimeout);
|
204
|
-
this.longPressTimeout = null;
|
205
|
-
if (this.STATE === TOUCHABLE_STATE.BEGAN) {
|
206
|
-
this.handleMoveOutside();
|
207
|
-
}
|
208
|
-
}
|
209
|
-
render() {
|
210
|
-
const hitSlop = (typeof this.props.hitSlop === 'number' ? {
|
211
|
-
top: this.props.hitSlop,
|
212
|
-
left: this.props.hitSlop,
|
213
|
-
bottom: this.props.hitSlop,
|
214
|
-
right: this.props.hitSlop
|
215
|
-
} : this.props.hitSlop) ?? undefined;
|
216
|
-
const coreProps = {
|
217
|
-
accessible: this.props.accessible !== false,
|
218
|
-
accessibilityLabel: this.props.accessibilityLabel,
|
219
|
-
accessibilityHint: this.props.accessibilityHint,
|
220
|
-
accessibilityRole: this.props.accessibilityRole,
|
221
|
-
// TODO: check if changed to no 's' correctly, also removed 2 props that are no longer available: `accessibilityComponentType` and `accessibilityTraits`,
|
222
|
-
// would be good to check if it is ok for sure, see: https://github.com/facebook/react-native/issues/24016
|
223
|
-
accessibilityState: this.props.accessibilityState,
|
224
|
-
accessibilityActions: this.props.accessibilityActions,
|
225
|
-
onAccessibilityAction: this.props.onAccessibilityAction,
|
226
|
-
nativeID: this.props.nativeID,
|
227
|
-
onLayout: this.props.onLayout
|
228
|
-
};
|
229
|
-
return /*#__PURE__*/React.createElement(_GestureButtons.BaseButton, _extends({
|
230
|
-
style: this.props.containerStyle,
|
231
|
-
onHandlerStateChange:
|
232
|
-
// TODO: not sure if it can be undefined instead of null
|
233
|
-
this.props.disabled ? undefined : this.onHandlerStateChange,
|
234
|
-
onGestureEvent: this.onGestureEvent,
|
235
|
-
hitSlop: hitSlop,
|
236
|
-
shouldActivateOnStart: this.props.shouldActivateOnStart,
|
237
|
-
disallowInterruption: this.props.disallowInterruption,
|
238
|
-
testID: this.props.testID,
|
239
|
-
touchSoundDisabled: this.props.touchSoundDisabled ?? false,
|
240
|
-
enabled: !this.props.disabled
|
241
|
-
}, this.props.extraButtonProps), /*#__PURE__*/React.createElement(_reactNative.Animated.View, _extends({}, coreProps, {
|
242
|
-
style: this.props.style
|
243
|
-
}), this.props.children));
|
244
|
-
}
|
245
|
-
}
|
246
|
-
exports.default = GenericTouchable;
|
247
|
-
//# sourceMappingURL=GenericTouchable.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","React","_reactNative","_State","_GestureButtons","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","TOUCHABLE_STATE","exports","UNDETERMINED","BEGAN","MOVED_OUTSIDE","GenericTouchable","Component","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","_this$props$onPressOu","_this$props2","onPressOut","_this$props$onPressOu2","_this$props3","onStateChange","onGestureEvent","nativeEvent","onMoveIn","onMoveOut","onHandlerStateChange","state","State","CANCELLED","FAILED","Platform","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","BaseButton","style","containerStyle","disabled","shouldActivateOnStart","disallowInterruption","testID","touchSoundDisabled","enabled","Animated","View","children"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/touchables/GenericTouchable.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,IAAAC,KAAA,GAAAH,MAAA;AAE/B,IAAAI,YAAA,GAAAF,OAAA;AASA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAA+C,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,G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C/D,KAAK,CAAC+D,QAAQ;MAC7BC,QAAQ,EAAE,IAAI,CAAChE,KAAK,CAACgE;IACvB,CAAC;IAED,oBACElH,KAAA,CAAAmH,aAAA,CAAChH,eAAA,CAAAiH,UAAU,EAAA3F,QAAA;MACT4F,KAAK,EAAE,IAAI,CAACnE,KAAK,CAACoE,cAAe;MACjCpC,oBAAoB;MAClB;MACA,IAAI,CAAChC,KAAK,CAACqE,QAAQ,GAAGf,SAAS,GAAG,IAAI,CAACtB,oBACxC;MACDJ,cAAc,EAAE,IAAI,CAACA,cAAe;MACpCqB,OAAO,EAAEA,OAAQ;MACjBqB,qBAAqB,EAAE,IAAI,CAACtE,KAAK,CAACsE,qBAAsB;MACxDC,oBAAoB,EAAE,IAAI,CAACvE,KAAK,CAACuE,oBAAqB;MACtDC,MAAM,EAAE,IAAI,CAACxE,KAAK,CAACwE,MAAO;MAC1BC,kBAAkB,EAAE,IAAI,CAACzE,KAAK,CAACyE,kBAAkB,IAAI,KAAM;MAC3DC,OAAO,EAAE,CAAC,IAAI,CAAC1E,KAAK,CAACqE;IAAS,GAC1B,IAAI,CAACrE,KAAK,CAACP,gBAAgB,gBAE/B3C,KAAA,CAAAmH,aAAA,CAAClH,YAAA,CAAA4H,QAAQ,CAACC,IAAI,EAAArG,QAAA,KAAKgF,SAAS;MAAEY,KAAK,EAAE,IAAI,CAACnE,KAAK,CAACmE;IAAM,IACnD,IAAI,CAACnE,KAAK,CAAC6E,QACC,CACL,CAAC;EAEjB;AACF;AAAC5F,OAAA,CAAAzB,OAAA,GAAA6B,gBAAA"}
|
@@ -1,58 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
var _reactNative = require("react-native");
|
8
|
-
var _GenericTouchable = _interopRequireWildcard(require("./GenericTouchable"));
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
10
|
-
var React = _react;
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
13
|
-
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); }
|
14
|
-
/**
|
15
|
-
* TouchableOpacity bases on timing animation which has been used in RN's core
|
16
|
-
*/
|
17
|
-
class TouchableOpacity extends _react.Component {
|
18
|
-
static defaultProps = {
|
19
|
-
..._GenericTouchable.default.defaultProps,
|
20
|
-
activeOpacity: 0.2
|
21
|
-
};
|
22
|
-
|
23
|
-
// opacity is 1 one by default but could be overwritten
|
24
|
-
getChildStyleOpacityWithDefault = () => {
|
25
|
-
const childStyle = _reactNative.StyleSheet.flatten(this.props.style) || {};
|
26
|
-
return childStyle.opacity == null ? 1 : childStyle.opacity.valueOf();
|
27
|
-
};
|
28
|
-
opacity = new _reactNative.Animated.Value(this.getChildStyleOpacityWithDefault());
|
29
|
-
setOpacityTo = (value, duration) => {
|
30
|
-
_reactNative.Animated.timing(this.opacity, {
|
31
|
-
toValue: value,
|
32
|
-
duration: duration,
|
33
|
-
easing: _reactNative.Easing.inOut(_reactNative.Easing.quad),
|
34
|
-
useNativeDriver: this.props.useNativeAnimations ?? true
|
35
|
-
}).start();
|
36
|
-
};
|
37
|
-
onStateChange = (_from, to) => {
|
38
|
-
if (to === _GenericTouchable.TOUCHABLE_STATE.BEGAN) {
|
39
|
-
this.setOpacityTo(this.props.activeOpacity, 0);
|
40
|
-
} else if (to === _GenericTouchable.TOUCHABLE_STATE.UNDETERMINED || to === _GenericTouchable.TOUCHABLE_STATE.MOVED_OUTSIDE) {
|
41
|
-
this.setOpacityTo(this.getChildStyleOpacityWithDefault(), 150);
|
42
|
-
}
|
43
|
-
};
|
44
|
-
render() {
|
45
|
-
const {
|
46
|
-
style = {},
|
47
|
-
...rest
|
48
|
-
} = this.props;
|
49
|
-
return /*#__PURE__*/React.createElement(_GenericTouchable.default, _extends({}, rest, {
|
50
|
-
style: [style, {
|
51
|
-
opacity: this.opacity // TODO: fix this
|
52
|
-
}],
|
53
|
-
onStateChange: this.onStateChange
|
54
|
-
}), this.props.children ? this.props.children : /*#__PURE__*/React.createElement(_reactNative.View, null));
|
55
|
-
}
|
56
|
-
}
|
57
|
-
exports.default = TouchableOpacity;
|
58
|
-
//# sourceMappingURL=TouchableOpacity.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_GenericTouchable","_interopRequireWildcard","_react","React","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","TouchableOpacity","Component","defaultProps","GenericTouchable","activeOpacity","getChildStyleOpacityWithDefault","childStyle","StyleSheet","flatten","props","style","opacity","valueOf","Animated","Value","setOpacityTo","value","duration","timing","toValue","easing","Easing","inOut","quad","useNativeDriver","useNativeAnimations","start","onStateChange","_from","to","TOUCHABLE_STATE","BEGAN","UNDETERMINED","MOVED_OUTSIDE","render","rest","createElement","children","View","exports"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/touchables/TouchableOpacity.tsx"],"mappings":";;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Ae,EAAE,IAAI,CAACf,KAAK,CAACgB,mBAAmB,IAAI;IACrD,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC;EACZ,CAAC;EAEDC,aAAa,GAAGA,CAACC,KAAa,EAAEC,EAAU,KAAK;IAC7C,IAAIA,EAAE,KAAKC,iCAAe,CAACC,KAAK,EAAE;MAChC,IAAI,CAAChB,YAAY,CAAC,IAAI,CAACN,KAAK,CAACL,aAAa,EAAG,CAAC,CAAC;IACjD,CAAC,MAAM,IACLyB,EAAE,KAAKC,iCAAe,CAACE,YAAY,IACnCH,EAAE,KAAKC,iCAAe,CAACG,aAAa,EACpC;MACA,IAAI,CAAClB,YAAY,CAAC,IAAI,CAACV,+BAA+B,CAAC,CAAC,EAAE,GAAG,CAAC;IAChE;EACF,CAAC;EAED6B,MAAMA,CAAA,EAAG;IACP,MAAM;MAAExB,KAAK,GAAG,CAAC,CAAC;MAAE,GAAGyB;IAAK,CAAC,GAAG,IAAI,CAAC1B,KAAK;IAC1C,oBACExC,KAAA,CAAAmE,aAAA,CAACtE,iBAAA,CAAAU,OAAgB,EAAAe,QAAA,KACX4C,IAAI;MACRzB,KAAK,EAAE,CACLA,KAAK,EACL;QACEC,OAAO,EAAE,IAAI,CAACA,OAA4B,CAAE;MAC9C,CAAC,CACD;MACFgB,aAAa,EAAE,IAAI,CAACA;IAAc,IAEjC,IAAI,CAAClB,KAAK,CAAC4B,QAAQ,GAAG,IAAI,CAAC5B,KAAK,CAAC4B,QAAQ,gBAAGpE,KAAA,CAAAmE,aAAA,CAACxE,YAAA,CAAA0E,IAAI,MAAE,CACpC,CAAC;EAEvB;AACF;AAACC,OAAA,CAAA/D,OAAA,GAAAwB,gBAAA"}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
8
|
-
var _GenericTouchable = _interopRequireDefault(require("./GenericTouchable"));
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
12
|
-
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); }
|
13
|
-
const TouchableWithoutFeedback = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(_GenericTouchable.default, _extends({
|
14
|
-
ref: ref
|
15
|
-
}, props)));
|
16
|
-
TouchableWithoutFeedback.defaultProps = _GenericTouchable.default.defaultProps;
|
17
|
-
var _default = exports.default = TouchableWithoutFeedback;
|
18
|
-
//# sourceMappingURL=TouchableWithoutFeedback.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["React","_interopRequireWildcard","require","_GenericTouchable","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","TouchableWithoutFeedback","forwardRef","props","ref","createElement","defa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V,CAAA,CAAAM,CAAA,IAAAZ,CAAA,CAAAY,CAAA,YAAAN,CAAA,CAAAR,OAAA,GAAAE,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAc,GAAA,CAAAjB,CAAA,EAAAM,CAAA,GAAAA,CAAA;AAAA,SAAAY,SAAA,IAAAA,QAAA,GAAAT,MAAA,CAAAU,MAAA,GAAAV,MAAA,CAAAU,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAL,CAAA,MAAAA,CAAA,GAAAM,SAAA,CAAAC,MAAA,EAAAP,CAAA,UAAAQ,MAAA,GAAAF,SAAA,CAAAN,CAAA,YAAAS,GAAA,IAAAD,MAAA,QAAAf,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAS,MAAA,EAAAC,GAAA,KAAAJ,MAAA,CAAAI,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAJ,MAAA,YAAAH,QAAA,CAAAQ,KAAA,OAAAJ,SAAA;AAI7E,MAAMK,wBAAwB,gBAAGpC,KAAK,CAACqC,UAAU,CAG/C,CAACC,KAAK,EAAEC,GAAG,kBAAKvC,KAAA,CAAAwC,aAAA,CAACrC,iBAAA,CAAAI,OAAgB,EAAAoB,QAAA;EAACY,GAAG,EAAEA;AAAI,GAAKD,KAAK,CAAG,CAAC,CAAC;AAE5DF,wBAAwB,CAACK,YAAY,GAAGC,yBAAgB,CAACD,YAAY;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAArC,OAAA,GAEvD6B,wBAAwB"}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
Object.defineProperty(exports, "TouchableOpacity", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _TouchableOpacity.default;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
Object.defineProperty(exports, "TouchableWithoutFeedback", {
|
13
|
-
enumerable: true,
|
14
|
-
get: function () {
|
15
|
-
return _TouchableWithoutFeedback.default;
|
16
|
-
}
|
17
|
-
});
|
18
|
-
var _TouchableWithoutFeedback = _interopRequireDefault(require("./TouchableWithoutFeedback"));
|
19
|
-
var _TouchableOpacity = _interopRequireDefault(require("./TouchableOpacity"));
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_TouchableWithoutFeedback","_interopRequireDefault","require","_TouchableOpacity","obj","__esModule","default"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/touchables/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAIA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAiE,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.nativeViewProps = exports.nativeViewHandlerName = exports.nativeViewGestureHandlerProps = exports.NativeViewGestureHandler = void 0;
|
7
|
-
var _createHandler = _interopRequireDefault(require("./createHandler"));
|
8
|
-
var _gestureHandlerCommon = require("react-native-gesture-handler/src/handlers/gestureHandlerCommon");
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
-
const nativeViewGestureHandlerProps = exports.nativeViewGestureHandlerProps = ['shouldActivateOnStart', 'disallowInterruption'];
|
11
|
-
const nativeViewProps = exports.nativeViewProps = [..._gestureHandlerCommon.baseGestureHandlerProps, ...nativeViewGestureHandlerProps];
|
12
|
-
const nativeViewHandlerName = exports.nativeViewHandlerName = 'NativeViewGestureHandler';
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
14
|
-
const NativeViewGestureHandler = exports.NativeViewGestureHandler = (0, _createHandler.default)({
|
15
|
-
name: nativeViewHandlerName,
|
16
|
-
allowedProps: nativeViewProps,
|
17
|
-
config: {}
|
18
|
-
});
|
19
|
-
//# sourceMappingURL=NativeViewGestureHandler.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_createHandler","_interopRequireDefault","require","_gestureHandlerCommon","obj","__esModule","default","nativeViewGestureHandlerProps","exports","nativeViewProps","baseGestureHandlerProps","nativeViewHandlerName","NativeViewGestureHandler","createHandler","name","allowedProps","config"],"sourceRoot":"..\\..\\..\\src","sources":["handlers/NativeViewGestureHandler.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAGwE,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEjE,MAAMG,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAG,CAC3C,uBAAuB,EACvB,sBAAsB,CACd;AA6BH,MAAME,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,CAC7B,GAAGC,6CAAuB,EAC1B,GAAGH,6BAA6B,CACxB;AAEH,MAAMI,qBAAqB,GAAAH,OAAA,CAAAG,qBAAA,GAAG,0BAA0B;AAG/D;AACO,MAAMC,wBAAwB,GAAAJ,OAAA,CAAAI,wBAAA,GAAG,IAAAC,sBAAa,EAGnD;EACAC,IAAI,EAAEH,qBAAqB;EAC3BI,YAAY,EAAEN,eAAe;EAC7BO,MAAM,EAAE,CAAC;AACX,CAAC,CAAC"}
|
@@ -1,103 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.PanGestureHandler = void 0;
|
7
|
-
exports.managePanProps = managePanProps;
|
8
|
-
exports.panHandlerName = exports.panGestureHandlerProps = exports.panGestureHandlerCustomNativeProps = void 0;
|
9
|
-
var _createHandler = _interopRequireDefault(require("./createHandler"));
|
10
|
-
var _gestureHandlerCommon = require("react-native-gesture-handler/src/handlers/gestureHandlerCommon");
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
-
// RNGH: patching to replace `createHandler`
|
13
|
-
|
14
|
-
// RNGH: using local create handler
|
15
|
-
|
16
|
-
const panGestureHandlerProps = exports.panGestureHandlerProps = ['activeOffsetY', 'activeOffsetX', 'failOffsetY', 'failOffsetX', 'minDist', 'minVelocity', 'minVelocityX', 'minVelocityY', 'minPointers', 'maxPointers', 'avgTouches', 'enableTrackpadTwoFingerGesture', 'activateAfterLongPress'];
|
17
|
-
const panGestureHandlerCustomNativeProps = exports.panGestureHandlerCustomNativeProps = ['activeOffsetYStart', 'activeOffsetYEnd', 'activeOffsetXStart', 'activeOffsetXEnd', 'failOffsetYStart', 'failOffsetYEnd', 'failOffsetXStart', 'failOffsetXEnd'];
|
18
|
-
const panHandlerName = exports.panHandlerName = 'PanGestureHandler';
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
20
|
-
const PanGestureHandler = exports.PanGestureHandler = (0, _createHandler.default)({
|
21
|
-
name: panHandlerName,
|
22
|
-
allowedProps: [..._gestureHandlerCommon.baseGestureHandlerProps, ...panGestureHandlerProps],
|
23
|
-
config: {},
|
24
|
-
transformProps: managePanProps,
|
25
|
-
customNativeProps: panGestureHandlerCustomNativeProps
|
26
|
-
});
|
27
|
-
function validatePanGestureHandlerProps(props) {
|
28
|
-
if (Array.isArray(props.activeOffsetX) && (props.activeOffsetX[0] > 0 || props.activeOffsetX[1] < 0)) {
|
29
|
-
throw new Error(`First element of activeOffsetX should be negative, a the second one should be positive`);
|
30
|
-
}
|
31
|
-
if (Array.isArray(props.activeOffsetY) && (props.activeOffsetY[0] > 0 || props.activeOffsetY[1] < 0)) {
|
32
|
-
throw new Error(`First element of activeOffsetY should be negative, a the second one should be positive`);
|
33
|
-
}
|
34
|
-
if (Array.isArray(props.failOffsetX) && (props.failOffsetX[0] > 0 || props.failOffsetX[1] < 0)) {
|
35
|
-
throw new Error(`First element of failOffsetX should be negative, a the second one should be positive`);
|
36
|
-
}
|
37
|
-
if (Array.isArray(props.failOffsetY) && (props.failOffsetY[0] > 0 || props.failOffsetY[1] < 0)) {
|
38
|
-
throw new Error(`First element of failOffsetY should be negative, a the second one should be positive`);
|
39
|
-
}
|
40
|
-
if (props.minDist && (props.failOffsetX || props.failOffsetY)) {
|
41
|
-
throw new Error(`It is not supported to use minDist with failOffsetX or failOffsetY, use activeOffsetX and activeOffsetY instead`);
|
42
|
-
}
|
43
|
-
if (props.minDist && (props.activeOffsetX || props.activeOffsetY)) {
|
44
|
-
throw new Error(`It is not supported to use minDist with activeOffsetX or activeOffsetY`);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
function transformPanGestureHandlerProps(props) {
|
48
|
-
const res = {
|
49
|
-
...props
|
50
|
-
};
|
51
|
-
if (props.activeOffsetX !== undefined) {
|
52
|
-
delete res.activeOffsetX;
|
53
|
-
if (Array.isArray(props.activeOffsetX)) {
|
54
|
-
res.activeOffsetXStart = props.activeOffsetX[0];
|
55
|
-
res.activeOffsetXEnd = props.activeOffsetX[1];
|
56
|
-
} else if (props.activeOffsetX < 0) {
|
57
|
-
res.activeOffsetXStart = props.activeOffsetX;
|
58
|
-
} else {
|
59
|
-
res.activeOffsetXEnd = props.activeOffsetX;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
if (props.activeOffsetY !== undefined) {
|
63
|
-
delete res.activeOffsetY;
|
64
|
-
if (Array.isArray(props.activeOffsetY)) {
|
65
|
-
res.activeOffsetYStart = props.activeOffsetY[0];
|
66
|
-
res.activeOffsetYEnd = props.activeOffsetY[1];
|
67
|
-
} else if (props.activeOffsetY < 0) {
|
68
|
-
res.activeOffsetYStart = props.activeOffsetY;
|
69
|
-
} else {
|
70
|
-
res.activeOffsetYEnd = props.activeOffsetY;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
if (props.failOffsetX !== undefined) {
|
74
|
-
delete res.failOffsetX;
|
75
|
-
if (Array.isArray(props.failOffsetX)) {
|
76
|
-
res.failOffsetXStart = props.failOffsetX[0];
|
77
|
-
res.failOffsetXEnd = props.failOffsetX[1];
|
78
|
-
} else if (props.failOffsetX < 0) {
|
79
|
-
res.failOffsetXStart = props.failOffsetX;
|
80
|
-
} else {
|
81
|
-
res.failOffsetXEnd = props.failOffsetX;
|
82
|
-
}
|
83
|
-
}
|
84
|
-
if (props.failOffsetY !== undefined) {
|
85
|
-
delete res.failOffsetY;
|
86
|
-
if (Array.isArray(props.failOffsetY)) {
|
87
|
-
res.failOffsetYStart = props.failOffsetY[0];
|
88
|
-
res.failOffsetYEnd = props.failOffsetY[1];
|
89
|
-
} else if (props.failOffsetY < 0) {
|
90
|
-
res.failOffsetYStart = props.failOffsetY;
|
91
|
-
} else {
|
92
|
-
res.failOffsetYEnd = props.failOffsetY;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
return res;
|
96
|
-
}
|
97
|
-
function managePanProps(props) {
|
98
|
-
if (__DEV__) {
|
99
|
-
validatePanGestureHandlerProps(props);
|
100
|
-
}
|
101
|
-
return transformPanGestureHandlerProps(props);
|
102
|
-
}
|
103
|
-
//# sourceMappingURL=PanGestureHandler.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_createHandler","_interopRequireDefault","require","_gestureHandlerCommon","obj","__esModule","default","panGestureHandlerProps","exports","panGestureHandlerCustomNativeProps","panHandlerName","PanGestureHandler","createHandler","name","allowedProps","baseGestureHandlerProps","config","transformProps","managePanProps","customNativeProps","validatePanGestureHandlerProps","props","Array","isArray","activeOffsetX","Error","activeOffsetY","failOffsetX","failOffsetY","minDist","transformPanGestureHandlerProps","res","undefined","activeOffsetXStart","activeOffsetXEnd","activeOffsetYStart","activeOffsetYEnd","failOffsetXStart","failOffsetXEnd","failOffsetYStart","failOffsetYEnd","__DEV__"],"sourceRoot":"..\\..\\..\\src","sources":["handlers/PanGestureHandler.ts"],"mappings":";;;;;;;;AAEA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAGwE,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AANxE;;AAE6C;;AAMtC,MAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,CACpC,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,SAAS,EACT,aAAa,EACb,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gCAAgC,EAChC,wBAAwB,CAChB;AAEH,MAAME,kCAAkC,GAAAD,OAAA,CAAAC,kCAAA,GAAG,CAChD,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,CACR;AA0JH,MAAMC,cAAc,GAAAF,OAAA,CAAAE,cAAA,GAAG,mBAAmB;AAGjD;AACO,MAAMC,iBAAiB,GAAAH,OAAA,CAAAG,iBAAA,GAAG,IAAAC,sBAAa,EAG5C;EACAC,IAAI,EAAEH,cAAc;EACpBI,YAAY,EAAE,CACZ,GAAGC,6CAAuB,EAC1B,GAAGR,sBAAsB,CACjB;EACVS,MAAM,EAAE,CAAC,CAAC;EACVC,cAAc,EAAEC,cAAc;EAC9BC,iBAAiB,EAAEV;AACrB,CAAC,CAAC;AAEF,SAASW,8BAA8BA,CAACC,KAA6B,EAAE;EACrE,IACEC,KA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hB,KAAK,CAACM,WAAW,CAAC,CAAC,CAAC;MAC3CI,GAAG,CAACO,cAAc,GAAGjB,KAAK,CAACM,WAAW,CAAC,CAAC,CAAC;IAC3C,CAAC,MAAM,IAAIN,KAAK,CAACM,WAAW,GAAG,CAAC,EAAE;MAChCI,GAAG,CAACM,gBAAgB,GAAGhB,KAAK,CAACM,WAAW;IAC1C,CAAC,MAAM;MACLI,GAAG,CAACO,cAAc,GAAGjB,KAAK,CAACM,WAAW;IACxC;EACF;EAEA,IAAIN,KAAK,CAACO,WAAW,KAAKI,SAAS,EAAE;IACnC,OAAOD,GAAG,CAACH,WAAW;IACtB,IAAIN,KAAK,CAACC,OAAO,CAACF,KAAK,CAACO,WAAW,CAAC,EAAE;MACpCG,GAAG,CAACQ,gBAAgB,GAAGlB,KAAK,CAACO,WAAW,CAAC,CAAC,CAAC;MAC3CG,GAAG,CAACS,cAAc,GAAGnB,KAAK,CAACO,WAAW,CAAC,CAAC,CAAC;IAC3C,CAAC,MAAM,IAAIP,KAAK,CAACO,WAAW,GAAG,CAAC,EAAE;MAChCG,GAAG,CAACQ,gBAAgB,GAAGlB,KAAK,CAACO,WAAW;IAC1C,CAAC,MAAM;MACLG,GAAG,CAACS,cAAc,GAAGnB,KAAK,CAACO,WAAW;IACxC;EACF;EAEA,OAAOG,GAAG;AACZ;AAEO,SAASb,cAAcA,CAACG,KAA6B,EAAE;EAC5D,IAAIoB,OAAO,EAAE;IACXrB,8BAA8B,CAACC,KAAK,CAAC;EACvC;EACA,OAAOS,+BAA+B,CAACT,KAAK,CAAC;AAC/C"}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.tapHandlerName = exports.tapGestureHandlerProps = exports.TapGestureHandler = void 0;
|
7
|
-
var _createHandler = _interopRequireDefault(require("./createHandler"));
|
8
|
-
var _gestureHandlerCommon = require("react-native-gesture-handler/src/handlers/gestureHandlerCommon");
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
-
// RNGH: forking to use the forked createHandler
|
11
|
-
|
12
|
-
const tapGestureHandlerProps = exports.tapGestureHandlerProps = ['maxDurationMs', 'maxDelayMs', 'numberOfTaps', 'maxDeltaX', 'maxDeltaY', 'maxDist', 'minPointers'];
|
13
|
-
const tapHandlerName = exports.tapHandlerName = 'TapGestureHandler';
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
|
15
|
-
const TapGestureHandler = exports.TapGestureHandler = (0, _createHandler.default)({
|
16
|
-
name: tapHandlerName,
|
17
|
-
allowedProps: [..._gestureHandlerCommon.baseGestureHandlerProps, ...tapGestureHandlerProps],
|
18
|
-
config: {
|
19
|
-
shouldCancelWhenOutside: true
|
20
|
-
}
|
21
|
-
});
|
22
|
-
//# sourceMappingURL=TapGestureHandler.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_createHandler","_interopRequireDefault","require","_gestureHandlerCommon","obj","__esModule","default","tapGestureHandlerProps","exports","tapHandlerName","TapGestureHandler","createHandler","name","allowedProps","baseGestureHandlerProps","config","shouldCancelWhenOutside"],"sourceRoot":"..\\..\\..\\src","sources":["handlers/TapGestureHandler.ts"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAGwE,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AALxE;;AAOO,MAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,CACpC,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,SAAS,EACT,aAAa,CACL;AA+DH,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,mBAAmB;AAGjD;AACO,MAAMC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,GAAG,IAAAC,sBAAa,EAG5C;EACAC,IAAI,EAAEH,cAAc;EACpBI,YAAY,EAAE,CACZ,GAAGC,6CAAuB,EAC1B,GAAGP,sBAAsB,CACjB;EACVQ,MAAM,EAAE;IACNC,uBAAuB,EAAE;EAC3B;AACF,CAAC,CAAC"}
|
@@ -1,64 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = createNativeWrapper;
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
8
|
-
var React = _react;
|
9
|
-
var _NativeViewGestureHandler = require("./NativeViewGestureHandler");
|
10
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
12
|
-
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); }
|
13
|
-
/*
|
14
|
-
* This array should consist of:
|
15
|
-
* - All keys in propTypes from NativeGestureHandler
|
16
|
-
* (and all keys in GestureHandlerPropTypes)
|
17
|
-
* - 'onGestureHandlerEvent'
|
18
|
-
* - 'onGestureHandlerStateChange'
|
19
|
-
*/
|
20
|
-
const NATIVE_WRAPPER_PROPS_FILTER = [..._NativeViewGestureHandler.nativeViewProps, 'onGestureHandlerEvent', 'onGestureHandlerStateChange'];
|
21
|
-
function createNativeWrapper(Component, config = {}) {
|
22
|
-
var _Component$render;
|
23
|
-
const ComponentWrapper = /*#__PURE__*/React.forwardRef((props, ref) => {
|
24
|
-
// filter out props that should be passed to gesture handler wrapper
|
25
|
-
const gestureHandlerProps = Object.keys(props).reduce((res, key) => {
|
26
|
-
// TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info
|
27
|
-
const allowedKeys = NATIVE_WRAPPER_PROPS_FILTER;
|
28
|
-
if (allowedKeys.includes(key)) {
|
29
|
-
// @ts-ignore FIXME(TS)
|
30
|
-
res[key] = props[key];
|
31
|
-
}
|
32
|
-
return res;
|
33
|
-
}, {
|
34
|
-
...config
|
35
|
-
} // watch out not to modify config
|
36
|
-
);
|
37
|
-
const _ref = (0, _react.useRef)();
|
38
|
-
const _gestureHandlerRef = (0, _react.useRef)();
|
39
|
-
(0, _react.useImperativeHandle)(ref,
|
40
|
-
// @ts-ignore TODO(TS) decide how nulls work in this context
|
41
|
-
() => {
|
42
|
-
const node = _gestureHandlerRef.current;
|
43
|
-
// add handlerTag for relations config
|
44
|
-
if (_ref.current && node) {
|
45
|
-
// @ts-ignore FIXME(TS) think about createHandler return type
|
46
|
-
_ref.current.handlerTag = node.handlerTag;
|
47
|
-
return _ref.current;
|
48
|
-
}
|
49
|
-
return null;
|
50
|
-
}, [_ref, _gestureHandlerRef]);
|
51
|
-
return /*#__PURE__*/React.createElement(_NativeViewGestureHandler.NativeViewGestureHandler, _extends({}, gestureHandlerProps, {
|
52
|
-
// @ts-ignore TODO(TS)
|
53
|
-
ref: _gestureHandlerRef
|
54
|
-
}), /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
55
|
-
ref: _ref
|
56
|
-
})));
|
57
|
-
});
|
58
|
-
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
60
|
-
ComponentWrapper.displayName = (Component === null || Component === void 0 ? void 0 : Component.displayName) || ( // @ts-ignore if render doesn't exist it will return undefined and go further
|
61
|
-
Component === null || Component === void 0 || (_Component$render = Component.render) === null || _Component$render === void 0 ? void 0 : _Component$render.name) || typeof Component === 'string' && Component || 'ComponentWrapper';
|
62
|
-
return ComponentWrapper;
|
63
|
-
}
|
64
|
-
//# sourceMappingURL=createNativeWrapper.js.map
|