\n>((props, ref) => );\n\nTouchableWithoutFeedback.defaultProps = GenericTouchable.defaultProps;\n\nexport default TouchableWithoutFeedback;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/components/touchables/index.js b/lib/commonjs/components/touchables/index.js
new file mode 100644
index 0000000000..7ea96ef6a6
--- /dev/null
+++ b/lib/commonjs/components/touchables/index.js
@@ -0,0 +1,40 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "TouchableNativeFeedback", {
+ enumerable: true,
+ get: function () {
+ return _TouchableNativeFeedback.default;
+ }
+});
+Object.defineProperty(exports, "TouchableWithoutFeedback", {
+ enumerable: true,
+ get: function () {
+ return _TouchableWithoutFeedback.default;
+ }
+});
+Object.defineProperty(exports, "TouchableOpacity", {
+ enumerable: true,
+ get: function () {
+ return _TouchableOpacity.default;
+ }
+});
+Object.defineProperty(exports, "TouchableHighlight", {
+ enumerable: true,
+ get: function () {
+ return _TouchableHighlight.default;
+ }
+});
+
+var _TouchableNativeFeedback = _interopRequireDefault(require("./TouchableNativeFeedback"));
+
+var _TouchableWithoutFeedback = _interopRequireDefault(require("./TouchableWithoutFeedback"));
+
+var _TouchableOpacity = _interopRequireDefault(require("./TouchableOpacity"));
+
+var _TouchableHighlight = _interopRequireDefault(require("./TouchableHighlight"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/lib/commonjs/components/touchables/index.js.map b/lib/commonjs/components/touchables/index.js.map
new file mode 100644
index 0000000000..215407f317
--- /dev/null
+++ b/lib/commonjs/components/touchables/index.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA","sourcesContent":["export { default as TouchableNativeFeedback } from './TouchableNativeFeedback';\nexport { default as TouchableWithoutFeedback } from './TouchableWithoutFeedback';\nexport { default as TouchableOpacity } from './TouchableOpacity';\nexport { default as TouchableHighlight } from './TouchableHighlight';\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/gestureHandlerRootHOC.js b/lib/commonjs/gestureHandlerRootHOC.js
new file mode 100644
index 0000000000..3eb329111c
--- /dev/null
+++ b/lib/commonjs/gestureHandlerRootHOC.js
@@ -0,0 +1,39 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = gestureHandlerRootHOC;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _reactNative = require("react-native");
+
+var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
+
+var _GestureHandlerRootView = _interopRequireDefault(require("./GestureHandlerRootView"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function gestureHandlerRootHOC(Component, containerStyles) {
+ function Wrapper(props) {
+ return /*#__PURE__*/React.createElement(_GestureHandlerRootView.default, {
+ style: [styles.container, containerStyles]
+ }, /*#__PURE__*/React.createElement(Component, props));
+ }
+
+ Wrapper.displayName = `gestureHandlerRootHOC(${Component.displayName || Component.name})`;
+ (0, _hoistNonReactStatics.default)(Wrapper, Component);
+ return Wrapper;
+}
+
+const styles = _reactNative.StyleSheet.create({
+ container: {
+ flex: 1
+ }
+});
+//# sourceMappingURL=gestureHandlerRootHOC.js.map
\ No newline at end of file
diff --git a/lib/commonjs/gestureHandlerRootHOC.js.map b/lib/commonjs/gestureHandlerRootHOC.js.map
new file mode 100644
index 0000000000..0a1e22c6c4
--- /dev/null
+++ b/lib/commonjs/gestureHandlerRootHOC.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["gestureHandlerRootHOC.tsx"],"names":["gestureHandlerRootHOC","Component","containerStyles","Wrapper","props","styles","container","displayName","name","StyleSheet","create","flex"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AAEe,SAASA,qBAAT,CACbC,SADa,EAEbC,eAFa,EAGW;AACxB,WAASC,OAAT,CAAiBC,KAAjB,EAA2B;AACzB,wBACE,oBAAC,+BAAD;AAAwB,MAAA,KAAK,EAAE,CAACC,MAAM,CAACC,SAAR,EAAmBJ,eAAnB;AAA/B,oBACE,oBAAC,SAAD,EAAeE,KAAf,CADF,CADF;AAKD;;AAEDD,EAAAA,OAAO,CAACI,WAAR,GAAuB,yBACrBN,SAAS,CAACM,WAAV,IAAyBN,SAAS,CAACO,IACpC,GAFD;AAIA,qCAAqBL,OAArB,EAA8BF,SAA9B;AAEA,SAAOE,OAAP;AACD;;AAED,MAAME,MAAM,GAAGI,wBAAWC,MAAX,CAAkB;AAC/BJ,EAAAA,SAAS,EAAE;AAAEK,IAAAA,IAAI,EAAE;AAAR;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport { StyleSheet, StyleProp, ViewStyle } from 'react-native';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport GestureHandlerRootView from './GestureHandlerRootView';\n\nexport default function gestureHandlerRootHOC(\n Component: React.ComponentType
,\n containerStyles?: StyleProp\n): React.ComponentType {\n function Wrapper(props: P) {\n return (\n \n \n \n );\n }\n\n Wrapper.displayName = `gestureHandlerRootHOC(${\n Component.displayName || Component.name\n })`;\n\n hoistNonReactStatics(Wrapper, Component);\n\n return Wrapper;\n}\n\nconst styles = StyleSheet.create({\n container: { flex: 1 },\n});\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/FlingGestureHandler.js b/lib/commonjs/handlers/FlingGestureHandler.js
new file mode 100644
index 0000000000..1c9d9db9c4
--- /dev/null
+++ b/lib/commonjs/handlers/FlingGestureHandler.js
@@ -0,0 +1,23 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.FlingGestureHandler = exports.flingGestureHandlerProps = void 0;
+
+var _createHandler = _interopRequireDefault(require("./createHandler"));
+
+var _gestureHandlerCommon = require("./gestureHandlerCommon");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const flingGestureHandlerProps = ['numberOfPointers', 'direction'];
+exports.flingGestureHandlerProps = flingGestureHandlerProps;
+// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
+const FlingGestureHandler = (0, _createHandler.default)({
+ name: 'FlingGestureHandler',
+ allowedProps: [..._gestureHandlerCommon.baseGestureHandlerProps, ...flingGestureHandlerProps],
+ config: {}
+});
+exports.FlingGestureHandler = FlingGestureHandler;
+//# sourceMappingURL=FlingGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/FlingGestureHandler.js.map b/lib/commonjs/handlers/FlingGestureHandler.js.map
new file mode 100644
index 0000000000..e242d8f029
--- /dev/null
+++ b/lib/commonjs/handlers/FlingGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["FlingGestureHandler.ts"],"names":["flingGestureHandlerProps","FlingGestureHandler","name","allowedProps","baseGestureHandlerProps","config"],"mappings":";;;;;;;AAAA;;AACA;;;;AAKO,MAAMA,wBAAwB,GAAG,CACtC,kBADsC,EAEtC,WAFsC,CAAjC;;AAuCP;AACO,MAAMC,mBAAmB,GAAG,4BAGjC;AACAC,EAAAA,IAAI,EAAE,qBADN;AAEAC,EAAAA,YAAY,EAAE,CACZ,GAAGC,6CADS,EAEZ,GAAGJ,wBAFS,CAFd;AAMAK,EAAAA,MAAM,EAAE;AANR,CAHiC,CAA5B","sourcesContent":["import createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const flingGestureHandlerProps = [\n 'numberOfPointers',\n 'direction',\n] as const;\n\nexport type FlingGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\nexport interface FlingGestureConfig {\n /**\n * Expressed allowed direction of movement. It's possible to pass one or many\n * directions in one parameter:\n *\n * ```js\n * direction={Directions.RIGHT | Directions.LEFT}\n * ```\n *\n * or\n *\n * ```js\n * direction={Directions.DOWN}\n * ```\n */\n direction?: number;\n\n /**\n * Determine exact number of points required to handle the fling gesture.\n */\n numberOfPointers?: number;\n}\n\nexport interface FlingGestureHandlerProps\n extends BaseGestureHandlerProps,\n FlingGestureConfig {}\n\nexport type FlingGestureHandler = typeof FlingGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const FlingGestureHandler = createHandler<\n FlingGestureHandlerProps,\n FlingGestureHandlerEventPayload\n>({\n name: 'FlingGestureHandler',\n allowedProps: [\n ...baseGestureHandlerProps,\n ...flingGestureHandlerProps,\n ] as const,\n config: {},\n});\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/ForceTouchGestureHandler.js b/lib/commonjs/handlers/ForceTouchGestureHandler.js
new file mode 100644
index 0000000000..220034cae2
--- /dev/null
+++ b/lib/commonjs/handlers/ForceTouchGestureHandler.js
@@ -0,0 +1,44 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ForceTouchGestureHandler = exports.forceTouchGestureHandlerProps = void 0;
+
+var _react = _interopRequireDefault(require("react"));
+
+var _PlatformConstants = _interopRequireDefault(require("../PlatformConstants"));
+
+var _createHandler = _interopRequireDefault(require("./createHandler"));
+
+var _gestureHandlerCommon = require("./gestureHandlerCommon");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+const forceTouchGestureHandlerProps = ['minForce', 'maxForce', 'feedbackOnActivation'];
+exports.forceTouchGestureHandlerProps = forceTouchGestureHandlerProps;
+
+class ForceTouchFallback extends _react.default.Component {
+ componentDidMount() {
+ console.warn('ForceTouchGestureHandler is not available on this platform. Please use ForceTouchGestureHandler.forceTouchAvailable to conditionally render other components that would provide a fallback behavior specific to your usecase');
+ }
+
+ render() {
+ return this.props.children;
+ }
+
+}
+
+_defineProperty(ForceTouchFallback, "forceTouchAvailable", false);
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
+const ForceTouchGestureHandler = _PlatformConstants.default !== null && _PlatformConstants.default !== void 0 && _PlatformConstants.default.forceTouchAvailable ? (0, _createHandler.default)({
+ name: 'ForceTouchGestureHandler',
+ allowedProps: [..._gestureHandlerCommon.baseGestureHandlerProps, ...forceTouchGestureHandlerProps],
+ config: {}
+}) : ForceTouchFallback;
+exports.ForceTouchGestureHandler = ForceTouchGestureHandler;
+ForceTouchGestureHandler.forceTouchAvailable = (_PlatformConstants.default === null || _PlatformConstants.default === void 0 ? void 0 : _PlatformConstants.default.forceTouchAvailable) || false;
+//# sourceMappingURL=ForceTouchGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/ForceTouchGestureHandler.js.map b/lib/commonjs/handlers/ForceTouchGestureHandler.js.map
new file mode 100644
index 0000000000..01f096530e
--- /dev/null
+++ b/lib/commonjs/handlers/ForceTouchGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["ForceTouchGestureHandler.ts"],"names":["forceTouchGestureHandlerProps","ForceTouchFallback","React","Component","componentDidMount","console","warn","render","props","children","ForceTouchGestureHandler","PlatformConstants","forceTouchAvailable","name","allowedProps","baseGestureHandlerProps","config"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAKO,MAAMA,6BAA6B,GAAG,CAC3C,UAD2C,EAE3C,UAF2C,EAG3C,sBAH2C,CAAtC;;;AAMP,MAAMC,kBAAN,SAAiCC,eAAMC,SAAvC,CAAiD;AAE/CC,EAAAA,iBAAiB,GAAG;AAClBC,IAAAA,OAAO,CAACC,IAAR,CACE,8NADF;AAGD;;AACDC,EAAAA,MAAM,GAAG;AACP,WAAO,KAAKC,KAAL,CAAWC,QAAlB;AACD;;AAT8C;;gBAA3CR,kB,yBACyB,K;;AAmD/B;AACO,MAAMS,wBAAwB,GAAGC,2GAAmBC,mBAAnB,GACpC,4BAGE;AACAC,EAAAA,IAAI,EAAE,0BADN;AAEAC,EAAAA,YAAY,EAAE,CACZ,GAAGC,6CADS,EAEZ,GAAGf,6BAFS,CAFd;AAMAgB,EAAAA,MAAM,EAAE;AANR,CAHF,CADoC,GAYpCf,kBAZG;;AAcNS,wBAAD,CAAuDE,mBAAvD,GACE,oHAAmBA,mBAAnB,KAA0C,KAD5C","sourcesContent":["import React from 'react';\nimport PlatformConstants from '../PlatformConstants';\nimport createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const forceTouchGestureHandlerProps = [\n 'minForce',\n 'maxForce',\n 'feedbackOnActivation',\n] as const;\n\nclass ForceTouchFallback extends React.Component {\n static forceTouchAvailable = false;\n componentDidMount() {\n console.warn(\n 'ForceTouchGestureHandler is not available on this platform. Please use ForceTouchGestureHandler.forceTouchAvailable to conditionally render other components that would provide a fallback behavior specific to your usecase'\n );\n }\n render() {\n return this.props.children;\n }\n}\n\nexport type ForceTouchGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n\n /**\n * The pressure of a touch.\n */\n force: number;\n};\n\nexport interface ForceTouchGestureConfig {\n /**\n *\n * A minimal pressure that is required before handler can activate. Should be a\n * value from range `[0.0, 1.0]`. Default is `0.2`.\n */\n minForce?: number;\n\n /**\n * A maximal pressure that could be applied for handler. If the pressure is\n * greater, handler fails. Should be a value from range `[0.0, 1.0]`.\n */\n maxForce?: number;\n\n /**\n * Boolean value defining if haptic feedback has to be performed on\n * activation.\n */\n feedbackOnActivation?: boolean;\n}\n\nexport interface ForceTouchGestureHandlerProps\n extends BaseGestureHandlerProps,\n ForceTouchGestureConfig {}\n\nexport type ForceTouchGestureHandler = typeof ForceTouchGestureHandler & {\n forceTouchAvailable: boolean;\n};\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const ForceTouchGestureHandler = PlatformConstants?.forceTouchAvailable\n ? createHandler<\n ForceTouchGestureHandlerProps,\n ForceTouchGestureHandlerEventPayload\n >({\n name: 'ForceTouchGestureHandler',\n allowedProps: [\n ...baseGestureHandlerProps,\n ...forceTouchGestureHandlerProps,\n ] as const,\n config: {},\n })\n : ForceTouchFallback;\n\n(ForceTouchGestureHandler as ForceTouchGestureHandler).forceTouchAvailable =\n PlatformConstants?.forceTouchAvailable || false;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/LongPressGestureHandler.js b/lib/commonjs/handlers/LongPressGestureHandler.js
new file mode 100644
index 0000000000..01747a02f1
--- /dev/null
+++ b/lib/commonjs/handlers/LongPressGestureHandler.js
@@ -0,0 +1,23 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.LongPressGestureHandler = exports.longPressGestureHandlerProps = void 0;
+
+var _createHandler = _interopRequireDefault(require("./createHandler"));
+
+var _gestureHandlerCommon = require("./gestureHandlerCommon");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const longPressGestureHandlerProps = ['minDurationMs', 'maxDist'];
+exports.longPressGestureHandlerProps = longPressGestureHandlerProps;
+// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
+const LongPressGestureHandler = (0, _createHandler.default)({
+ name: 'LongPressGestureHandler',
+ allowedProps: [..._gestureHandlerCommon.baseGestureHandlerProps, ...longPressGestureHandlerProps],
+ config: {}
+});
+exports.LongPressGestureHandler = LongPressGestureHandler;
+//# sourceMappingURL=LongPressGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/LongPressGestureHandler.js.map b/lib/commonjs/handlers/LongPressGestureHandler.js.map
new file mode 100644
index 0000000000..96f65bbbbf
--- /dev/null
+++ b/lib/commonjs/handlers/LongPressGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["LongPressGestureHandler.ts"],"names":["longPressGestureHandlerProps","LongPressGestureHandler","name","allowedProps","baseGestureHandlerProps","config"],"mappings":";;;;;;;AAAA;;AACA;;;;AAKO,MAAMA,4BAA4B,GAAG,CAC1C,eAD0C,EAE1C,SAF0C,CAArC;;AAkEP;AACO,MAAMC,uBAAuB,GAAG,4BAGrC;AACAC,EAAAA,IAAI,EAAE,yBADN;AAEAC,EAAAA,YAAY,EAAE,CACZ,GAAGC,6CADS,EAEZ,GAAGJ,4BAFS,CAFd;AAMAK,EAAAA,MAAM,EAAE;AANR,CAHqC,CAAhC","sourcesContent":["import createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const longPressGestureHandlerProps = [\n 'minDurationMs',\n 'maxDist',\n] as const;\n\nexport type LongPressGestureHandlerEventPayload = {\n /**\n * X coordinate, expressed in points, of the current position of the pointer\n * (finger or a leading pointer when there are multiple fingers placed)\n * relative to the view attached to the handler.\n */\n x: number;\n\n /**\n * Y coordinate, expressed in points, of the current position of the pointer\n * (finger or a leading pointer when there are multiple fingers placed)\n * relative to the view attached to the handler.\n */\n y: number;\n\n /**\n * X coordinate, expressed in points, of the current position of the pointer\n * (finger or a leading pointer when there are multiple fingers placed)\n * relative to the window. It is recommended to use `absoluteX` instead of\n * `x` in cases when the view attached to the handler can be transformed as an\n * effect of the gesture.\n */\n absoluteX: number;\n\n /**\n * Y coordinate, expressed in points, of the current position of the pointer\n * (finger or a leading pointer when there are multiple fingers placed)\n * relative to the window. It is recommended to use `absoluteY` instead of\n * `y` in cases when the view attached to the handler can be transformed as an\n * effect of the gesture.\n */\n absoluteY: number;\n\n /**\n * Duration of the long press (time since the start of the event), expressed\n * in milliseconds.\n */\n duration: number;\n};\n\nexport interface LongPressGestureConfig {\n /**\n * Minimum time, expressed in milliseconds, that a finger must remain pressed on\n * the corresponding view. The default value is 500.\n */\n minDurationMs?: number;\n\n /**\n * Maximum distance, expressed in points, that defines how far the finger is\n * allowed to travel during a long press gesture. If the finger travels\n * further than the defined distance and the handler hasn't yet activated, it\n * will fail to recognize the gesture. The default value is 10.\n */\n maxDist?: number;\n}\n\nexport interface LongPressGestureHandlerProps\n extends BaseGestureHandlerProps,\n LongPressGestureConfig {}\n\nexport type LongPressGestureHandler = typeof LongPressGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const LongPressGestureHandler = createHandler<\n LongPressGestureHandlerProps,\n LongPressGestureHandlerEventPayload\n>({\n name: 'LongPressGestureHandler',\n allowedProps: [\n ...baseGestureHandlerProps,\n ...longPressGestureHandlerProps,\n ] as const,\n config: {},\n});\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/NativeViewGestureHandler.js b/lib/commonjs/handlers/NativeViewGestureHandler.js
new file mode 100644
index 0000000000..f3a30de5d9
--- /dev/null
+++ b/lib/commonjs/handlers/NativeViewGestureHandler.js
@@ -0,0 +1,25 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.NativeViewGestureHandler = exports.nativeViewProps = exports.nativeViewGestureHandlerProps = void 0;
+
+var _createHandler = _interopRequireDefault(require("./createHandler"));
+
+var _gestureHandlerCommon = require("./gestureHandlerCommon");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const nativeViewGestureHandlerProps = ['shouldActivateOnStart', 'disallowInterruption'];
+exports.nativeViewGestureHandlerProps = nativeViewGestureHandlerProps;
+const nativeViewProps = [..._gestureHandlerCommon.baseGestureHandlerProps, ...nativeViewGestureHandlerProps];
+exports.nativeViewProps = nativeViewProps;
+// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
+const NativeViewGestureHandler = (0, _createHandler.default)({
+ name: 'NativeViewGestureHandler',
+ allowedProps: nativeViewProps,
+ config: {}
+});
+exports.NativeViewGestureHandler = NativeViewGestureHandler;
+//# sourceMappingURL=NativeViewGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/NativeViewGestureHandler.js.map b/lib/commonjs/handlers/NativeViewGestureHandler.js.map
new file mode 100644
index 0000000000..b2eea1ee0f
--- /dev/null
+++ b/lib/commonjs/handlers/NativeViewGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["NativeViewGestureHandler.ts"],"names":["nativeViewGestureHandlerProps","nativeViewProps","baseGestureHandlerProps","NativeViewGestureHandler","name","allowedProps","config"],"mappings":";;;;;;;AAAA;;AACA;;;;AAKO,MAAMA,6BAA6B,GAAG,CAC3C,uBAD2C,EAE3C,sBAF2C,CAAtC;;AAgCA,MAAMC,eAAe,GAAG,CAC7B,GAAGC,6CAD0B,EAE7B,GAAGF,6BAF0B,CAAxB;;AAMP;AACO,MAAMG,wBAAwB,GAAG,4BAGtC;AACAC,EAAAA,IAAI,EAAE,0BADN;AAEAC,EAAAA,YAAY,EAAEJ,eAFd;AAGAK,EAAAA,MAAM,EAAE;AAHR,CAHsC,CAAjC","sourcesContent":["import createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const nativeViewGestureHandlerProps = [\n 'shouldActivateOnStart',\n 'disallowInterruption',\n] as const;\n\nexport interface NativeViewGestureConfig {\n /**\n * Android only.\n *\n * Determines whether the handler should check for an existing touch event on\n * instantiation.\n */\n shouldActivateOnStart?: boolean;\n\n /**\n * When `true`, cancels all other gesture handlers when this\n * `NativeViewGestureHandler` receives an `ACTIVE` state event.\n */\n disallowInterruption?: boolean;\n}\n\nexport interface NativeViewGestureHandlerProps\n extends BaseGestureHandlerProps,\n NativeViewGestureConfig {}\n\nexport type NativeViewGestureHandlerPayload = {\n /**\n * True if gesture was performed inside of containing view, false otherwise.\n */\n pointerInside: boolean;\n};\n\nexport const nativeViewProps = [\n ...baseGestureHandlerProps,\n ...nativeViewGestureHandlerProps,\n] as const;\n\nexport type NativeViewGestureHandler = typeof NativeViewGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const NativeViewGestureHandler = createHandler<\n NativeViewGestureHandlerProps,\n NativeViewGestureHandlerPayload\n>({\n name: 'NativeViewGestureHandler',\n allowedProps: nativeViewProps,\n config: {},\n});\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/PanGestureHandler.js b/lib/commonjs/handlers/PanGestureHandler.js
new file mode 100644
index 0000000000..b4bb5fbe80
--- /dev/null
+++ b/lib/commonjs/handlers/PanGestureHandler.js
@@ -0,0 +1,121 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.managePanProps = managePanProps;
+exports.PanGestureHandler = exports.panGestureHandlerCustomNativeProps = exports.panGestureHandlerProps = void 0;
+
+var _createHandler = _interopRequireDefault(require("./createHandler"));
+
+var _gestureHandlerCommon = require("./gestureHandlerCommon");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const panGestureHandlerProps = ['activeOffsetY', 'activeOffsetX', 'failOffsetY', 'failOffsetX', 'minDist', 'minVelocity', 'minVelocityX', 'minVelocityY', 'minPointers', 'maxPointers', 'avgTouches', 'enableTrackpadTwoFingerGesture'];
+exports.panGestureHandlerProps = panGestureHandlerProps;
+const panGestureHandlerCustomNativeProps = ['activeOffsetYStart', 'activeOffsetYEnd', 'activeOffsetXStart', 'activeOffsetXEnd', 'failOffsetYStart', 'failOffsetYEnd', 'failOffsetXStart', 'failOffsetXEnd'];
+exports.panGestureHandlerCustomNativeProps = panGestureHandlerCustomNativeProps;
+// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
+const PanGestureHandler = (0, _createHandler.default)({
+ name: 'PanGestureHandler',
+ allowedProps: [..._gestureHandlerCommon.baseGestureHandlerProps, ...panGestureHandlerProps],
+ config: {},
+ transformProps: managePanProps,
+ customNativeProps: panGestureHandlerCustomNativeProps
+});
+exports.PanGestureHandler = PanGestureHandler;
+
+function validatePanGestureHandlerProps(props) {
+ if (Array.isArray(props.activeOffsetX) && (props.activeOffsetX[0] > 0 || props.activeOffsetX[1] < 0)) {
+ throw new Error(`First element of activeOffsetX should be negative, a the second one should be positive`);
+ }
+
+ if (Array.isArray(props.activeOffsetY) && (props.activeOffsetY[0] > 0 || props.activeOffsetY[1] < 0)) {
+ throw new Error(`First element of activeOffsetY should be negative, a the second one should be positive`);
+ }
+
+ if (Array.isArray(props.failOffsetX) && (props.failOffsetX[0] > 0 || props.failOffsetX[1] < 0)) {
+ throw new Error(`First element of failOffsetX should be negative, a the second one should be positive`);
+ }
+
+ if (Array.isArray(props.failOffsetY) && (props.failOffsetY[0] > 0 || props.failOffsetY[1] < 0)) {
+ throw new Error(`First element of failOffsetY should be negative, a the second one should be positive`);
+ }
+
+ if (props.minDist && (props.failOffsetX || props.failOffsetY)) {
+ throw new Error(`It is not supported to use minDist with failOffsetX or failOffsetY, use activeOffsetX and activeOffsetY instead`);
+ }
+
+ if (props.minDist && (props.activeOffsetX || props.activeOffsetY)) {
+ throw new Error(`It is not supported to use minDist with activeOffsetX or activeOffsetY`);
+ }
+}
+
+function transformPanGestureHandlerProps(props) {
+ const res = { ...props
+ };
+
+ if (props.activeOffsetX !== undefined) {
+ delete res.activeOffsetX;
+
+ if (Array.isArray(props.activeOffsetX)) {
+ res.activeOffsetXStart = props.activeOffsetX[0];
+ res.activeOffsetXEnd = props.activeOffsetX[1];
+ } else if (props.activeOffsetX < 0) {
+ res.activeOffsetXStart = props.activeOffsetX;
+ } else {
+ res.activeOffsetXEnd = props.activeOffsetX;
+ }
+ }
+
+ if (props.activeOffsetY !== undefined) {
+ delete res.activeOffsetY;
+
+ if (Array.isArray(props.activeOffsetY)) {
+ res.activeOffsetYStart = props.activeOffsetY[0];
+ res.activeOffsetYEnd = props.activeOffsetY[1];
+ } else if (props.activeOffsetY < 0) {
+ res.activeOffsetYStart = props.activeOffsetY;
+ } else {
+ res.activeOffsetYEnd = props.activeOffsetY;
+ }
+ }
+
+ if (props.failOffsetX !== undefined) {
+ delete res.failOffsetX;
+
+ if (Array.isArray(props.failOffsetX)) {
+ res.failOffsetXStart = props.failOffsetX[0];
+ res.failOffsetXEnd = props.failOffsetX[1];
+ } else if (props.failOffsetX < 0) {
+ res.failOffsetXStart = props.failOffsetX;
+ } else {
+ res.failOffsetXEnd = props.failOffsetX;
+ }
+ }
+
+ if (props.failOffsetY !== undefined) {
+ delete res.failOffsetY;
+
+ if (Array.isArray(props.failOffsetY)) {
+ res.failOffsetYStart = props.failOffsetY[0];
+ res.failOffsetYEnd = props.failOffsetY[1];
+ } else if (props.failOffsetY < 0) {
+ res.failOffsetYStart = props.failOffsetY;
+ } else {
+ res.failOffsetYEnd = props.failOffsetY;
+ }
+ }
+
+ return res;
+}
+
+function managePanProps(props) {
+ if (__DEV__) {
+ validatePanGestureHandlerProps(props);
+ }
+
+ return transformPanGestureHandlerProps(props);
+}
+//# sourceMappingURL=PanGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/PanGestureHandler.js.map b/lib/commonjs/handlers/PanGestureHandler.js.map
new file mode 100644
index 0000000000..c6bf45736e
--- /dev/null
+++ b/lib/commonjs/handlers/PanGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["PanGestureHandler.ts"],"names":["panGestureHandlerProps","panGestureHandlerCustomNativeProps","PanGestureHandler","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__"],"mappings":";;;;;;;;AAAA;;AACA;;;;AAKO,MAAMA,sBAAsB,GAAG,CACpC,eADoC,EAEpC,eAFoC,EAGpC,aAHoC,EAIpC,aAJoC,EAKpC,SALoC,EAMpC,aANoC,EAOpC,cAPoC,EAQpC,cARoC,EASpC,aAToC,EAUpC,aAVoC,EAWpC,YAXoC,EAYpC,gCAZoC,CAA/B;;AAeA,MAAMC,kCAAkC,GAAG,CAChD,oBADgD,EAEhD,kBAFgD,EAGhD,oBAHgD,EAIhD,kBAJgD,EAKhD,kBALgD,EAMhD,gBANgD,EAOhD,kBAPgD,EAQhD,gBARgD,CAA3C;;AAmKP;AACO,MAAMC,iBAAiB,GAAG,4BAG/B;AACAC,EAAAA,IAAI,EAAE,mBADN;AAEAC,EAAAA,YAAY,EAAE,CACZ,GAAGC,6CADS,EAEZ,GAAGL,sBAFS,CAFd;AAMAM,EAAAA,MAAM,EAAE,EANR;AAOAC,EAAAA,cAAc,EAAEC,cAPhB;AAQAC,EAAAA,iBAAiB,EAAER;AARnB,CAH+B,CAA1B;;;AAcP,SAASS,8BAAT,CAAwCC,KAAxC,EAAuE;AACrE,MACEC,KAAK,CAACC,OAAN,CAAcF,KAAK,CAACG,aAApB,MACCH,KAAK,CAACG,aAAN,CAAoB,CAApB,IAAyB,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AACM,WAAN,CAAkB,CAAlB,CAAvB;AACAI,MAAAA,GAAG,CAACO,cAAJ,GAAqBjB,KAAK,CAACM,WAAN,CAAkB,CAAlB,CAArB;AACD,KAHD,MAGO,IAAIN,KAAK,CAACM,WAAN,GAAoB,CAAxB,EAA2B;AAChCI,MAAAA,GAAG,CAACM,gBAAJ,GAAuBhB,KAAK,CAACM,WAA7B;AACD,KAFM,MAEA;AACLI,MAAAA,GAAG,CAACO,cAAJ,GAAqBjB,KAAK,CAACM,WAA3B;AACD;AACF;;AAED,MAAIN,KAAK,CAACO,WAAN,KAAsBI,SAA1B,EAAqC;AACnC,WAAOD,GAAG,CAACH,WAAX;;AACA,QAAIN,KAAK,CAACC,OAAN,CAAcF,KAAK,CAACO,WAApB,CAAJ,EAAsC;AACpCG,MAAAA,GAAG,CAACQ,gBAAJ,GAAuBlB,KAAK,CAACO,WAAN,CAAkB,CAAlB,CAAvB;AACAG,MAAAA,GAAG,CAACS,cAAJ,GAAqBnB,KAAK,CAACO,WAAN,CAAkB,CAAlB,CAArB;AACD,KAHD,MAGO,IAAIP,KAAK,CAACO,WAAN,GAAoB,CAAxB,EAA2B;AAChCG,MAAAA,GAAG,CAACQ,gBAAJ,GAAuBlB,KAAK,CAACO,WAA7B;AACD,KAFM,MAEA;AACLG,MAAAA,GAAG,CAACS,cAAJ,GAAqBnB,KAAK,CAACO,WAA3B;AACD;AACF;;AAED,SAAOG,GAAP;AACD;;AAEM,SAASb,cAAT,CAAwBG,KAAxB,EAAuD;AAC5D,MAAIoB,OAAJ,EAAa;AACXrB,IAAAA,8BAA8B,CAACC,KAAD,CAA9B;AACD;;AACD,SAAOS,+BAA+B,CAACT,KAAD,CAAtC;AACD","sourcesContent":["import createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const panGestureHandlerProps = [\n 'activeOffsetY',\n 'activeOffsetX',\n 'failOffsetY',\n 'failOffsetX',\n 'minDist',\n 'minVelocity',\n 'minVelocityX',\n 'minVelocityY',\n 'minPointers',\n 'maxPointers',\n 'avgTouches',\n 'enableTrackpadTwoFingerGesture',\n] as const;\n\nexport const panGestureHandlerCustomNativeProps = [\n 'activeOffsetYStart',\n 'activeOffsetYEnd',\n 'activeOffsetXStart',\n 'activeOffsetXEnd',\n 'failOffsetYStart',\n 'failOffsetYEnd',\n 'failOffsetXStart',\n 'failOffsetXEnd',\n] as const;\n\nexport type PanGestureHandlerEventPayload = {\n /**\n * X coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the view\n * attached to the handler. Expressed in point units.\n */\n x: number;\n\n /**\n * Y coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the view\n * attached to the handler. Expressed in point units.\n */\n y: number;\n\n /**\n * X coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the window.\n * The value is expressed in point units. It is recommended to use it instead\n * of `x` in cases when the original view can be transformed as an effect of\n * the gesture.\n */\n absoluteX: number;\n\n /**\n * Y coordinate of the current position of the pointer (finger or a leading\n * pointer when there are multiple fingers placed) relative to the window.\n * The value is expressed in point units. It is recommended to use it instead\n * of `y` in cases when the original view can be transformed as an\n * effect of the gesture.\n */\n absoluteY: number;\n\n /**\n * Translation of the pan gesture along X axis accumulated over the time of\n * the gesture. The value is expressed in the point units.\n */\n translationX: number;\n\n /**\n * Translation of the pan gesture along Y axis accumulated over the time of\n * the gesture. The value is expressed in the point units.\n */\n translationY: number;\n\n /**\n * Velocity of the pan gesture along the X axis in the current moment. The\n * value is expressed in point units per second.\n */\n velocityX: number;\n\n /**\n * Velocity of the pan gesture along the Y axis in the current moment. The\n * value is expressed in point units per second.\n */\n velocityY: number;\n};\n\ninterface CommonPanProperties {\n /**\n * Minimum distance the finger (or multiple finger) need to travel before the\n * handler activates. Expressed in points.\n */\n minDist?: number;\n\n /**\n * Android only.\n */\n avgTouches?: boolean;\n\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * enableTrackpadTwoFingerGesture swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n /**\n * A number of fingers that is required to be placed before handler can\n * activate. Should be a higher or equal to 0 integer.\n */\n minPointers?: number;\n\n /**\n * When the given number of fingers is placed on the screen and handler hasn't\n * yet activated it will fail recognizing the gesture. Should be a higher or\n * equal to 0 integer.\n */\n maxPointers?: number;\n\n minVelocity?: number;\n minVelocityX?: number;\n minVelocityY?: number;\n}\n\nexport interface PanGestureConfig extends CommonPanProperties {\n activeOffsetYStart?: number;\n activeOffsetYEnd?: number;\n activeOffsetXStart?: number;\n activeOffsetXEnd?: number;\n failOffsetYStart?: number;\n failOffsetYEnd?: number;\n failOffsetXStart?: number;\n failOffsetXEnd?: number;\n}\n\nexport interface PanGestureHandlerProps\n extends BaseGestureHandlerProps,\n CommonPanProperties {\n /**\n * Range along X axis (in points) where fingers travels without activation of\n * handler. Moving outside of this range implies activation of handler. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n activeOffsetY?: number | number[];\n\n /**\n * Range along X axis (in points) where fingers travels without activation of\n * handler. Moving outside of this range implies activation of handler. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n activeOffsetX?: number | number[];\n\n /**\n * When the finger moves outside this range (in points) along Y axis and\n * handler hasn't yet activated it will fail recognizing the gesture. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n failOffsetY?: number | number[];\n\n /**\n * When the finger moves outside this range (in points) along X axis and\n * handler hasn't yet activated it will fail recognizing the gesture. Range\n * can be given as an array or a single number. If range is set as an array,\n * first value must be lower or equal to 0, a the second one higher or equal\n * to 0. If only one number `p` is given a range of `(-inf, p)` will be used\n * if `p` is higher or equal to 0 and `(-p, inf)` otherwise.\n */\n failOffsetX?: number | number[];\n}\n\nexport type PanGestureHandler = typeof PanGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const PanGestureHandler = createHandler<\n PanGestureHandlerProps,\n PanGestureHandlerEventPayload\n>({\n name: 'PanGestureHandler',\n allowedProps: [\n ...baseGestureHandlerProps,\n ...panGestureHandlerProps,\n ] as const,\n config: {},\n transformProps: managePanProps,\n customNativeProps: panGestureHandlerCustomNativeProps,\n});\n\nfunction validatePanGestureHandlerProps(props: PanGestureHandlerProps) {\n if (\n Array.isArray(props.activeOffsetX) &&\n (props.activeOffsetX[0] > 0 || props.activeOffsetX[1] < 0)\n ) {\n throw new Error(\n `First element of activeOffsetX should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.activeOffsetY) &&\n (props.activeOffsetY[0] > 0 || props.activeOffsetY[1] < 0)\n ) {\n throw new Error(\n `First element of activeOffsetY should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.failOffsetX) &&\n (props.failOffsetX[0] > 0 || props.failOffsetX[1] < 0)\n ) {\n throw new Error(\n `First element of failOffsetX should be negative, a the second one should be positive`\n );\n }\n\n if (\n Array.isArray(props.failOffsetY) &&\n (props.failOffsetY[0] > 0 || props.failOffsetY[1] < 0)\n ) {\n throw new Error(\n `First element of failOffsetY should be negative, a the second one should be positive`\n );\n }\n\n if (props.minDist && (props.failOffsetX || props.failOffsetY)) {\n throw new Error(\n `It is not supported to use minDist with failOffsetX or failOffsetY, use activeOffsetX and activeOffsetY instead`\n );\n }\n\n if (props.minDist && (props.activeOffsetX || props.activeOffsetY)) {\n throw new Error(\n `It is not supported to use minDist with activeOffsetX or activeOffsetY`\n );\n }\n}\n\nfunction transformPanGestureHandlerProps(props: PanGestureHandlerProps) {\n type InternalPanGHKeys =\n | 'activeOffsetXStart'\n | 'activeOffsetXEnd'\n | 'failOffsetXStart'\n | 'failOffsetXEnd'\n | 'activeOffsetYStart'\n | 'activeOffsetYEnd'\n | 'failOffsetYStart'\n | 'failOffsetYEnd';\n type PanGestureHandlerInternalProps = PanGestureHandlerProps &\n Partial>;\n\n const res: PanGestureHandlerInternalProps = { ...props };\n\n if (props.activeOffsetX !== undefined) {\n delete res.activeOffsetX;\n if (Array.isArray(props.activeOffsetX)) {\n res.activeOffsetXStart = props.activeOffsetX[0];\n res.activeOffsetXEnd = props.activeOffsetX[1];\n } else if (props.activeOffsetX < 0) {\n res.activeOffsetXStart = props.activeOffsetX;\n } else {\n res.activeOffsetXEnd = props.activeOffsetX;\n }\n }\n\n if (props.activeOffsetY !== undefined) {\n delete res.activeOffsetY;\n if (Array.isArray(props.activeOffsetY)) {\n res.activeOffsetYStart = props.activeOffsetY[0];\n res.activeOffsetYEnd = props.activeOffsetY[1];\n } else if (props.activeOffsetY < 0) {\n res.activeOffsetYStart = props.activeOffsetY;\n } else {\n res.activeOffsetYEnd = props.activeOffsetY;\n }\n }\n\n if (props.failOffsetX !== undefined) {\n delete res.failOffsetX;\n if (Array.isArray(props.failOffsetX)) {\n res.failOffsetXStart = props.failOffsetX[0];\n res.failOffsetXEnd = props.failOffsetX[1];\n } else if (props.failOffsetX < 0) {\n res.failOffsetXStart = props.failOffsetX;\n } else {\n res.failOffsetXEnd = props.failOffsetX;\n }\n }\n\n if (props.failOffsetY !== undefined) {\n delete res.failOffsetY;\n if (Array.isArray(props.failOffsetY)) {\n res.failOffsetYStart = props.failOffsetY[0];\n res.failOffsetYEnd = props.failOffsetY[1];\n } else if (props.failOffsetY < 0) {\n res.failOffsetYStart = props.failOffsetY;\n } else {\n res.failOffsetYEnd = props.failOffsetY;\n }\n }\n\n return res;\n}\n\nexport function managePanProps(props: PanGestureHandlerProps) {\n if (__DEV__) {\n validatePanGestureHandlerProps(props);\n }\n return transformPanGestureHandlerProps(props);\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/PinchGestureHandler.js b/lib/commonjs/handlers/PinchGestureHandler.js
new file mode 100644
index 0000000000..d11d596f7a
--- /dev/null
+++ b/lib/commonjs/handlers/PinchGestureHandler.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.PinchGestureHandler = void 0;
+
+var _createHandler = _interopRequireDefault(require("./createHandler"));
+
+var _gestureHandlerCommon = require("./gestureHandlerCommon");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
+const PinchGestureHandler = (0, _createHandler.default)({
+ name: 'PinchGestureHandler',
+ allowedProps: _gestureHandlerCommon.baseGestureHandlerProps,
+ config: {}
+});
+exports.PinchGestureHandler = PinchGestureHandler;
+//# sourceMappingURL=PinchGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/PinchGestureHandler.js.map b/lib/commonjs/handlers/PinchGestureHandler.js.map
new file mode 100644
index 0000000000..c0390e5f41
--- /dev/null
+++ b/lib/commonjs/handlers/PinchGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["PinchGestureHandler.ts"],"names":["PinchGestureHandler","name","allowedProps","baseGestureHandlerProps","config"],"mappings":";;;;;;;AAAA;;AACA;;;;AAoCA;AACO,MAAMA,mBAAmB,GAAG,4BAGjC;AACAC,EAAAA,IAAI,EAAE,qBADN;AAEAC,EAAAA,YAAY,EAAEC,6CAFd;AAGAC,EAAAA,MAAM,EAAE;AAHR,CAHiC,CAA5B","sourcesContent":["import createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport type PinchGestureHandlerEventPayload = {\n /**\n * The scale factor relative to the points of the two touches in screen\n * coordinates.\n */\n scale: number;\n\n /**\n * Position expressed in points along X axis of center anchor point of\n * gesture.\n */\n focalX: number;\n\n /**\n * Position expressed in points along Y axis of center anchor point of\n * gesture.\n */\n focalY: number;\n\n /**\n *\n * Velocity of the pan gesture the current moment. The value is expressed in\n * point units per second.\n */\n velocity: number;\n};\n\nexport interface PinchGestureHandlerProps\n extends BaseGestureHandlerProps {}\n\nexport type PinchGestureHandler = typeof PinchGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const PinchGestureHandler = createHandler<\n PinchGestureHandlerProps,\n PinchGestureHandlerEventPayload\n>({\n name: 'PinchGestureHandler',\n allowedProps: baseGestureHandlerProps,\n config: {},\n});\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/RotationGestureHandler.js b/lib/commonjs/handlers/RotationGestureHandler.js
new file mode 100644
index 0000000000..60f8e35ebd
--- /dev/null
+++ b/lib/commonjs/handlers/RotationGestureHandler.js
@@ -0,0 +1,21 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.RotationGestureHandler = void 0;
+
+var _createHandler = _interopRequireDefault(require("./createHandler"));
+
+var _gestureHandlerCommon = require("./gestureHandlerCommon");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
+const RotationGestureHandler = (0, _createHandler.default)({
+ name: 'RotationGestureHandler',
+ allowedProps: _gestureHandlerCommon.baseGestureHandlerProps,
+ config: {}
+});
+exports.RotationGestureHandler = RotationGestureHandler;
+//# sourceMappingURL=RotationGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/RotationGestureHandler.js.map b/lib/commonjs/handlers/RotationGestureHandler.js.map
new file mode 100644
index 0000000000..5e76ef56b1
--- /dev/null
+++ b/lib/commonjs/handlers/RotationGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["RotationGestureHandler.ts"],"names":["RotationGestureHandler","name","allowedProps","baseGestureHandlerProps","config"],"mappings":";;;;;;;AAAA;;AACA;;;;AAoCA;AACO,MAAMA,sBAAsB,GAAG,4BAGpC;AACAC,EAAAA,IAAI,EAAE,wBADN;AAEAC,EAAAA,YAAY,EAAEC,6CAFd;AAGAC,EAAAA,MAAM,EAAE;AAHR,CAHoC,CAA/B","sourcesContent":["import createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport type RotationGestureHandlerEventPayload = {\n /**\n * Amount rotated, expressed in radians, from the gesture's focal point\n * (anchor).\n */\n rotation: number;\n\n /**\n * X coordinate, expressed in points, of the gesture's central focal point\n * (anchor).\n */\n anchorX: number;\n\n /**\n * Y coordinate, expressed in points, of the gesture's central focal point\n * (anchor).\n */\n anchorY: number;\n\n /**\n *\n * Instantaneous velocity, expressed in point units per second, of the\n * gesture.\n */\n velocity: number;\n};\n\nexport interface RotationGestureHandlerProps\n extends BaseGestureHandlerProps {}\n\nexport type RotationGestureHandler = typeof RotationGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const RotationGestureHandler = createHandler<\n RotationGestureHandlerProps,\n RotationGestureHandlerEventPayload\n>({\n name: 'RotationGestureHandler',\n allowedProps: baseGestureHandlerProps,\n config: {},\n});\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/TapGestureHandler.js b/lib/commonjs/handlers/TapGestureHandler.js
new file mode 100644
index 0000000000..2695e85cd3
--- /dev/null
+++ b/lib/commonjs/handlers/TapGestureHandler.js
@@ -0,0 +1,23 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.TapGestureHandler = exports.tapGestureHandlerProps = void 0;
+
+var _createHandler = _interopRequireDefault(require("./createHandler"));
+
+var _gestureHandlerCommon = require("./gestureHandlerCommon");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const tapGestureHandlerProps = ['maxDurationMs', 'maxDelayMs', 'numberOfTaps', 'maxDeltaX', 'maxDeltaY', 'maxDist', 'minPointers'];
+exports.tapGestureHandlerProps = tapGestureHandlerProps;
+// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file
+const TapGestureHandler = (0, _createHandler.default)({
+ name: 'TapGestureHandler',
+ allowedProps: [..._gestureHandlerCommon.baseGestureHandlerProps, ...tapGestureHandlerProps],
+ config: {}
+});
+exports.TapGestureHandler = TapGestureHandler;
+//# sourceMappingURL=TapGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/TapGestureHandler.js.map b/lib/commonjs/handlers/TapGestureHandler.js.map
new file mode 100644
index 0000000000..5b05052ab5
--- /dev/null
+++ b/lib/commonjs/handlers/TapGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["TapGestureHandler.ts"],"names":["tapGestureHandlerProps","TapGestureHandler","name","allowedProps","baseGestureHandlerProps","config"],"mappings":";;;;;;;AAAA;;AACA;;;;AAKO,MAAMA,sBAAsB,GAAG,CACpC,eADoC,EAEpC,YAFoC,EAGpC,cAHoC,EAIpC,WAJoC,EAKpC,WALoC,EAMpC,SANoC,EAOpC,aAPoC,CAA/B;;AAwEP;AACO,MAAMC,iBAAiB,GAAG,4BAG/B;AACAC,EAAAA,IAAI,EAAE,mBADN;AAEAC,EAAAA,YAAY,EAAE,CACZ,GAAGC,6CADS,EAEZ,GAAGJ,sBAFS,CAFd;AAMAK,EAAAA,MAAM,EAAE;AANR,CAH+B,CAA1B","sourcesContent":["import createHandler from './createHandler';\nimport {\n BaseGestureHandlerProps,\n baseGestureHandlerProps,\n} from './gestureHandlerCommon';\n\nexport const tapGestureHandlerProps = [\n 'maxDurationMs',\n 'maxDelayMs',\n 'numberOfTaps',\n 'maxDeltaX',\n 'maxDeltaY',\n 'maxDist',\n 'minPointers',\n] as const;\n\nexport type TapGestureHandlerEventPayload = {\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\nexport interface TapGestureConfig {\n /**\n * Minimum number of pointers (fingers) required to be placed before the\n * handler activates. Should be a positive integer.\n * The default value is 1.\n */\n minPointers?: number;\n\n /**\n * Maximum time, expressed in milliseconds, that defines how fast a finger\n * must be released after a touch. The default value is 500.\n */\n maxDurationMs?: number;\n\n /**\n * Maximum time, expressed in milliseconds, that can pass before the next tap\n * if many taps are required. The default value is 500.\n */\n maxDelayMs?: number;\n\n /**\n * Number of tap gestures required to activate the handler. The default value\n * is 1.\n */\n numberOfTaps?: number;\n\n /**\n * Maximum distance, expressed in points, that defines how far the finger is\n * allowed to travel along the X axis during a tap gesture. If the finger\n * travels further than the defined distance along the X axis and the handler\n * hasn't yet activated, it will fail to recognize the gesture.\n */\n maxDeltaX?: number;\n\n /**\n * Maximum distance, expressed in points, that defines how far the finger is\n * allowed to travel along the Y axis during a tap gesture. If the finger\n * travels further than the defined distance along the Y axis and the handler\n * hasn't yet activated, it will fail to recognize the gesture.\n */\n maxDeltaY?: number;\n\n /**\n * Maximum distance, expressed in points, that defines how far the finger is\n * allowed to travel during a tap gesture. If the finger travels further than\n * the defined distance and the handler hasn't yet\n * activated, it will fail to recognize the gesture.\n */\n maxDist?: number;\n}\n\nexport interface TapGestureHandlerProps\n extends BaseGestureHandlerProps,\n TapGestureConfig {}\n\nexport type TapGestureHandler = typeof TapGestureHandler;\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; see description on the top of gestureHandlerCommon.ts file\nexport const TapGestureHandler = createHandler<\n TapGestureHandlerProps,\n TapGestureHandlerEventPayload\n>({\n name: 'TapGestureHandler',\n allowedProps: [\n ...baseGestureHandlerProps,\n ...tapGestureHandlerProps,\n ] as const,\n config: {},\n});\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/createHandler.js b/lib/commonjs/handlers/createHandler.js
new file mode 100644
index 0000000000..cdcec8975e
--- /dev/null
+++ b/lib/commonjs/handlers/createHandler.js
@@ -0,0 +1,385 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = createHandler;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _reactNative = require("react-native");
+
+var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
+
+var _RNGestureHandlerModule = _interopRequireDefault(require("../RNGestureHandlerModule"));
+
+var _State = require("../State");
+
+var _handlersRegistry = require("./handlersRegistry");
+
+var _gestureHandlerCommon = require("./gestureHandlerCommon");
+
+var _UIManagerAny$getView, _UIManagerAny$getView2, _UIManagerAny$getCons;
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+const UIManagerAny = _reactNative.UIManager;
+const customGHEventsConfig = {
+ onGestureHandlerEvent: {
+ registrationName: 'onGestureHandlerEvent'
+ },
+ onGestureHandlerStateChange: {
+ registrationName: 'onGestureHandlerStateChange'
+ }
+}; // Add gesture specific events to genericDirectEventTypes object exported from UIManager
+// native module.
+// Once new event types are registered with react it is possible to dispatch these
+// events to all kind of native views.
+
+UIManagerAny.genericDirectEventTypes = { ...UIManagerAny.genericDirectEventTypes,
+ ...customGHEventsConfig
+}; // In newer versions of RN the `genericDirectEventTypes` is located in the object
+// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make
+// it compatible with RN 61+
+
+const UIManagerConstants = (_UIManagerAny$getView = (_UIManagerAny$getView2 = UIManagerAny.getViewManagerConfig) === null || _UIManagerAny$getView2 === void 0 ? void 0 : _UIManagerAny$getView2.call(UIManagerAny, 'getConstants')) !== null && _UIManagerAny$getView !== void 0 ? _UIManagerAny$getView : (_UIManagerAny$getCons = UIManagerAny.getConstants) === null || _UIManagerAny$getCons === void 0 ? void 0 : _UIManagerAny$getCons.call(UIManagerAny);
+
+if (UIManagerConstants) {
+ UIManagerConstants.genericDirectEventTypes = { ...UIManagerConstants.genericDirectEventTypes,
+ ...customGHEventsConfig
+ };
+} // Wrap JS responder calls and notify gesture handler manager
+
+
+const {
+ setJSResponder: oldSetJSResponder = () => {//no operation
+ },
+ clearJSResponder: oldClearJSResponder = () => {//no operation
+ }
+} = UIManagerAny;
+
+UIManagerAny.setJSResponder = (tag, blockNativeResponder) => {
+ _RNGestureHandlerModule.default.handleSetJSResponder(tag, blockNativeResponder);
+
+ oldSetJSResponder(tag, blockNativeResponder);
+};
+
+UIManagerAny.clearJSResponder = () => {
+ _RNGestureHandlerModule.default.handleClearJSResponder();
+
+ oldClearJSResponder();
+};
+
+let allowTouches = true;
+const DEV_ON_ANDROID = __DEV__ && _reactNative.Platform.OS === 'android'; // Toggled inspector blocks touch events in order to allow inspecting on Android
+// This needs to be a global variable in order to set initial state for `allowTouches` property in Handler component
+
+if (DEV_ON_ANDROID) {
+ _reactNative.DeviceEventEmitter.addListener('toggleElementInspector', () => {
+ allowTouches = !allowTouches;
+ });
+}
+
+function hasUnresolvedRefs(props) {
+ // TODO(TS) - add type for extract arg
+ const extract = refs => {
+ if (!Array.isArray(refs)) {
+ return refs && refs.current === null;
+ }
+
+ return refs.some(r => r && r.current === null);
+ };
+
+ return extract(props['simultaneousHandlers']) || extract(props['waitFor']);
+}
+
+const stateToPropMappings = {
+ [_State.State.UNDETERMINED]: undefined,
+ [_State.State.BEGAN]: 'onBegan',
+ [_State.State.FAILED]: 'onFailed',
+ [_State.State.CANCELLED]: 'onCancelled',
+ [_State.State.ACTIVE]: 'onActivated',
+ [_State.State.END]: 'onEnded'
+};
+let showedRngh2Notice = false;
+
+function showRngh2NoticeIfNeeded() {
+ if (!showedRngh2Notice) {
+ console.warn("[react-native-gesture-handler] Seems like you're using an old API with gesture components, check out new Gestures system!");
+ showedRngh2Notice = true;
+ }
+} // TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
+
+
+function createHandler({
+ name,
+ allowedProps = [],
+ config = {},
+ transformProps,
+ customNativeProps = []
+}) {
+ class Handler extends React.Component {
+ constructor(props) {
+ super(props);
+
+ _defineProperty(this, "handlerTag", void 0);
+
+ _defineProperty(this, "config", void 0);
+
+ _defineProperty(this, "propsRef", void 0);
+
+ _defineProperty(this, "viewNode", void 0);
+
+ _defineProperty(this, "viewTag", void 0);
+
+ _defineProperty(this, "updateEnqueued", null);
+
+ _defineProperty(this, "inspectorToggleListener", void 0);
+
+ _defineProperty(this, "onGestureHandlerEvent", event => {
+ if (event.nativeEvent.handlerTag === this.handlerTag) {
+ var _this$props$onGesture, _this$props;
+
+ (_this$props$onGesture = (_this$props = this.props).onGestureEvent) === null || _this$props$onGesture === void 0 ? void 0 : _this$props$onGesture.call(_this$props, event);
+ } else {
+ var _this$props$onGesture2, _this$props2;
+
+ (_this$props$onGesture2 = (_this$props2 = this.props).onGestureHandlerEvent) === null || _this$props$onGesture2 === void 0 ? void 0 : _this$props$onGesture2.call(_this$props2, event);
+ }
+ });
+
+ _defineProperty(this, "onGestureHandlerStateChange", event => {
+ if (event.nativeEvent.handlerTag === this.handlerTag) {
+ var _this$props$onHandler, _this$props3;
+
+ (_this$props$onHandler = (_this$props3 = this.props).onHandlerStateChange) === null || _this$props$onHandler === void 0 ? void 0 : _this$props$onHandler.call(_this$props3, event);
+ const state = event.nativeEvent.state;
+ const stateEventName = stateToPropMappings[state];
+ const eventHandler = stateEventName && this.props[stateEventName];
+
+ if (eventHandler && typeof eventHandler === 'function') {
+ eventHandler(event);
+ }
+ } else {
+ var _this$props$onGesture3, _this$props4;
+
+ (_this$props$onGesture3 = (_this$props4 = this.props).onGestureHandlerStateChange) === null || _this$props$onGesture3 === void 0 ? void 0 : _this$props$onGesture3.call(_this$props4, event);
+ }
+ });
+
+ _defineProperty(this, "refHandler", node => {
+ this.viewNode = node;
+ const child = React.Children.only(this.props.children); // TODO(TS) fix ref type
+
+ const {
+ ref
+ } = child;
+
+ if (ref !== null) {
+ if (typeof ref === 'function') {
+ ref(node);
+ } else {
+ ref.current = node;
+ }
+ }
+ });
+
+ _defineProperty(this, "createGestureHandler", newConfig => {
+ this.config = newConfig;
+
+ _RNGestureHandlerModule.default.createGestureHandler(name, this.handlerTag, newConfig);
+ });
+
+ _defineProperty(this, "attachGestureHandler", newViewTag => {
+ this.viewTag = newViewTag;
+
+ if (_reactNative.Platform.OS === 'web') {
+ // typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch
+ _RNGestureHandlerModule.default.attachGestureHandler(this.handlerTag, newViewTag, false, this.propsRef);
+ } else {
+ _RNGestureHandlerModule.default.attachGestureHandler(this.handlerTag, newViewTag, false);
+ }
+ });
+
+ _defineProperty(this, "updateGestureHandler", newConfig => {
+ this.config = newConfig;
+
+ _RNGestureHandlerModule.default.updateGestureHandler(this.handlerTag, newConfig);
+ });
+
+ this.handlerTag = (0, _handlersRegistry.getNextHandlerTag)();
+ this.config = {};
+ this.propsRef = /*#__PURE__*/React.createRef();
+ this.state = {
+ allowTouches
+ };
+
+ if (props.id) {
+ if (_handlersRegistry.handlerIDToTag[props.id] !== undefined) {
+ throw new Error(`Handler with ID "${props.id}" already registered`);
+ }
+
+ _handlersRegistry.handlerIDToTag[props.id] = this.handlerTag;
+ }
+
+ if (__DEV__) {
+ showRngh2NoticeIfNeeded();
+ }
+ }
+
+ componentDidMount() {
+ const props = this.props;
+
+ if (DEV_ON_ANDROID) {
+ this.inspectorToggleListener = _reactNative.DeviceEventEmitter.addListener('toggleElementInspector', () => {
+ this.setState(_ => ({
+ allowTouches
+ }));
+ this.update();
+ });
+ }
+
+ if (hasUnresolvedRefs(props)) {
+ // If there are unresolved refs (e.g. ".current" has not yet been set)
+ // passed as `simultaneousHandlers` or `waitFor`, we enqueue a call to
+ // _update method that will try to update native handler props using
+ // setImmediate. This makes it so update() function gets called after all
+ // react components are mounted and we expect the missing ref object to
+ // be resolved by then.
+ this.updateEnqueued = setImmediate(() => {
+ this.updateEnqueued = null;
+ this.update();
+ });
+ }
+
+ this.createGestureHandler((0, _gestureHandlerCommon.filterConfig)(transformProps ? transformProps(this.props) : this.props, [...allowedProps, ...customNativeProps], config));
+ this.attachGestureHandler((0, _gestureHandlerCommon.findNodeHandle)(this.viewNode)); // TODO(TS) - check if this can be null
+ }
+
+ componentDidUpdate() {
+ const viewTag = (0, _gestureHandlerCommon.findNodeHandle)(this.viewNode);
+
+ if (this.viewTag !== viewTag) {
+ this.attachGestureHandler(viewTag); // TODO(TS) - check interaction between _viewTag & findNodeHandle
+ }
+
+ this.update();
+ }
+
+ componentWillUnmount() {
+ var _this$inspectorToggle;
+
+ (_this$inspectorToggle = this.inspectorToggleListener) === null || _this$inspectorToggle === void 0 ? void 0 : _this$inspectorToggle.remove();
+
+ _RNGestureHandlerModule.default.dropGestureHandler(this.handlerTag);
+
+ if (this.updateEnqueued) {
+ clearImmediate(this.updateEnqueued);
+ } // We can't use this.props.id directly due to TS generic type narrowing bug, see https://github.com/microsoft/TypeScript/issues/13995 for more context
+
+
+ const handlerID = this.props.id;
+
+ if (handlerID) {
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
+ delete _handlersRegistry.handlerIDToTag[handlerID];
+ }
+ }
+
+ update() {
+ const newConfig = (0, _gestureHandlerCommon.filterConfig)(transformProps ? transformProps(this.props) : this.props, [...allowedProps, ...customNativeProps], config);
+
+ if (!(0, _isEqual.default)(this.config, newConfig)) {
+ this.updateGestureHandler(newConfig);
+ }
+ }
+
+ setNativeProps(updates) {
+ const mergedProps = { ...this.props,
+ ...updates
+ };
+ const newConfig = (0, _gestureHandlerCommon.filterConfig)(transformProps ? transformProps(mergedProps) : mergedProps, [...allowedProps, ...customNativeProps], config);
+ this.updateGestureHandler(newConfig);
+ }
+
+ render() {
+ let gestureEventHandler = this.onGestureHandlerEvent; // Another instance of https://github.com/microsoft/TypeScript/issues/13995
+
+ const {
+ onGestureEvent,
+ onGestureHandlerEvent
+ } = this.props;
+
+ if (onGestureEvent && typeof onGestureEvent !== 'function') {
+ // If it's not a method it should be an native Animated.event
+ // object. We set it directly as the handler for the view
+ // In this case nested handlers are not going to be supported
+ if (onGestureHandlerEvent) {
+ throw new Error('Nesting touch handlers with native animated driver is not supported yet');
+ }
+
+ gestureEventHandler = onGestureEvent;
+ } else {
+ if (onGestureHandlerEvent && typeof onGestureHandlerEvent !== 'function') {
+ throw new Error('Nesting touch handlers with native animated driver is not supported yet');
+ }
+ }
+
+ let gestureStateEventHandler = this.onGestureHandlerStateChange; // Another instance of https://github.com/microsoft/TypeScript/issues/13995
+
+ const {
+ onHandlerStateChange,
+ onGestureHandlerStateChange
+ } = this.props;
+
+ if (onHandlerStateChange && typeof onHandlerStateChange !== 'function') {
+ // If it's not a method it should be an native Animated.event
+ // object. We set it directly as the handler for the view
+ // In this case nested handlers are not going to be supported
+ if (onGestureHandlerStateChange) {
+ throw new Error('Nesting touch handlers with native animated driver is not supported yet');
+ }
+
+ gestureStateEventHandler = onHandlerStateChange;
+ } else {
+ if (onGestureHandlerStateChange && typeof onGestureHandlerStateChange !== 'function') {
+ throw new Error('Nesting touch handlers with native animated driver is not supported yet');
+ }
+ }
+
+ const events = {
+ onGestureHandlerEvent: this.state.allowTouches ? gestureEventHandler : undefined,
+ onGestureHandlerStateChange: this.state.allowTouches ? gestureStateEventHandler : undefined
+ };
+ this.propsRef.current = events;
+ const child = React.Children.only(this.props.children);
+ let grandChildren = child.props.children;
+
+ if (_reactNative.Touchable.TOUCH_TARGET_DEBUG && child.type && (child.type === 'RNGestureHandlerButton' || child.type.name === 'View' || child.type.displayName === 'View')) {
+ grandChildren = React.Children.toArray(grandChildren);
+ grandChildren.push(_reactNative.Touchable.renderDebugView({
+ color: 'mediumspringgreen',
+ hitSlop: child.props.hitSlop
+ }));
+ }
+
+ return /*#__PURE__*/React.cloneElement(child, {
+ ref: this.refHandler,
+ collapsable: false,
+ ...events
+ }, grandChildren);
+ }
+
+ }
+
+ _defineProperty(Handler, "displayName", name);
+
+ return Handler;
+}
+//# sourceMappingURL=createHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/createHandler.js.map b/lib/commonjs/handlers/createHandler.js.map
new file mode 100644
index 0000000000..25437e2a1e
--- /dev/null
+++ b/lib/commonjs/handlers/createHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["createHandler.ts"],"names":["UIManagerAny","UIManager","customGHEventsConfig","onGestureHandlerEvent","registrationName","onGestureHandlerStateChange","genericDirectEventTypes","UIManagerConstants","getViewManagerConfig","getConstants","setJSResponder","oldSetJSResponder","clearJSResponder","oldClearJSResponder","tag","blockNativeResponder","RNGestureHandlerModule","handleSetJSResponder","handleClearJSResponder","allowTouches","DEV_ON_ANDROID","__DEV__","Platform","OS","DeviceEventEmitter","addListener","hasUnresolvedRefs","props","extract","refs","Array","isArray","current","some","r","stateToPropMappings","State","UNDETERMINED","undefined","BEGAN","FAILED","CANCELLED","ACTIVE","END","showedRngh2Notice","showRngh2NoticeIfNeeded","console","warn","createHandler","name","allowedProps","config","transformProps","customNativeProps","Handler","React","Component","constructor","event","nativeEvent","handlerTag","onGestureEvent","onHandlerStateChange","state","stateEventName","eventHandler","node","viewNode","child","Children","only","children","ref","newConfig","createGestureHandler","newViewTag","viewTag","attachGestureHandler","propsRef","updateGestureHandler","createRef","id","handlerIDToTag","Error","componentDidMount","inspectorToggleListener","setState","_","update","updateEnqueued","setImmediate","componentDidUpdate","componentWillUnmount","remove","dropGestureHandler","clearImmediate","handlerID","setNativeProps","updates","mergedProps","render","gestureEventHandler","gestureStateEventHandler","events","grandChildren","Touchable","TOUCH_TARGET_DEBUG","type","displayName","toArray","push","renderDebugView","color","hitSlop","cloneElement","refHandler","collapsable"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AAEA;;AACA;;AAEA;;;;;;;;;;;;AASA,MAAMA,YAAY,GAAGC,sBAArB;AAEA,MAAMC,oBAAoB,GAAG;AAC3BC,EAAAA,qBAAqB,EAAE;AAAEC,IAAAA,gBAAgB,EAAE;AAApB,GADI;AAE3BC,EAAAA,2BAA2B,EAAE;AAC3BD,IAAAA,gBAAgB,EAAE;AADS;AAFF,CAA7B,C,CAOA;AACA;AACA;AACA;;AACAJ,YAAY,CAACM,uBAAb,GAAuC,EACrC,GAAGN,YAAY,CAACM,uBADqB;AAErC,KAAGJ;AAFkC,CAAvC,C,CAIA;AACA;AACA;;AACA,MAAMK,kBAAkB,sDACtBP,YAAY,CAACQ,oBADS,2DACtB,4BAAAR,YAAY,EAAwB,cAAxB,CADU,kGAEtBA,YAAY,CAACS,YAFS,0DAEtB,2BAAAT,YAAY,CAFd;;AAIA,IAAIO,kBAAJ,EAAwB;AACtBA,EAAAA,kBAAkB,CAACD,uBAAnB,GAA6C,EAC3C,GAAGC,kBAAkB,CAACD,uBADqB;AAE3C,OAAGJ;AAFwC,GAA7C;AAID,C,CAED;;;AACA,MAAM;AACJQ,EAAAA,cAAc,EAAEC,iBAAiB,GAAG,MAAM,CACxC;AACD,GAHG;AAIJC,EAA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BhE;AANS,OAAf;AASA,WAAKwC,QAAL,CAAc9C,OAAd,GAAwBuE,MAAxB;AAEA,YAAMnC,KAAU,GAAGb,KAAK,CAACc,QAAN,CAAeC,IAAf,CAAoB,KAAK3C,KAAL,CAAW4C,QAA/B,CAAnB;AACA,UAAIiC,aAAa,GAAGpC,KAAK,CAACzC,KAAN,CAAY4C,QAAhC;;AACA,UACEkC,uBAAUC,kBAAV,IACAtC,KAAK,CAACuC,IADN,KAECvC,KAAK,CAACuC,IAAN,KAAe,wBAAf,IACCvC,KAAK,CAACuC,IAAN,CAAW1D,IAAX,KAAoB,MADrB,IAECmB,KAAK,CAACuC,IAAN,CAAWC,WAAX,KAA2B,MAJ7B,CADF,EAME;AACAJ,QAAAA,aAAa,GAAGjD,KAAK,CAACc,QAAN,CAAewC,OAAf,CAAuBL,aAAvB,CAAhB;AACAA,QAAAA,aAAa,CAACM,IAAd,CACEL,uBAAUM,eAAV,CAA0B;AACxBC,UAAAA,KAAK,EAAE,mBADiB;AAExBC,UAAAA,OAAO,EAAE7C,KAAK,CAACzC,KAAN,CAAYsF;AAFG,SAA1B,CADF;AAMD;;AAED,0BAAO1D,KAAK,CAAC2D,YAAN,CACL9C,KADK,EAEL;AACEI,QAAAA,GAAG,EAAE,KAAK2C,UADZ;AAEEC,QAAAA,WAAW,EAAE,KAFf;AAGE,WAAGb;AAHL,OAFK,EAOLC,aAPK,CAAP;AASD;;AAhSD;;AAPwE,kBAIpElD,OAJoE,iBAQnDL,IARmD;;AAyS1E,SAAOK,OAAP;AACD","sourcesContent":["import * as React from 'react';\nimport {\n Platform,\n Touchable,\n UIManager,\n DeviceEventEmitter,\n EmitterSubscription,\n} from 'react-native';\n// @ts-ignore - it isn't typed by TS & don't have definitelyTyped types\nimport deepEqual from 'lodash/isEqual';\nimport RNGestureHandlerModule from '../RNGestureHandlerModule';\nimport type RNGestureHandlerModuleWeb from '../RNGestureHandlerModule.web';\nimport { State } from '../State';\nimport { handlerIDToTag, getNextHandlerTag } from './handlersRegistry';\n\nimport {\n BaseGestureHandlerProps,\n filterConfig,\n GestureEvent,\n HandlerStateChangeEvent,\n findNodeHandle,\n} from './gestureHandlerCommon';\nimport { ValueOf } from '../typeUtils';\n\nconst UIManagerAny = UIManager as any;\n\nconst customGHEventsConfig = {\n onGestureHandlerEvent: { registrationName: 'onGestureHandlerEvent' },\n onGestureHandlerStateChange: {\n registrationName: 'onGestureHandlerStateChange',\n },\n};\n\n// Add gesture specific events to genericDirectEventTypes object exported from UIManager\n// native module.\n// Once new event types are registered with react it is possible to dispatch these\n// events to all kind of native views.\nUIManagerAny.genericDirectEventTypes = {\n ...UIManagerAny.genericDirectEventTypes,\n ...customGHEventsConfig,\n};\n// In newer versions of RN the `genericDirectEventTypes` is located in the object\n// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make\n// it compatible with RN 61+\nconst UIManagerConstants =\n UIManagerAny.getViewManagerConfig?.('getConstants') ??\n UIManagerAny.getConstants?.();\n\nif (UIManagerConstants) {\n UIManagerConstants.genericDirectEventTypes = {\n ...UIManagerConstants.genericDirectEventTypes,\n ...customGHEventsConfig,\n };\n}\n\n// Wrap JS responder calls and notify gesture handler manager\nconst {\n setJSResponder: oldSetJSResponder = () => {\n //no operation\n },\n clearJSResponder: oldClearJSResponder = () => {\n //no operation\n },\n} = UIManagerAny;\nUIManagerAny.setJSResponder = (tag: number, blockNativeResponder: boolean) => {\n RNGestureHandlerModule.handleSetJSResponder(tag, blockNativeResponder);\n oldSetJSResponder(tag, blockNativeResponder);\n};\nUIManagerAny.clearJSResponder = () => {\n RNGestureHandlerModule.handleClearJSResponder();\n oldClearJSResponder();\n};\n\nlet allowTouches = true;\nconst DEV_ON_ANDROID = __DEV__ && Platform.OS === 'android';\n// Toggled inspector blocks touch events in order to allow inspecting on Android\n// This needs to be a global variable in order to set initial state for `allowTouches` property in Handler component\nif (DEV_ON_ANDROID) {\n DeviceEventEmitter.addListener('toggleElementInspector', () => {\n allowTouches = !allowTouches;\n });\n}\n\ntype HandlerProps> = Readonly<\n React.PropsWithChildren>\n>;\nfunction hasUnresolvedRefs>(\n props: HandlerProps\n) {\n // TODO(TS) - add type for extract arg\n const extract = (refs: any | any[]) => {\n if (!Array.isArray(refs)) {\n return refs && refs.current === null;\n }\n return refs.some((r) => r && r.current === null);\n };\n return extract(props['simultaneousHandlers']) || extract(props['waitFor']);\n}\n\nconst stateToPropMappings = {\n [State.UNDETERMINED]: undefined,\n [State.BEGAN]: 'onBegan',\n [State.FAILED]: 'onFailed',\n [State.CANCELLED]: 'onCancelled',\n [State.ACTIVE]: 'onActivated',\n [State.END]: 'onEnded',\n} as const;\n\ntype CreateHandlerArgs<\n HandlerPropsT extends Record\n> = Readonly<{\n name: string;\n allowedProps: Readonly[]>;\n config: Readonly>;\n transformProps?: (props: HandlerPropsT) => HandlerPropsT;\n customNativeProps?: Readonly;\n}>;\n\n// TODO(TS) fix event types\ntype InternalEventHandlers = {\n onGestureHandlerEvent?: (event: any) => void;\n onGestureHandlerStateChange?: (event: any) => void;\n};\n\nlet showedRngh2Notice = false;\nfunction showRngh2NoticeIfNeeded() {\n if (!showedRngh2Notice) {\n console.warn(\n \"[react-native-gesture-handler] Seems like you're using an old API with gesture components, check out new Gestures system!\"\n );\n showedRngh2Notice = true;\n }\n}\n\n// TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.\nexport default function createHandler<\n T extends BaseGestureHandlerProps,\n U extends Record\n>({\n name,\n allowedProps = [],\n config = {},\n transformProps,\n customNativeProps = [],\n}: CreateHandlerArgs): React.ComponentType> {\n interface HandlerState {\n allowTouches: boolean;\n }\n class Handler extends React.Component<\n T & InternalEventHandlers,\n HandlerState\n > {\n static displayName = name;\n\n private handlerTag: number;\n private config: Record;\n private propsRef: React.MutableRefObject;\n private viewNode: any;\n private viewTag?: number;\n private updateEnqueued: ReturnType | null = null;\n private inspectorToggleListener?: EmitterSubscription;\n\n constructor(props: T & InternalEventHandlers) {\n super(props);\n this.handlerTag = getNextHandlerTag();\n this.config = {};\n this.propsRef = React.createRef();\n this.state = { allowTouches };\n if (props.id) {\n if (handlerIDToTag[props.id] !== undefined) {\n throw new Error(`Handler with ID \"${props.id}\" already registered`);\n }\n handlerIDToTag[props.id] = this.handlerTag;\n }\n if (__DEV__) {\n showRngh2NoticeIfNeeded();\n }\n }\n\n componentDidMount() {\n const props: HandlerProps = this.props;\n\n if (DEV_ON_ANDROID) {\n this.inspectorToggleListener = DeviceEventEmitter.addListener(\n 'toggleElementInspector',\n () => {\n this.setState((_) => ({ allowTouches }));\n this.update();\n }\n );\n }\n if (hasUnresolvedRefs(props)) {\n // If there are unresolved refs (e.g. \".current\" has not yet been set)\n // passed as `simultaneousHandlers` or `waitFor`, we enqueue a call to\n // _update method that will try to update native handler props using\n // setImmediate. This makes it so update() function gets called after all\n // react components are mounted and we expect the missing ref object to\n // be resolved by then.\n this.updateEnqueued = setImmediate(() => {\n this.updateEnqueued = null;\n this.update();\n });\n }\n\n this.createGestureHandler(\n filterConfig(\n transformProps ? transformProps(this.props) : this.props,\n [...allowedProps, ...customNativeProps],\n config\n )\n );\n\n this.attachGestureHandler(findNodeHandle(this.viewNode) as number); // TODO(TS) - check if this can be null\n }\n\n componentDidUpdate() {\n const viewTag = findNodeHandle(this.viewNode);\n if (this.viewTag !== viewTag) {\n this.attachGestureHandler(viewTag as number); // TODO(TS) - check interaction between _viewTag & findNodeHandle\n }\n this.update();\n }\n\n componentWillUnmount() {\n this.inspectorToggleListener?.remove();\n RNGestureHandlerModule.dropGestureHandler(this.handlerTag);\n if (this.updateEnqueued) {\n clearImmediate(this.updateEnqueued);\n }\n // We can't use this.props.id directly due to TS generic type narrowing bug, see https://github.com/microsoft/TypeScript/issues/13995 for more context\n const handlerID: string | undefined = this.props.id;\n if (handlerID) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete handlerIDToTag[handlerID];\n }\n }\n\n private onGestureHandlerEvent = (event: GestureEvent) => {\n if (event.nativeEvent.handlerTag === this.handlerTag) {\n this.props.onGestureEvent?.(event);\n } else {\n this.props.onGestureHandlerEvent?.(event);\n }\n };\n\n // TODO(TS) - make sure this is right type for event\n private onGestureHandlerStateChange = (\n event: HandlerStateChangeEvent\n ) => {\n if (event.nativeEvent.handlerTag === this.handlerTag) {\n this.props.onHandlerStateChange?.(event);\n\n const state: ValueOf = event.nativeEvent.state;\n const stateEventName = stateToPropMappings[state];\n const eventHandler = stateEventName && this.props[stateEventName];\n if (eventHandler && typeof eventHandler === 'function') {\n eventHandler(event);\n }\n } else {\n this.props.onGestureHandlerStateChange?.(event);\n }\n };\n\n private refHandler = (node: any) => {\n this.viewNode = node;\n\n const child = React.Children.only(this.props.children);\n // TODO(TS) fix ref type\n const { ref }: any = child;\n if (ref !== null) {\n if (typeof ref === 'function') {\n ref(node);\n } else {\n ref.current = node;\n }\n }\n };\n\n private createGestureHandler = (\n newConfig: Readonly>\n ) => {\n this.config = newConfig;\n\n RNGestureHandlerModule.createGestureHandler(\n name,\n this.handlerTag,\n newConfig\n );\n };\n\n private attachGestureHandler = (newViewTag: number) => {\n this.viewTag = newViewTag;\n\n if (Platform.OS === 'web') {\n // typecast due to dynamic resolution, attachGestureHandler should have web version signature in this branch\n (RNGestureHandlerModule.attachGestureHandler as typeof RNGestureHandlerModuleWeb.attachGestureHandler)(\n this.handlerTag,\n newViewTag,\n false,\n this.propsRef\n );\n } else {\n RNGestureHandlerModule.attachGestureHandler(\n this.handlerTag,\n newViewTag,\n false\n );\n }\n };\n\n private updateGestureHandler = (\n newConfig: Readonly>\n ) => {\n this.config = newConfig;\n\n RNGestureHandlerModule.updateGestureHandler(this.handlerTag, newConfig);\n };\n\n private update() {\n const newConfig = filterConfig(\n transformProps ? transformProps(this.props) : this.props,\n [...allowedProps, ...customNativeProps],\n config\n );\n if (!deepEqual(this.config, newConfig)) {\n this.updateGestureHandler(newConfig);\n }\n }\n\n setNativeProps(updates: any) {\n const mergedProps = { ...this.props, ...updates };\n const newConfig = filterConfig(\n transformProps ? transformProps(mergedProps) : mergedProps,\n [...allowedProps, ...customNativeProps],\n config\n );\n this.updateGestureHandler(newConfig);\n }\n\n render() {\n let gestureEventHandler = this.onGestureHandlerEvent;\n // Another instance of https://github.com/microsoft/TypeScript/issues/13995\n type OnGestureEventHandlers = {\n onGestureEvent?: BaseGestureHandlerProps['onGestureEvent'];\n onGestureHandlerEvent?: InternalEventHandlers['onGestureHandlerEvent'];\n };\n const {\n onGestureEvent,\n onGestureHandlerEvent,\n }: OnGestureEventHandlers = this.props;\n if (onGestureEvent && typeof onGestureEvent !== 'function') {\n // If it's not a method it should be an native Animated.event\n // object. We set it directly as the handler for the view\n // In this case nested handlers are not going to be supported\n if (onGestureHandlerEvent) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n gestureEventHandler = onGestureEvent;\n } else {\n if (\n onGestureHandlerEvent &&\n typeof onGestureHandlerEvent !== 'function'\n ) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n }\n\n let gestureStateEventHandler = this.onGestureHandlerStateChange;\n // Another instance of https://github.com/microsoft/TypeScript/issues/13995\n type OnGestureStateChangeHandlers = {\n onHandlerStateChange?: BaseGestureHandlerProps['onHandlerStateChange'];\n onGestureHandlerStateChange?: InternalEventHandlers['onGestureHandlerStateChange'];\n };\n const {\n onHandlerStateChange,\n onGestureHandlerStateChange,\n }: OnGestureStateChangeHandlers = this.props;\n if (onHandlerStateChange && typeof onHandlerStateChange !== 'function') {\n // If it's not a method it should be an native Animated.event\n // object. We set it directly as the handler for the view\n // In this case nested handlers are not going to be supported\n if (onGestureHandlerStateChange) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n gestureStateEventHandler = onHandlerStateChange;\n } else {\n if (\n onGestureHandlerStateChange &&\n typeof onGestureHandlerStateChange !== 'function'\n ) {\n throw new Error(\n 'Nesting touch handlers with native animated driver is not supported yet'\n );\n }\n }\n const events = {\n onGestureHandlerEvent: this.state.allowTouches\n ? gestureEventHandler\n : undefined,\n onGestureHandlerStateChange: this.state.allowTouches\n ? gestureStateEventHandler\n : undefined,\n };\n\n this.propsRef.current = events;\n\n const child: any = React.Children.only(this.props.children);\n let grandChildren = child.props.children;\n if (\n Touchable.TOUCH_TARGET_DEBUG &&\n child.type &&\n (child.type === 'RNGestureHandlerButton' ||\n child.type.name === 'View' ||\n child.type.displayName === 'View')\n ) {\n grandChildren = React.Children.toArray(grandChildren);\n grandChildren.push(\n Touchable.renderDebugView({\n color: 'mediumspringgreen',\n hitSlop: child.props.hitSlop,\n })\n );\n }\n\n return React.cloneElement(\n child,\n {\n ref: this.refHandler,\n collapsable: false,\n ...events,\n },\n grandChildren\n );\n }\n }\n return Handler;\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/createNativeWrapper.js b/lib/commonjs/handlers/createNativeWrapper.js
new file mode 100644
index 0000000000..29fd09f7b6
--- /dev/null
+++ b/lib/commonjs/handlers/createNativeWrapper.js
@@ -0,0 +1,70 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = createNativeWrapper;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _NativeViewGestureHandler = require("./NativeViewGestureHandler");
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function _extends() { _extends = Object.assign || 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); }
+
+/*
+ * This array should consist of:
+ * - All keys in propTypes from NativeGestureHandler
+ * (and all keys in GestureHandlerPropTypes)
+ * - 'onGestureHandlerEvent'
+ * - 'onGestureHandlerStateChange'
+ */
+const NATIVE_WRAPPER_PROPS_FILTER = [..._NativeViewGestureHandler.nativeViewProps, 'onGestureHandlerEvent', 'onGestureHandlerStateChange'];
+
+function createNativeWrapper(Component, config = {}) {
+ const ComponentWrapper = /*#__PURE__*/React.forwardRef((props, ref) => {
+ // filter out props that should be passed to gesture handler wrapper
+ const gestureHandlerProps = Object.keys(props).reduce((res, key) => {
+ // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info
+ const allowedKeys = NATIVE_WRAPPER_PROPS_FILTER;
+
+ if (allowedKeys.includes(key)) {
+ // @ts-ignore FIXME(TS)
+ res[key] = props[key];
+ }
+
+ return res;
+ }, { ...config
+ } // watch out not to modify config
+ );
+
+ const _ref = (0, React.useRef)();
+
+ const _gestureHandlerRef = (0, React.useRef)();
+
+ (0, React.useImperativeHandle)(ref, // @ts-ignore TODO(TS) decide how nulls work in this context
+ () => {
+ const node = _gestureHandlerRef.current; // add handlerTag for relations config
+
+ if (_ref.current && node) {
+ // @ts-ignore FIXME(TS) think about createHandler return type
+ _ref.current.handlerTag = node.handlerTag;
+ return _ref.current;
+ }
+
+ return null;
+ }, [_ref, _gestureHandlerRef]);
+ return /*#__PURE__*/React.createElement(_NativeViewGestureHandler.NativeViewGestureHandler, _extends({}, gestureHandlerProps, {
+ // @ts-ignore TODO(TS)
+ ref: _gestureHandlerRef
+ }), /*#__PURE__*/React.createElement(Component, _extends({}, props, {
+ ref: _ref
+ })));
+ });
+ ComponentWrapper.displayName = Component.displayName || 'ComponentWrapper';
+ return ComponentWrapper;
+}
+//# sourceMappingURL=createNativeWrapper.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/createNativeWrapper.js.map b/lib/commonjs/handlers/createNativeWrapper.js.map
new file mode 100644
index 0000000000..79a2effeba
--- /dev/null
+++ b/lib/commonjs/handlers/createNativeWrapper.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["createNativeWrapper.tsx"],"names":["NATIVE_WRAPPER_PROPS_FILTER","nativeViewProps","createNativeWrapper","Component","config","ComponentWrapper","React","forwardRef","props","ref","gestureHandlerProps","Object","keys","reduce","res","key","allowedKeys","includes","_ref","_gestureHandlerRef","node","current","handlerTag","displayName"],"mappings":";;;;;;;AAAA;;AAGA;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,2BAA2B,GAAG,CAClC,GAAGC,yCAD+B,EAElC,uBAFkC,EAGlC,6BAHkC,CAApC;;AAMe,SAASC,mBAAT,CACbC,SADa,EAEbC,MAA+C,GAAG,EAFrC,EAGb;AACA,QAAMC,gBAAgB,gBAAGC,KAAK,CAACC,UAAN,CAGvB,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAChB;AACA,UAAMC,mBAAmB,GAAGC,MAAM,CAACC,IAAP,CAAYJ,KAAZ,EAAmBK,MAAnB,CAC1B,CAACC,GAAD,EAAMC,GAAN,KAAc;AACZ;AACA,YAAMC,WAA8B,GAAGhB,2BAAvC;;AACA,UAAIgB,WAAW,CAACC,QAAZ,CAAqBF,GAArB,CAAJ,EAA+B;AAC7B;AACAD,QAAAA,GAAG,CAACC,GAAD,CAAH,GAAWP,KAAK,CAACO,GAAD,CAAhB;AACD;;AACD,aAAOD,GAAP;AACD,KATyB,EAU1B,EAAE,GAAGV;AAAL,KAV0B,CAUZ;AAVY,KAA5B;;AAYA,UAAMc,IAAI,GAAG,mBAAb;;AACA,UAAMC,kBAAkB,GAAG,mBAA3B;;AACA,mCACEV,GADF,EAEE;AACA,UAAM;AACJ,YAAMW,IAAI,GAAGD,kBAAkB,CAACE,OAAhC,CADI,CAEJ;;AACA,UAAIH,IAAI,CAACG,OAAL,IAAgBD,IAApB,EAA0B;AACxB;AACAF,QAAAA,IAAI,CAACG,OAAL,CAAaC,UAAb,GAA0BF,IAAI,CAACE,UAA/B;AACA,eAAOJ,IAAI,CAACG,OAAZ;AACD;;AACD,aAAO,IAAP;AACD,KAZH,EAaE,CAACH,IAAD,EAAOC,kBAAP,CAbF;AAeA,wBACE,oBAAC,kDAAD,eACMT,mBADN;AAEE;AACA,MAAA,GAAG,EAAES;AAHP,qBAIE,oBAAC,SAAD,eAAeX,KAAf;AAAsB,MAAA,GAAG,EAAEU;AAA3B,OAJF,CADF;AAQD,GA1CwB,CAAzB;AA4CAb,EAAAA,gBAAgB,CAACkB,WAAjB,GAA+BpB,SAAS,CAACoB,WAAV,IAAyB,kBAAxD;AAEA,SAAOlB,gBAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { useImperativeHandle, useRef } from 'react';\n\nimport {\n NativeViewGestureHandler,\n NativeViewGestureHandlerProps,\n nativeViewProps,\n} from './NativeViewGestureHandler';\n\n/*\n * This array should consist of:\n * - All keys in propTypes from NativeGestureHandler\n * (and all keys in GestureHandlerPropTypes)\n * - 'onGestureHandlerEvent'\n * - 'onGestureHandlerStateChange'\n */\nconst NATIVE_WRAPPER_PROPS_FILTER = [\n ...nativeViewProps,\n 'onGestureHandlerEvent',\n 'onGestureHandlerStateChange',\n] as const;\n\nexport default function createNativeWrapper(\n Component: React.ComponentType
,\n config: Readonly = {}\n) {\n const ComponentWrapper = React.forwardRef<\n React.ComponentType,\n P & NativeViewGestureHandlerProps\n >((props, ref) => {\n // filter out props that should be passed to gesture handler wrapper\n const gestureHandlerProps = Object.keys(props).reduce(\n (res, key) => {\n // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info\n const allowedKeys: readonly string[] = NATIVE_WRAPPER_PROPS_FILTER;\n if (allowedKeys.includes(key)) {\n // @ts-ignore FIXME(TS)\n res[key] = props[key];\n }\n return res;\n },\n { ...config } // watch out not to modify config\n );\n const _ref = useRef>();\n const _gestureHandlerRef = useRef>();\n useImperativeHandle(\n ref,\n // @ts-ignore TODO(TS) decide how nulls work in this context\n () => {\n const node = _gestureHandlerRef.current;\n // add handlerTag for relations config\n if (_ref.current && node) {\n // @ts-ignore FIXME(TS) think about createHandler return type\n _ref.current.handlerTag = node.handlerTag;\n return _ref.current;\n }\n return null;\n },\n [_ref, _gestureHandlerRef]\n );\n return (\n \n \n \n );\n });\n\n ComponentWrapper.displayName = Component.displayName || 'ComponentWrapper';\n\n return ComponentWrapper;\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestureHandlerCommon.js b/lib/commonjs/handlers/gestureHandlerCommon.js
new file mode 100644
index 0000000000..855a80eca1
--- /dev/null
+++ b/lib/commonjs/handlers/gestureHandlerCommon.js
@@ -0,0 +1,80 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.filterConfig = filterConfig;
+exports.findNodeHandle = findNodeHandle;
+exports.baseGestureHandlerWithMonitorProps = exports.baseGestureHandlerProps = void 0;
+
+var _reactNative = require("react-native");
+
+var _handlersRegistry = require("./handlersRegistry");
+
+var _utils = require("../utils");
+
+// Previous types exported gesture handlers as classes which creates an interface and variable, both named the same as class.
+// Without those types, we'd introduce breaking change, forcing users to prefix every handler type specification with typeof
+// e.g. React.createRef -> React.createRef.
+// See https://www.typescriptlang.org/docs/handbook/classes.html#constructor-functions for reference.
+const commonProps = ['id', 'enabled', 'shouldCancelWhenOutside', 'hitSlop'];
+const componentInteractionProps = ['waitFor', 'simultaneousHandlers'];
+const baseGestureHandlerProps = [...commonProps, ...componentInteractionProps, 'onBegan', 'onFailed', 'onCancelled', 'onActivated', 'onEnded', 'onGestureEvent', 'onHandlerStateChange'];
+exports.baseGestureHandlerProps = baseGestureHandlerProps;
+const baseGestureHandlerWithMonitorProps = [...commonProps, 'needsPointerData', 'manualActivation'];
+exports.baseGestureHandlerWithMonitorProps = baseGestureHandlerWithMonitorProps;
+
+function isConfigParam(param, name) {
+ // param !== Object(param) returns false if `param` is a function
+ // or an object and returns true if `param` is null
+ return param !== undefined && (param !== Object(param) || !('__isNative' in param)) && name !== 'onHandlerStateChange' && name !== 'onGestureEvent';
+}
+
+function filterConfig(props, validProps, defaults = {}) {
+ const filteredConfig = { ...defaults
+ };
+
+ for (const key of validProps) {
+ let value = props[key];
+
+ if (isConfigParam(value, key)) {
+ if (key === 'simultaneousHandlers' || key === 'waitFor') {
+ value = transformIntoHandlerTags(props[key]);
+ } else if (key === 'hitSlop' && typeof value !== 'object') {
+ value = {
+ top: value,
+ left: value,
+ bottom: value,
+ right: value
+ };
+ }
+
+ filteredConfig[key] = value;
+ }
+ }
+
+ return filteredConfig;
+}
+
+function transformIntoHandlerTags(handlerIDs) {
+ handlerIDs = (0, _utils.toArray)(handlerIDs);
+
+ if (_reactNative.Platform.OS === 'web') {
+ return handlerIDs.map(({
+ current
+ }) => current).filter(handle => handle);
+ } // converts handler string IDs into their numeric tags
+
+
+ return handlerIDs.map(handlerID => {
+ var _handlerID$current;
+
+ return _handlersRegistry.handlerIDToTag[handlerID] || ((_handlerID$current = handlerID.current) === null || _handlerID$current === void 0 ? void 0 : _handlerID$current.handlerTag) || -1;
+ }).filter(handlerTag => handlerTag > 0);
+}
+
+function findNodeHandle(node) {
+ if (_reactNative.Platform.OS === 'web') return node;
+ return (0, _reactNative.findNodeHandle)(node);
+}
+//# sourceMappingURL=gestureHandlerCommon.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestureHandlerCommon.js.map b/lib/commonjs/handlers/gestureHandlerCommon.js.map
new file mode 100644
index 0000000000..e86a1afb2c
--- /dev/null
+++ b/lib/commonjs/handlers/gestureHandlerCommon.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["gestureHandlerCommon.ts"],"names":["commonProps","componentInteractionProps","baseGestureHandlerProps","baseGestureHandlerWithMonitorProps","isConfigParam","param","name","undefined","Object","filterConfig","props","validProps","defaults","filteredConfig","key","value","transformIntoHandlerTags","top","left","bottom","right","handlerIDs","Platform","OS","map","current","filter","handle","handlerID","handlerIDToTag","handlerTag","findNodeHandle","node"],"mappings":";;;;;;;;;AAKA;;AAKA;;AACA;;AAXA;AACA;AACA;AACA;AAUA,MAAMA,WAAW,GAAG,CAClB,IADkB,EAElB,SAFkB,EAGlB,yBAHkB,EAIlB,SAJkB,CAApB;AAOA,MAAMC,yBAAyB,GAAG,CAAC,SAAD,EAAY,sBAAZ,CAAlC;AAEO,MAAMC,uBAAuB,GAAG,CACrC,GAAGF,WADkC,EAErC,GAAGC,yBAFkC,EAGrC,SAHqC,EAIrC,UAJqC,EAKrC,aALqC,EAMrC,aANqC,EAOrC,SAPqC,EAQrC,gBARqC,EASrC,sBATqC,CAAhC;;AAYA,MAAME,kCAAkC,GAAG,CAChD,GAAGH,WAD6C,EAEhD,kBAFgD,EAGhD,kBAHgD,CAA3C;;;AAgGP,SAASI,aAAT,CAAuBC,KAAvB,EAAuCC,IAAvC,EAAqD;AACnD;AACA;AACA,SACED,KAAK,KAAKE,SAAV,KACCF,KAAK,KAAKG,MAAM,CAACH,KAAD,CAAhB,IACC,EAAE,gBAAiBA,KAAnB,CAFF,KAGAC,IAAI,KAAK,sBAHT,IAIAA,IAAI,KAAK,gBALX;AAOD;;AAEM,SAASG,YAAT,CACLC,KADK,EAELC,UAFK,EAGLC,QAAiC,GAAG,EAH/B,EAIL;AACA,QAAMC,cAAc,GAAG,EAAE,GAAGD;AAAL,GAAvB;;AACA,OAAK,MAAME,GAAX,IAAkBH,UAAlB,EAA8B;AAC5B,QAAII,KAAK,GAAGL,KAAK,CAACI,GAAD,CAAjB;;AACA,QAAIV,aAAa,CAACW,KAAD,EAAQD,GAAR,CAAjB,EAA+B;AAC7B,UAAIA,GAAG,KAAK,sBAAR,IAAkCA,GAAG,KAAK,SAA9C,EAAyD;AACvDC,QAAAA,KAAK,GAAGC,wBAAwB,CAACN,KAAK,CAACI,GAAD,CAAN,CAAhC;AACD,OAFD,MAEO,IAAIA,GAAG,KAAK,SAAR,IAAqB,OAAOC,KAAP,KAAiB,QAA1C,EAAoD;AACzDA,QAAAA,KAAK,GAAG;AAAEE,UAAAA,GAAG,EAAEF,KAAP;AAAcG,UAAAA,IAAI,EAAEH,KAApB;AAA2BI,UAAAA,MAAM,EAAEJ,KAAnC;AAA0CK,UAAAA,KAAK,EAAEL;AAAjD,SAAR;AACD;;AACDF,MAAAA,cAAc,CAACC,GAAD,CAAd,GAAsBC,KAAtB;AACD;AACF;;AACD,SAAOF,cAAP;AACD;;AAED,SAASG,wBAAT,CAAkCK,UAAlC,EAAmD;AACjDA,EAAAA,UAAU,GAAG,oBAAQA,UAAR,CAAb;;AAEA,MAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB,WAAOF,UAAU,CACdG,GADI,CACA,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAmCA,OADnC,EAEJC,MAFI,CAEIC,MAAD,IAAiBA,MAFpB,CAAP;AAGD,GAPgD,CAQjD;;;AACA,SAAON,UAAU,CACdG,GADI,CAEFI,SAAD;AAAA;;AAAA,WACEC,iCAAeD,SAAf,4BAA6BA,SAAS,CAACH,OAAvC,uDAA6B,mBAAmBK,UAAhD,KAA8D,CAAC,CADjE;AAAA,GAFG,EAKJJ,MALI,CAKII,UAAD,IAAwBA,UAAU,GAAG,CALxC,CAAP;AAMD;;AAEM,SAASC,cAAT,CACLC,IADK,EAEkE;AACvE,MAAIV,sBAASC,EAAT,KAAgB,KAApB,EAA2B,OAAOS,IAAP;AAC3B,SAAO,iCAAiBA,IAAjB,CAAP;AACD","sourcesContent":["// Previous types exported gesture handlers as classes which creates an interface and variable, both named the same as class.\n// Without those types, we'd introduce breaking change, forcing users to prefix every handler type specification with typeof\n// e.g. React.createRef -> React.createRef.\n// See https://www.typescriptlang.org/docs/handbook/classes.html#constructor-functions for reference.\nimport * as React from 'react';\nimport { Platform, findNodeHandle as findNodeHandleRN } from 'react-native';\n\nimport { State } from '../State';\nimport { EventType } from '../EventType';\nimport { ValueOf } from '../typeUtils';\nimport { handlerIDToTag } from './handlersRegistry';\nimport { toArray } from '../utils';\n\nconst commonProps = [\n 'id',\n 'enabled',\n 'shouldCancelWhenOutside',\n 'hitSlop',\n] as const;\n\nconst componentInteractionProps = ['waitFor', 'simultaneousHandlers'] as const;\n\nexport const baseGestureHandlerProps = [\n ...commonProps,\n ...componentInteractionProps,\n 'onBegan',\n 'onFailed',\n 'onCancelled',\n 'onActivated',\n 'onEnded',\n 'onGestureEvent',\n 'onHandlerStateChange',\n] as const;\n\nexport const baseGestureHandlerWithMonitorProps = [\n ...commonProps,\n 'needsPointerData',\n 'manualActivation',\n];\n\nexport interface GestureEventPayload {\n handlerTag: number;\n numberOfPointers: number;\n state: ValueOf;\n}\n\nexport interface HandlerStateChangeEventPayload {\n handlerTag: number;\n numberOfPointers: number;\n state: ValueOf;\n oldState: ValueOf;\n}\n\nexport type HitSlop =\n | number\n | Partial<\n Record<\n 'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal',\n number\n >\n >\n | Record<'width' | 'left', number>\n | Record<'width' | 'right', number>\n | Record<'height' | 'top', number>\n | Record<'height' | 'bottom', number>;\n\n//TODO(TS) events in handlers\n\nexport interface GestureEvent> {\n nativeEvent: Readonly;\n}\nexport interface HandlerStateChangeEvent<\n ExtraEventPayloadT = Record\n> {\n nativeEvent: Readonly;\n}\n\nexport type TouchData = {\n id: number;\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport type GestureTouchEvent = {\n handlerTag: number;\n numberOfTouches: number;\n state: ValueOf;\n eventType: EventType;\n allTouches: TouchData[];\n changedTouches: TouchData[];\n};\n\nexport type GestureUpdateEvent<\n GestureEventPayloadT = Record\n> = GestureEventPayload & GestureEventPayloadT;\n\nexport type GestureStateChangeEvent<\n GestureStateChangeEventPayloadT = Record\n> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;\n\nexport type CommonGestureConfig = {\n enabled?: boolean;\n shouldCancelWhenOutside?: boolean;\n hitSlop?: HitSlop;\n};\n\n// Events payloads are types instead of interfaces due to TS limitation.\n// See https://github.com/microsoft/TypeScript/issues/15300 for more info.\nexport type BaseGestureHandlerProps<\n ExtraEventPayloadT extends Record = Record\n> = CommonGestureConfig & {\n id?: string;\n waitFor?: React.Ref | React.Ref[];\n simultaneousHandlers?: React.Ref | React.Ref[];\n // TODO(TS) - fix event types\n onBegan?: (event: HandlerStateChangeEvent) => void;\n onFailed?: (event: HandlerStateChangeEvent) => void;\n onCancelled?: (event: HandlerStateChangeEvent) => void;\n onActivated?: (event: HandlerStateChangeEvent) => void;\n onEnded?: (event: HandlerStateChangeEvent) => void;\n\n //TODO(TS) consider using NativeSyntheticEvent\n onGestureEvent?: (event: GestureEvent) => void;\n onHandlerStateChange?: (\n event: HandlerStateChangeEvent\n ) => void;\n};\n\nfunction isConfigParam(param: unknown, name: string) {\n // param !== Object(param) returns false if `param` is a function\n // or an object and returns true if `param` is null\n return (\n param !== undefined &&\n (param !== Object(param) ||\n !('__isNative' in (param as Record))) &&\n name !== 'onHandlerStateChange' &&\n name !== 'onGestureEvent'\n );\n}\n\nexport function filterConfig(\n props: Record,\n validProps: string[],\n defaults: Record = {}\n) {\n const filteredConfig = { ...defaults };\n for (const key of validProps) {\n let value = props[key];\n if (isConfigParam(value, key)) {\n if (key === 'simultaneousHandlers' || key === 'waitFor') {\n value = transformIntoHandlerTags(props[key]);\n } else if (key === 'hitSlop' && typeof value !== 'object') {\n value = { top: value, left: value, bottom: value, right: value };\n }\n filteredConfig[key] = value;\n }\n }\n return filteredConfig;\n}\n\nfunction transformIntoHandlerTags(handlerIDs: any) {\n handlerIDs = toArray(handlerIDs);\n\n if (Platform.OS === 'web') {\n return handlerIDs\n .map(({ current }: { current: any }) => current)\n .filter((handle: any) => handle);\n }\n // converts handler string IDs into their numeric tags\n return handlerIDs\n .map(\n (handlerID: any) =>\n handlerIDToTag[handlerID] || handlerID.current?.handlerTag || -1\n )\n .filter((handlerTag: number) => handlerTag > 0);\n}\n\nexport function findNodeHandle(\n node: null | number | React.Component | React.ComponentClass\n): null | number | React.Component | React.ComponentClass {\n if (Platform.OS === 'web') return node;\n return findNodeHandleRN(node);\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestureHandlerTypesCompat.js b/lib/commonjs/handlers/gestureHandlerTypesCompat.js
new file mode 100644
index 0000000000..a82c6d8e6e
--- /dev/null
+++ b/lib/commonjs/handlers/gestureHandlerTypesCompat.js
@@ -0,0 +1,2 @@
+"use strict";
+//# sourceMappingURL=gestureHandlerTypesCompat.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map b/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map
new file mode 100644
index 0000000000..9ffd4b22fc
--- /dev/null
+++ b/lib/commonjs/handlers/gestureHandlerTypesCompat.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/GestureDetector.js b/lib/commonjs/handlers/gestures/GestureDetector.js
new file mode 100644
index 0000000000..50da038043
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/GestureDetector.js
@@ -0,0 +1,440 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.GestureDetector = void 0;
+
+var _react = _interopRequireWildcard(require("react"));
+
+var _gesture = require("./gesture");
+
+var _reanimatedWrapper = require("./reanimatedWrapper");
+
+var _handlersRegistry = require("../handlersRegistry");
+
+var _RNGestureHandlerModule = _interopRequireDefault(require("../../RNGestureHandlerModule"));
+
+var _gestureHandlerCommon = require("../gestureHandlerCommon");
+
+var _gestureStateManager = require("./gestureStateManager");
+
+var _FlingGestureHandler = require("../FlingGestureHandler");
+
+var _ForceTouchGestureHandler = require("../ForceTouchGestureHandler");
+
+var _LongPressGestureHandler = require("../LongPressGestureHandler");
+
+var _PanGestureHandler = require("../PanGestureHandler");
+
+var _TapGestureHandler = require("../TapGestureHandler");
+
+var _State = require("../../State");
+
+var _EventType = require("../../EventType");
+
+var _Reanimated$default$c, _Reanimated$default;
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+const ALLOWED_PROPS = [..._gestureHandlerCommon.baseGestureHandlerWithMonitorProps, ..._TapGestureHandler.tapGestureHandlerProps, ..._PanGestureHandler.panGestureHandlerProps, ..._PanGestureHandler.panGestureHandlerCustomNativeProps, ..._LongPressGestureHandler.longPressGestureHandlerProps, ..._ForceTouchGestureHandler.forceTouchGestureHandlerProps, ..._FlingGestureHandler.flingGestureHandlerProps];
+
+function convertToHandlerTag(ref) {
+ if (typeof ref === 'number') {
+ return ref;
+ } else if (ref instanceof _gesture.BaseGesture) {
+ return ref.handlerTag;
+ } else {
+ var _ref$current$handlerT, _ref$current;
+
+ // @ts-ignore in this case it should be a ref either to gesture object or
+ // a gesture handler component, in both cases handlerTag property exists
+ return (_ref$current$handlerT = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.handlerTag) !== null && _ref$current$handlerT !== void 0 ? _ref$current$handlerT : -1;
+ }
+}
+
+function extractValidHandlerTags(interactionGroup) {
+ var _interactionGroup$map, _interactionGroup$map2;
+
+ return (_interactionGroup$map = interactionGroup === null || interactionGroup === void 0 ? void 0 : (_interactionGroup$map2 = interactionGroup.map(convertToHandlerTag)) === null || _interactionGroup$map2 === void 0 ? void 0 : _interactionGroup$map2.filter(tag => tag > 0)) !== null && _interactionGroup$map !== void 0 ? _interactionGroup$map : [];
+}
+
+function dropHandlers(preparedGesture) {
+ for (const handler of preparedGesture.config) {
+ _RNGestureHandlerModule.default.dropGestureHandler(handler.handlerTag);
+
+ (0, _handlersRegistry.unregisterHandler)(handler.handlerTag);
+ }
+}
+
+function attachHandlers({
+ preparedGesture,
+ gestureConfig,
+ gesture,
+ viewTag,
+ useAnimated
+}) {
+ if (!preparedGesture.firstExecution) {
+ gestureConfig === null || gestureConfig === void 0 ? void 0 : gestureConfig.initialize();
+ } else {
+ preparedGesture.firstExecution = false;
+ } // use setImmediate to extract handlerTags, because all refs should be initialized
+ // when it's ran
+
+
+ setImmediate(() => {
+ gestureConfig === null || gestureConfig === void 0 ? void 0 : gestureConfig.prepare();
+ });
+
+ for (const handler of gesture) {
+ _RNGestureHandlerModule.default.createGestureHandler(handler.handlerName, handler.handlerTag, (0, _gestureHandlerCommon.filterConfig)(handler.config, ALLOWED_PROPS));
+
+ (0, _handlersRegistry.registerHandler)(handler.handlerTag, handler); // use setImmediate to extract handlerTags, because all refs should be initialized
+ // when it's ran
+
+ setImmediate(() => {
+ let requireToFail = [];
+
+ if (handler.config.requireToFail) {
+ requireToFail = extractValidHandlerTags(handler.config.requireToFail);
+ }
+
+ let simultaneousWith = [];
+
+ if (handler.config.simultaneousWith) {
+ simultaneousWith = extractValidHandlerTags(handler.config.simultaneousWith);
+ }
+
+ _RNGestureHandlerModule.default.updateGestureHandler(handler.handlerTag, (0, _gestureHandlerCommon.filterConfig)(handler.config, ALLOWED_PROPS, {
+ simultaneousHandlers: simultaneousWith,
+ waitFor: requireToFail
+ }));
+ });
+ }
+
+ preparedGesture.config = gesture;
+
+ for (const gesture of preparedGesture.config) {
+ _RNGestureHandlerModule.default.attachGestureHandler(gesture.handlerTag, viewTag, !useAnimated // send direct events when using animatedGesture, device events otherwise
+ );
+ }
+
+ if (preparedGesture.animatedHandlers) {
+ preparedGesture.animatedHandlers.value = gesture.map(g => g.handlers);
+ }
+}
+
+function updateHandlers(preparedGesture, gestureConfig, gesture) {
+ gestureConfig === null || gestureConfig === void 0 ? void 0 : gestureConfig.prepare();
+
+ for (let i = 0; i < gesture.length; i++) {
+ const handler = preparedGesture.config[i];
+ gesture[i].handlerTag = handler.handlerTag;
+ gesture[i].handlers.handlerTag = handler.handlerTag;
+ } // use setImmediate to extract handlerTags, because when it's ran, all refs should be updated
+ // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait
+ // in case of external relations)
+
+
+ setImmediate(() => {
+ for (let i = 0; i < gesture.length; i++) {
+ const handler = preparedGesture.config[i];
+ handler.config = gesture[i].config;
+ handler.handlers = gesture[i].handlers;
+ handler.handlers.handlerTag = handler.handlerTag;
+ const requireToFail = extractValidHandlerTags(handler.config.requireToFail);
+ const simultaneousWith = extractValidHandlerTags(handler.config.simultaneousWith);
+
+ _RNGestureHandlerModule.default.updateGestureHandler(handler.handlerTag, (0, _gestureHandlerCommon.filterConfig)(handler.config, ALLOWED_PROPS, {
+ simultaneousHandlers: simultaneousWith,
+ waitFor: requireToFail
+ }));
+
+ (0, _handlersRegistry.registerHandler)(handler.handlerTag, handler);
+ }
+
+ if (preparedGesture.animatedHandlers) {
+ preparedGesture.animatedHandlers.value = preparedGesture.config.map(g => g.handlers);
+ }
+ });
+}
+
+function needsToReattach(preparedGesture, gesture) {
+ if (gesture.length !== preparedGesture.config.length) {
+ return true;
+ }
+
+ for (let i = 0; i < gesture.length; i++) {
+ if (gesture[i].handlerName !== preparedGesture.config[i].handlerName) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+function useAnimatedGesture(preparedGesture) {
+ if (!_reanimatedWrapper.Reanimated) {
+ return;
+ }
+
+ function isStateChangeEvent(event) {
+ 'worklet'; // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point
+
+ return event.oldState != null;
+ }
+
+ function isTouchEvent(event) {
+ 'worklet';
+
+ return event.eventType != null;
+ }
+
+ function getHandler(type, gesture) {
+ 'worklet';
+
+ switch (type) {
+ case _gesture.CALLBACK_TYPE.BEGAN:
+ return gesture.onBegin;
+
+ case _gesture.CALLBACK_TYPE.START:
+ return gesture.onStart;
+
+ case _gesture.CALLBACK_TYPE.UPDATE:
+ return gesture.onUpdate;
+
+ case _gesture.CALLBACK_TYPE.CHANGE:
+ return gesture.onChange;
+
+ case _gesture.CALLBACK_TYPE.END:
+ return gesture.onEnd;
+
+ case _gesture.CALLBACK_TYPE.FINALIZE:
+ return gesture.onFinalize;
+
+ case _gesture.CALLBACK_TYPE.TOUCHES_DOWN:
+ return gesture.onTouchesDown;
+
+ case _gesture.CALLBACK_TYPE.TOUCHES_MOVE:
+ return gesture.onTouchesMove;
+
+ case _gesture.CALLBACK_TYPE.TOUCHES_UP:
+ return gesture.onTouchesUp;
+
+ case _gesture.CALLBACK_TYPE.TOUCHES_CANCELLED:
+ return gesture.onTouchesCancelled;
+ }
+ }
+
+ function touchEventTypeToCallbackType(eventType) {
+ 'worklet';
+
+ switch (eventType) {
+ case _EventType.EventType.TOUCHES_DOWN:
+ return _gesture.CALLBACK_TYPE.TOUCHES_DOWN;
+
+ case _EventType.EventType.TOUCHES_MOVE:
+ return _gesture.CALLBACK_TYPE.TOUCHES_MOVE;
+
+ case _EventType.EventType.TOUCHES_UP:
+ return _gesture.CALLBACK_TYPE.TOUCHES_UP;
+
+ case _EventType.EventType.TOUCHES_CANCELLED:
+ return _gesture.CALLBACK_TYPE.TOUCHES_CANCELLED;
+ }
+
+ return _gesture.CALLBACK_TYPE.UNDEFINED;
+ }
+
+ function runWorklet(type, gesture, event, ...args) {
+ 'worklet';
+
+ const handler = getHandler(type, gesture);
+
+ if (gesture.isWorklet[type]) {
+ // @ts-ignore Logic below makes sure the correct event is send to the
+ // correct handler.
+ handler === null || handler === void 0 ? void 0 : handler(event, ...args);
+ } else if (handler) {
+ console.warn('Animated gesture callback must be a worklet');
+ }
+ } // Hooks are called conditionally, but the condition is whether the
+ // react-native-reanimated is installed, which shouldn't change while running
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+
+
+ const sharedHandlersCallbacks = _reanimatedWrapper.Reanimated.useSharedValue(null); // eslint-disable-next-line react-hooks/rules-of-hooks
+
+
+ const lastUpdateEvent = _reanimatedWrapper.Reanimated.useSharedValue([]); // not every gesture needs a state controller, init them lazily
+
+
+ const stateControllers = [];
+
+ const callback = event => {
+ 'worklet';
+
+ const currentCallback = sharedHandlersCallbacks.value;
+
+ if (!currentCallback) {
+ return;
+ }
+
+ for (let i = 0; i < currentCallback.length; i++) {
+ const gesture = currentCallback[i];
+
+ if (event.handlerTag === gesture.handlerTag) {
+ if (isStateChangeEvent(event)) {
+ if (event.oldState === _State.State.UNDETERMINED && event.state === _State.State.BEGAN) {
+ runWorklet(_gesture.CALLBACK_TYPE.BEGAN, gesture, event);
+ } else if ((event.oldState === _State.State.BEGAN || event.oldState === _State.State.UNDETERMINED) && event.state === _State.State.ACTIVE) {
+ runWorklet(_gesture.CALLBACK_TYPE.START, gesture, event);
+ lastUpdateEvent.value[gesture.handlerTag] = undefined;
+ } else if (event.oldState !== event.state && event.state === _State.State.END) {
+ if (event.oldState === _State.State.ACTIVE) {
+ runWorklet(_gesture.CALLBACK_TYPE.END, gesture, event, true);
+ }
+
+ runWorklet(_gesture.CALLBACK_TYPE.FINALIZE, gesture, event, true);
+ } else if ((event.state === _State.State.FAILED || event.state === _State.State.CANCELLED) && event.state !== event.oldState) {
+ if (event.oldState === _State.State.ACTIVE) {
+ runWorklet(_gesture.CALLBACK_TYPE.END, gesture, event, false);
+ }
+
+ runWorklet(_gesture.CALLBACK_TYPE.FINALIZE, gesture, event, false);
+ }
+ } else if (isTouchEvent(event)) {
+ if (!stateControllers[i]) {
+ stateControllers[i] = _gestureStateManager.GestureStateManager.create(event.handlerTag);
+ }
+
+ if (event.eventType !== _EventType.EventType.UNDETERMINED) {
+ runWorklet(touchEventTypeToCallbackType(event.eventType), gesture, event, stateControllers[i]);
+ }
+ } else {
+ runWorklet(_gesture.CALLBACK_TYPE.UPDATE, gesture, event);
+
+ if (gesture.onChange && gesture.changeEventCalculator) {
+ var _gesture$changeEventC;
+
+ runWorklet(_gesture.CALLBACK_TYPE.CHANGE, gesture, (_gesture$changeEventC = gesture.changeEventCalculator) === null || _gesture$changeEventC === void 0 ? void 0 : _gesture$changeEventC.call(gesture, event, lastUpdateEvent.value[gesture.handlerTag]));
+ lastUpdateEvent.value[gesture.handlerTag] = event;
+ }
+ }
+ }
+ }
+ }; // eslint-disable-next-line react-hooks/rules-of-hooks
+
+
+ const event = _reanimatedWrapper.Reanimated.useEvent(callback, ['onGestureHandlerStateChange', 'onGestureHandlerEvent'], true);
+
+ preparedGesture.animatedEventHandler = event;
+ preparedGesture.animatedHandlers = sharedHandlersCallbacks;
+}
+
+const GestureDetector = props => {
+ var _gestureConfig$toGest, _gestureConfig$toGest2;
+
+ const gestureConfig = props.gesture;
+ const gesture = (_gestureConfig$toGest = gestureConfig === null || gestureConfig === void 0 ? void 0 : (_gestureConfig$toGest2 = gestureConfig.toGestureArray) === null || _gestureConfig$toGest2 === void 0 ? void 0 : _gestureConfig$toGest2.call(gestureConfig)) !== null && _gestureConfig$toGest !== void 0 ? _gestureConfig$toGest : [];
+ const useAnimated = gesture.find(gesture => gesture.handlers.isWorklet.reduce((prev, current) => prev || current)) != null;
+ const viewRef = (0, _react.useRef)(null);
+ const firstRenderRef = (0, _react.useRef)(true);
+
+ const preparedGesture = _react.default.useRef({
+ config: gesture,
+ animatedEventHandler: null,
+ animatedHandlers: null,
+ firstExecution: true,
+ useAnimated: useAnimated
+ }).current;
+
+ if (useAnimated !== preparedGesture.useAnimated) {
+ throw new Error('You cannot change whether you are using gesture or animatedGesture while the app is running');
+ }
+
+ if (preparedGesture.firstExecution) {
+ var _gestureConfig$initia;
+
+ gestureConfig === null || gestureConfig === void 0 ? void 0 : (_gestureConfig$initia = gestureConfig.initialize) === null || _gestureConfig$initia === void 0 ? void 0 : _gestureConfig$initia.call(gestureConfig);
+ }
+
+ if (useAnimated) {
+ // Whether animatedGesture or gesture is used shouldn't change
+ // during while an app is running
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ useAnimatedGesture(preparedGesture);
+ }
+
+ (0, _react.useEffect)(() => {
+ firstRenderRef.current = true;
+ const viewTag = (0, _gestureHandlerCommon.findNodeHandle)(viewRef.current);
+ attachHandlers({
+ preparedGesture,
+ gestureConfig,
+ gesture,
+ viewTag,
+ useAnimated
+ });
+ return () => {
+ dropHandlers(preparedGesture);
+ };
+ }, []);
+ (0, _react.useEffect)(() => {
+ if (!firstRenderRef.current) {
+ const viewTag = (0, _gestureHandlerCommon.findNodeHandle)(viewRef.current);
+
+ if (needsToReattach(preparedGesture, gesture)) {
+ dropHandlers(preparedGesture);
+ attachHandlers({
+ preparedGesture,
+ gestureConfig,
+ gesture,
+ viewTag,
+ useAnimated
+ });
+ } else {
+ updateHandlers(preparedGesture, gestureConfig, gesture);
+ }
+ } else {
+ firstRenderRef.current = false;
+ }
+ }, [props]);
+
+ if (useAnimated) {
+ return /*#__PURE__*/_react.default.createElement(AnimatedWrap, {
+ ref: viewRef,
+ onGestureHandlerEvent: preparedGesture.animatedEventHandler
+ }, props.children);
+ } else {
+ return /*#__PURE__*/_react.default.createElement(Wrap, {
+ ref: viewRef
+ }, props.children);
+ }
+};
+
+exports.GestureDetector = GestureDetector;
+
+class Wrap extends _react.default.Component {
+ render() {
+ // I don't think that fighting with types over such a simple function is worth it
+ // The only thing it does is add 'collapsable: false' to the child component
+ // to make sure it is in the native view hierarchy so the detector can find
+ // correct viewTag to attach to.
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const child = _react.default.Children.only(this.props.children);
+
+ return /*#__PURE__*/_react.default.cloneElement(child, {
+ collapsable: false
+ }, // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ child.props.children);
+ }
+
+}
+
+const AnimatedWrap = (_Reanimated$default$c = _reanimatedWrapper.Reanimated === null || _reanimatedWrapper.Reanimated === void 0 ? void 0 : (_Reanimated$default = _reanimatedWrapper.Reanimated.default) === null || _Reanimated$default === void 0 ? void 0 : _Reanimated$default.createAnimatedComponent(Wrap)) !== null && _Reanimated$default$c !== void 0 ? _Reanimated$default$c : Wrap;
+//# sourceMappingURL=GestureDetector.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/GestureDetector.js.map b/lib/commonjs/handlers/gestures/GestureDetector.js.map
new file mode 100644
index 0000000000..523dfcf312
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/GestureDetector.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["GestureDetector.tsx"],"names":["ALLOWED_PROPS","baseGestureHandlerWithMonitorProps","tapGestureHandlerProps","panGestureHandlerProps","panGestureHandlerCustomNativeProps","longPressGestureHandlerProps","forceTouchGestureHandlerProps","flingGestureHandlerProps","convertToHandlerTag","ref","BaseGesture","handlerTag","current","extractValidHandlerTags","interactionGroup","map","filter","tag","dropHandlers","preparedGesture","handler","config","RNGestureHandlerModule","dropGestureHandler","attachHandlers","gestureConfig","gesture","viewTag","useAnimated","firstExecution","initialize","setImmediate","prepare","createGestureHandler","handlerName","requireToFail","simultaneousWith","updateGestureHandler","simultaneousHandlers","waitFor","attachGestureHandler","animatedHandlers","value","g","handlers","updateHandlers","i","length","needsToReattach","useAnimatedGesture","Reanimated","isStateChangeEvent","event","oldState","isTouchEvent","eventType","getHandler","type","CALLBACK_TYPE","BEGAN","onBegin","START","onStart","UPDATE","onUpdate","CHANGE","onChange","END","onEnd","FINALIZE","onFinalize","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","touchEventTypeToCallbackType","EventType","UNDEFINED","runWorklet","args","isWorklet","console","warn","sharedHandlersCallbacks","useSharedValue","lastUpdateEvent","stateControllers","callback","currentCallback","State","UNDETERMINED","state","ACTIVE","undefined","FAILED","CANCELLED","GestureStateManager","create","changeEventCalculator","useEvent","animatedEventHandler","GestureDetector","props","toGestureArray","find","reduce","prev","viewRef","firstRenderRef","React","useRef","Error","children","Wrap","Component","render","child","Children","only","cloneElement","collapsable","AnimatedWrap","default","createAnimatedComponent"],"mappings":";;;;;;;AAAA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AAQA;;AAIA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;;;;;;;;;AAGA,MAAMA,aAAa,GAAG,CACpB,GAAGC,wDADiB,EAEpB,GAAGC,yCAFiB,EAGpB,GAAGC,yCAHiB,EAIpB,GAAGC,qDAJiB,EAKpB,GAAGC,qDALiB,EAMpB,GAAGC,uDANiB,EAOpB,GAAGC,6CAPiB,CAAtB;;AAoBA,SAASC,mBAAT,CAA6BC,GAA7B,EAAsD;AACpD,MAAI,OAAOA,GAAP,KAAe,QAAnB,EAA6B;AAC3B,WAAOA,GAAP;AACD,GAFD,MAEO,IAAIA,GAAG,YAAYC,oBAAnB,EAAgC;AACrC,WAAOD,GAAG,CAACE,UAAX;AACD,GAFM,MAEA;AAAA;;AACL;AACA;AACA,oDAAOF,GAAG,CAACG,OAAX,iDAAO,aAAaD,UAApB,yEAAkC,CAAC,CAAnC;AACD;AACF;;AAED,SAASE,uBAAT,CAAiCC,gBAAjC,EAA6E;AAAA;;AAC3E,kCACEA,gBADF,aACEA,gBADF,iDACEA,gBAAgB,CAAEC,GAAlB,CAAsBP,mBAAtB,CADF,2DACE,uBAA4CQ,MAA5C,CAAoDC,GAAD,IAASA,GAAG,GAAG,CAAlE,CADF,yEAC0E,EAD1E;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A,qBAAqB,EAAE5F,eAAe,CAACqF;AAFzC,OAGGE,KAAK,CAACU,QAHT,CADF;AAOD,GARD,MAQO;AACL,wBAAO,6BAAC,IAAD;AAAM,MAAA,GAAG,EAAEL;AAAX,OAAqBL,KAAK,CAACU,QAA3B,CAAP;AACD;AACF,CArFM;;;;AAuFP,MAAMC,IAAN,SAAmBJ,eAAMK,SAAzB,CAAwE;AACtEC,EAAAA,MAAM,GAAG;AACP;AACA;AACA;AACA;AACA;AACA,UAAMC,KAAU,GAAGP,eAAMQ,QAAN,CAAeC,IAAf,CAAoB,KAAKhB,KAAL,CAAWU,QAA/B,CAAnB;;AAEA,wBAAOH,eAAMU,YAAN,CACLH,KADK,EAEL;AAAEI,MAAAA,WAAW,EAAE;AAAf,KAFK,EAGL;AACAJ,IAAAA,KAAK,CAACd,KAAN,CAAYU,QAJP,CAAP;AAMD;;AAfqE;;AAkBxE,MAAMS,YAAY,4BAAG3E,6BAAH,aAAGA,6BAAH,8CAAGA,8BAAY4E,OAAf,wDAAG,oBAAqBC,uBAArB,CAA6CV,IAA7C,CAAH,yEAAyDA,IAA3E","sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport {\n GestureType,\n HandlerCallbacks,\n BaseGesture,\n GestureRef,\n CALLBACK_TYPE,\n} from './gesture';\nimport { Reanimated, SharedValue } from './reanimatedWrapper';\nimport { registerHandler, unregisterHandler } from '../handlersRegistry';\nimport RNGestureHandlerModule from '../../RNGestureHandlerModule';\nimport {\n baseGestureHandlerWithMonitorProps,\n filterConfig,\n findNodeHandle,\n GestureTouchEvent,\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from '../gestureHandlerCommon';\nimport {\n GestureStateManager,\n GestureStateManagerType,\n} from './gestureStateManager';\nimport { flingGestureHandlerProps } from '../FlingGestureHandler';\nimport { forceTouchGestureHandlerProps } from '../ForceTouchGestureHandler';\nimport { longPressGestureHandlerProps } from '../LongPressGestureHandler';\nimport {\n panGestureHandlerProps,\n panGestureHandlerCustomNativeProps,\n} from '../PanGestureHandler';\nimport { tapGestureHandlerProps } from '../TapGestureHandler';\nimport { State } from '../../State';\nimport { EventType } from '../../EventType';\nimport { ComposedGesture } from './gestureComposition';\n\nconst ALLOWED_PROPS = [\n ...baseGestureHandlerWithMonitorProps,\n ...tapGestureHandlerProps,\n ...panGestureHandlerProps,\n ...panGestureHandlerCustomNativeProps,\n ...longPressGestureHandlerProps,\n ...forceTouchGestureHandlerProps,\n ...flingGestureHandlerProps,\n];\n\nexport type GestureConfigReference = {\n config: GestureType[];\n animatedEventHandler: unknown;\n animatedHandlers: SharedValue<\n HandlerCallbacks>[] | null\n > | null;\n firstExecution: boolean;\n useAnimated: boolean;\n};\n\nfunction convertToHandlerTag(ref: GestureRef): number {\n if (typeof ref === 'number') {\n return ref;\n } else if (ref instanceof BaseGesture) {\n return ref.handlerTag;\n } else {\n // @ts-ignore in this case it should be a ref either to gesture object or\n // a gesture handler component, in both cases handlerTag property exists\n return ref.current?.handlerTag ?? -1;\n }\n}\n\nfunction extractValidHandlerTags(interactionGroup: GestureRef[] | undefined) {\n return (\n interactionGroup?.map(convertToHandlerTag)?.filter((tag) => tag > 0) ?? []\n );\n}\n\nfunction dropHandlers(preparedGesture: GestureConfigReference) {\n for (const handler of preparedGesture.config) {\n RNGestureHandlerModule.dropGestureHandler(handler.handlerTag);\n\n unregisterHandler(handler.handlerTag);\n }\n}\n\ninterface AttachHandlersConfig {\n preparedGesture: GestureConfigReference;\n gestureConfig: ComposedGesture | GestureType | undefined;\n gesture: GestureType[];\n viewTag: number;\n useAnimated: boolean;\n}\n\nfunction attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n useAnimated,\n}: AttachHandlersConfig) {\n if (!preparedGesture.firstExecution) {\n gestureConfig?.initialize();\n } else {\n preparedGesture.firstExecution = false;\n }\n\n // use setImmediate to extract handlerTags, because all refs should be initialized\n // when it's ran\n setImmediate(() => {\n gestureConfig?.prepare();\n });\n\n for (const handler of gesture) {\n RNGestureHandlerModule.createGestureHandler(\n handler.handlerName,\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS)\n );\n\n registerHandler(handler.handlerTag, handler);\n\n // use setImmediate to extract handlerTags, because all refs should be initialized\n // when it's ran\n setImmediate(() => {\n let requireToFail: number[] = [];\n if (handler.config.requireToFail) {\n requireToFail = extractValidHandlerTags(handler.config.requireToFail);\n }\n\n let simultaneousWith: number[] = [];\n if (handler.config.simultaneousWith) {\n simultaneousWith = extractValidHandlerTags(\n handler.config.simultaneousWith\n );\n }\n\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS, {\n simultaneousHandlers: simultaneousWith,\n waitFor: requireToFail,\n })\n );\n });\n }\n preparedGesture.config = gesture;\n\n for (const gesture of preparedGesture.config) {\n RNGestureHandlerModule.attachGestureHandler(\n gesture.handlerTag,\n viewTag,\n !useAnimated // send direct events when using animatedGesture, device events otherwise\n );\n }\n\n if (preparedGesture.animatedHandlers) {\n preparedGesture.animatedHandlers.value = (gesture.map(\n (g) => g.handlers\n ) as unknown) as HandlerCallbacks>[];\n }\n}\n\nfunction updateHandlers(\n preparedGesture: GestureConfigReference,\n gestureConfig: ComposedGesture | GestureType | undefined,\n gesture: GestureType[]\n) {\n gestureConfig?.prepare();\n\n for (let i = 0; i < gesture.length; i++) {\n const handler = preparedGesture.config[i];\n\n gesture[i].handlerTag = handler.handlerTag;\n gesture[i].handlers.handlerTag = handler.handlerTag;\n }\n\n // use setImmediate to extract handlerTags, because when it's ran, all refs should be updated\n // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait\n // in case of external relations)\n setImmediate(() => {\n for (let i = 0; i < gesture.length; i++) {\n const handler = preparedGesture.config[i];\n\n handler.config = gesture[i].config;\n handler.handlers = gesture[i].handlers;\n handler.handlers.handlerTag = handler.handlerTag;\n\n const requireToFail = extractValidHandlerTags(\n handler.config.requireToFail\n );\n\n const simultaneousWith = extractValidHandlerTags(\n handler.config.simultaneousWith\n );\n\n RNGestureHandlerModule.updateGestureHandler(\n handler.handlerTag,\n filterConfig(handler.config, ALLOWED_PROPS, {\n simultaneousHandlers: simultaneousWith,\n waitFor: requireToFail,\n })\n );\n\n registerHandler(handler.handlerTag, handler);\n }\n\n if (preparedGesture.animatedHandlers) {\n preparedGesture.animatedHandlers.value = (preparedGesture.config.map(\n (g) => g.handlers\n ) as unknown) as HandlerCallbacks>[];\n }\n });\n}\n\nfunction needsToReattach(\n preparedGesture: GestureConfigReference,\n gesture: GestureType[]\n) {\n if (gesture.length !== preparedGesture.config.length) {\n return true;\n }\n for (let i = 0; i < gesture.length; i++) {\n if (gesture[i].handlerName !== preparedGesture.config[i].handlerName) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction useAnimatedGesture(preparedGesture: GestureConfigReference) {\n if (!Reanimated) {\n return;\n }\n\n function isStateChangeEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n ): event is GestureStateChangeEvent {\n 'worklet';\n // @ts-ignore Yes, the oldState prop is missing on GestureTouchEvent, that's the point\n return event.oldState != null;\n }\n\n function isTouchEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n ): event is GestureTouchEvent {\n 'worklet';\n return event.eventType != null;\n }\n\n function getHandler(\n type: CALLBACK_TYPE,\n gesture: HandlerCallbacks>\n ) {\n 'worklet';\n switch (type) {\n case CALLBACK_TYPE.BEGAN:\n return gesture.onBegin;\n case CALLBACK_TYPE.START:\n return gesture.onStart;\n case CALLBACK_TYPE.UPDATE:\n return gesture.onUpdate;\n case CALLBACK_TYPE.CHANGE:\n return gesture.onChange;\n case CALLBACK_TYPE.END:\n return gesture.onEnd;\n case CALLBACK_TYPE.FINALIZE:\n return gesture.onFinalize;\n case CALLBACK_TYPE.TOUCHES_DOWN:\n return gesture.onTouchesDown;\n case CALLBACK_TYPE.TOUCHES_MOVE:\n return gesture.onTouchesMove;\n case CALLBACK_TYPE.TOUCHES_UP:\n return gesture.onTouchesUp;\n case CALLBACK_TYPE.TOUCHES_CANCELLED:\n return gesture.onTouchesCancelled;\n }\n }\n\n function touchEventTypeToCallbackType(eventType: EventType): CALLBACK_TYPE {\n 'worklet';\n switch (eventType) {\n case EventType.TOUCHES_DOWN:\n return CALLBACK_TYPE.TOUCHES_DOWN;\n case EventType.TOUCHES_MOVE:\n return CALLBACK_TYPE.TOUCHES_MOVE;\n case EventType.TOUCHES_UP:\n return CALLBACK_TYPE.TOUCHES_UP;\n case EventType.TOUCHES_CANCELLED:\n return CALLBACK_TYPE.TOUCHES_CANCELLED;\n }\n return CALLBACK_TYPE.UNDEFINED;\n }\n\n function runWorklet(\n type: CALLBACK_TYPE,\n gesture: HandlerCallbacks>,\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent,\n ...args: any[]\n ) {\n 'worklet';\n const handler = getHandler(type, gesture);\n if (gesture.isWorklet[type]) {\n // @ts-ignore Logic below makes sure the correct event is send to the\n // correct handler.\n handler?.(event, ...args);\n } else if (handler) {\n console.warn('Animated gesture callback must be a worklet');\n }\n }\n\n // Hooks are called conditionally, but the condition is whether the\n // react-native-reanimated is installed, which shouldn't change while running\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const sharedHandlersCallbacks = Reanimated.useSharedValue<\n HandlerCallbacks>[] | null\n >(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const lastUpdateEvent = Reanimated.useSharedValue<\n (GestureUpdateEvent | undefined)[]\n >([]);\n\n // not every gesture needs a state controller, init them lazily\n const stateControllers: GestureStateManagerType[] = [];\n\n const callback = (\n event: GestureStateChangeEvent | GestureUpdateEvent | GestureTouchEvent\n ) => {\n 'worklet';\n\n const currentCallback = sharedHandlersCallbacks.value;\n if (!currentCallback) {\n return;\n }\n\n for (let i = 0; i < currentCallback.length; i++) {\n const gesture = currentCallback[i];\n\n if (event.handlerTag === gesture.handlerTag) {\n if (isStateChangeEvent(event)) {\n if (\n event.oldState === State.UNDETERMINED &&\n event.state === State.BEGAN\n ) {\n runWorklet(CALLBACK_TYPE.BEGAN, gesture, event);\n } else if (\n (event.oldState === State.BEGAN ||\n event.oldState === State.UNDETERMINED) &&\n event.state === State.ACTIVE\n ) {\n runWorklet(CALLBACK_TYPE.START, gesture, event);\n lastUpdateEvent.value[gesture.handlerTag] = undefined;\n } else if (\n event.oldState !== event.state &&\n event.state === State.END\n ) {\n if (event.oldState === State.ACTIVE) {\n runWorklet(CALLBACK_TYPE.END, gesture, event, true);\n }\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, true);\n } else if (\n (event.state === State.FAILED || event.state === State.CANCELLED) &&\n event.state !== event.oldState\n ) {\n if (event.oldState === State.ACTIVE) {\n runWorklet(CALLBACK_TYPE.END, gesture, event, false);\n }\n runWorklet(CALLBACK_TYPE.FINALIZE, gesture, event, false);\n }\n } else if (isTouchEvent(event)) {\n if (!stateControllers[i]) {\n stateControllers[i] = GestureStateManager.create(event.handlerTag);\n }\n\n if (event.eventType !== EventType.UNDETERMINED) {\n runWorklet(\n touchEventTypeToCallbackType(event.eventType),\n gesture,\n event,\n stateControllers[i]\n );\n }\n } else {\n runWorklet(CALLBACK_TYPE.UPDATE, gesture, event);\n\n if (gesture.onChange && gesture.changeEventCalculator) {\n runWorklet(\n CALLBACK_TYPE.CHANGE,\n gesture,\n gesture.changeEventCalculator?.(\n event,\n lastUpdateEvent.value[gesture.handlerTag]\n )\n );\n\n lastUpdateEvent.value[gesture.handlerTag] = event;\n }\n }\n }\n }\n };\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const event = Reanimated.useEvent(\n callback,\n ['onGestureHandlerStateChange', 'onGestureHandlerEvent'],\n true\n );\n\n preparedGesture.animatedEventHandler = event;\n preparedGesture.animatedHandlers = sharedHandlersCallbacks;\n}\n\ninterface GestureDetectorProps {\n gesture?: ComposedGesture | GestureType;\n}\nexport const GestureDetector: React.FunctionComponent = (\n props\n) => {\n const gestureConfig = props.gesture;\n const gesture = gestureConfig?.toGestureArray?.() ?? [];\n const useAnimated =\n gesture.find((gesture) =>\n gesture.handlers.isWorklet.reduce((prev, current) => prev || current)\n ) != null;\n const viewRef = useRef(null);\n const firstRenderRef = useRef(true);\n\n const preparedGesture = React.useRef({\n config: gesture,\n animatedEventHandler: null,\n animatedHandlers: null,\n firstExecution: true,\n useAnimated: useAnimated,\n }).current;\n\n if (useAnimated !== preparedGesture.useAnimated) {\n throw new Error(\n 'You cannot change whether you are using gesture or animatedGesture while the app is running'\n );\n }\n\n if (preparedGesture.firstExecution) {\n gestureConfig?.initialize?.();\n }\n\n if (useAnimated) {\n // Whether animatedGesture or gesture is used shouldn't change\n // during while an app is running\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useAnimatedGesture(preparedGesture);\n }\n\n useEffect(() => {\n firstRenderRef.current = true;\n const viewTag = findNodeHandle(viewRef.current) as number;\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n useAnimated,\n });\n\n return () => {\n dropHandlers(preparedGesture);\n };\n }, []);\n\n useEffect(() => {\n if (!firstRenderRef.current) {\n const viewTag = findNodeHandle(viewRef.current) as number;\n\n if (needsToReattach(preparedGesture, gesture)) {\n dropHandlers(preparedGesture);\n attachHandlers({\n preparedGesture,\n gestureConfig,\n gesture,\n viewTag,\n useAnimated,\n });\n } else {\n updateHandlers(preparedGesture, gestureConfig, gesture);\n }\n } else {\n firstRenderRef.current = false;\n }\n }, [props]);\n\n if (useAnimated) {\n return (\n \n {props.children}\n \n );\n } else {\n return {props.children};\n }\n};\n\nclass Wrap extends React.Component<{ onGestureHandlerEvent?: unknown }> {\n render() {\n // I don't think that fighting with types over such a simple function is worth it\n // The only thing it does is add 'collapsable: false' to the child component\n // to make sure it is in the native view hierarchy so the detector can find\n // correct viewTag to attach to.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const child: any = React.Children.only(this.props.children);\n\n return React.cloneElement(\n child,\n { collapsable: false },\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n child.props.children\n );\n }\n}\n\nconst AnimatedWrap = Reanimated?.default?.createAnimatedComponent(Wrap) ?? Wrap;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/eventReceiver.js b/lib/commonjs/handlers/gestures/eventReceiver.js
new file mode 100644
index 0000000000..a51d62ce8a
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/eventReceiver.js
@@ -0,0 +1,135 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.startListening = startListening;
+exports.stopListening = stopListening;
+
+var _reactNative = require("react-native");
+
+var _State = require("../../State");
+
+var _EventType = require("../../EventType");
+
+var _handlersRegistry = require("../handlersRegistry");
+
+let gestureHandlerEventSubscription = null;
+let gestureHandlerStateChangeEventSubscription = null;
+const dummyStateManager = {
+ begin: () => {
+ console.warn('You have to use react-native-reanimated in order to control the state of the gesture.');
+ },
+ activate: () => {
+ console.warn('You have to use react-native-reanimated in order to control the state of the gesture.');
+ },
+ end: () => {
+ console.warn('You have to use react-native-reanimated in order to control the state of the gesture.');
+ },
+ fail: () => {
+ console.warn('You have to use react-native-reanimated in order to control the state of the gesture.');
+ }
+};
+const lastUpdateEvent = [];
+
+function isStateChangeEvent(event) {
+ // @ts-ignore oldState doesn't exist on GestureTouchEvent and that's the point
+ return event.oldState != null;
+}
+
+function isTouchEvent(event) {
+ return event.eventType != null;
+}
+
+function onGestureHandlerEvent(event) {
+ var _handler$handlers7, _handler$handlers7$on, _handler$handlers8, _handler$handlers8$on, _handler$handlers9, _handler$handlers9$on, _handler$handlers10, _handler$handlers10$o;
+
+ const handler = (0, _handlersRegistry.findHandler)(event.handlerTag);
+
+ if (handler) {
+ if (isStateChangeEvent(event)) {
+ if (event.oldState === _State.State.UNDETERMINED && event.state === _State.State.BEGAN) {
+ var _handler$handlers$onB, _handler$handlers;
+
+ (_handler$handlers$onB = (_handler$handlers = handler.handlers).onBegin) === null || _handler$handlers$onB === void 0 ? void 0 : _handler$handlers$onB.call(_handler$handlers, event);
+ } else if ((event.oldState === _State.State.BEGAN || event.oldState === _State.State.UNDETERMINED) && event.state === _State.State.ACTIVE) {
+ var _handler$handlers$onS, _handler$handlers2;
+
+ (_handler$handlers$onS = (_handler$handlers2 = handler.handlers).onStart) === null || _handler$handlers$onS === void 0 ? void 0 : _handler$handlers$onS.call(_handler$handlers2, event);
+ lastUpdateEvent[handler.handlers.handlerTag] = event;
+ } else if (event.oldState !== event.state && event.state === _State.State.END) {
+ var _handler$handlers$onF, _handler$handlers4;
+
+ if (event.oldState === _State.State.ACTIVE) {
+ var _handler$handlers$onE, _handler$handlers3;
+
+ (_handler$handlers$onE = (_handler$handlers3 = handler.handlers).onEnd) === null || _handler$handlers$onE === void 0 ? void 0 : _handler$handlers$onE.call(_handler$handlers3, event, true);
+ }
+
+ (_handler$handlers$onF = (_handler$handlers4 = handler.handlers).onFinalize) === null || _handler$handlers$onF === void 0 ? void 0 : _handler$handlers$onF.call(_handler$handlers4, event, true);
+ lastUpdateEvent[handler.handlers.handlerTag] = undefined;
+ } else if ((event.state === _State.State.FAILED || event.state === _State.State.CANCELLED) && event.oldState !== event.state) {
+ var _handler$handlers$onF2, _handler$handlers6;
+
+ if (event.oldState === _State.State.ACTIVE) {
+ var _handler$handlers$onE2, _handler$handlers5;
+
+ (_handler$handlers$onE2 = (_handler$handlers5 = handler.handlers).onEnd) === null || _handler$handlers$onE2 === void 0 ? void 0 : _handler$handlers$onE2.call(_handler$handlers5, event, false);
+ }
+
+ (_handler$handlers$onF2 = (_handler$handlers6 = handler.handlers).onFinalize) === null || _handler$handlers$onF2 === void 0 ? void 0 : _handler$handlers$onF2.call(_handler$handlers6, event, false);
+ lastUpdateEvent[handler.handlers.handlerTag] = undefined;
+ }
+ } else if (isTouchEvent(event)) {
+ switch (event.eventType) {
+ case _EventType.EventType.TOUCHES_DOWN:
+ (_handler$handlers7 = handler.handlers) === null || _handler$handlers7 === void 0 ? void 0 : (_handler$handlers7$on = _handler$handlers7.onTouchesDown) === null || _handler$handlers7$on === void 0 ? void 0 : _handler$handlers7$on.call(_handler$handlers7, event, dummyStateManager);
+ break;
+
+ case _EventType.EventType.TOUCHES_MOVE:
+ (_handler$handlers8 = handler.handlers) === null || _handler$handlers8 === void 0 ? void 0 : (_handler$handlers8$on = _handler$handlers8.onTouchesMove) === null || _handler$handlers8$on === void 0 ? void 0 : _handler$handlers8$on.call(_handler$handlers8, event, dummyStateManager);
+ break;
+
+ case _EventType.EventType.TOUCHES_UP:
+ (_handler$handlers9 = handler.handlers) === null || _handler$handlers9 === void 0 ? void 0 : (_handler$handlers9$on = _handler$handlers9.onTouchesUp) === null || _handler$handlers9$on === void 0 ? void 0 : _handler$handlers9$on.call(_handler$handlers9, event, dummyStateManager);
+ break;
+
+ case _EventType.EventType.TOUCHES_CANCELLED:
+ (_handler$handlers10 = handler.handlers) === null || _handler$handlers10 === void 0 ? void 0 : (_handler$handlers10$o = _handler$handlers10.onTouchesCancelled) === null || _handler$handlers10$o === void 0 ? void 0 : _handler$handlers10$o.call(_handler$handlers10, event, dummyStateManager);
+ break;
+ }
+ } else {
+ var _handler$handlers$onU, _handler$handlers11;
+
+ (_handler$handlers$onU = (_handler$handlers11 = handler.handlers).onUpdate) === null || _handler$handlers$onU === void 0 ? void 0 : _handler$handlers$onU.call(_handler$handlers11, event);
+
+ if (handler.handlers.onChange && handler.handlers.changeEventCalculator) {
+ var _handler$handlers$onC, _handler$handlers12, _handler$handlers$cha, _handler$handlers13;
+
+ (_handler$handlers$onC = (_handler$handlers12 = handler.handlers).onChange) === null || _handler$handlers$onC === void 0 ? void 0 : _handler$handlers$onC.call(_handler$handlers12, (_handler$handlers$cha = (_handler$handlers13 = handler.handlers).changeEventCalculator) === null || _handler$handlers$cha === void 0 ? void 0 : _handler$handlers$cha.call(_handler$handlers13, event, lastUpdateEvent[handler.handlers.handlerTag]));
+ lastUpdateEvent[handler.handlers.handlerTag] = event;
+ }
+ }
+ }
+}
+
+function startListening() {
+ stopListening();
+ gestureHandlerEventSubscription = _reactNative.DeviceEventEmitter.addListener('onGestureHandlerEvent', onGestureHandlerEvent);
+ gestureHandlerStateChangeEventSubscription = _reactNative.DeviceEventEmitter.addListener('onGestureHandlerStateChange', onGestureHandlerEvent);
+}
+
+function stopListening() {
+ if (gestureHandlerEventSubscription) {
+ _reactNative.DeviceEventEmitter.removeSubscription(gestureHandlerEventSubscription);
+
+ gestureHandlerEventSubscription = null;
+ }
+
+ if (gestureHandlerStateChangeEventSubscription) {
+ _reactNative.DeviceEventEmitter.removeSubscription(gestureHandlerStateChangeEventSubscription);
+
+ gestureHandlerStateChangeEventSubscription = null;
+ }
+}
+//# sourceMappingURL=eventReceiver.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/eventReceiver.js.map b/lib/commonjs/handlers/gestures/eventReceiver.js.map
new file mode 100644
index 0000000000..f1fe7812a8
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/eventReceiver.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["eventReceiver.ts"],"names":["gestureHandlerEventSubscription","gestureHandlerStateChangeEventSubscription","dummyStateManager","begin","console","warn","activate","end","fail","lastUpdateEvent","isStateChangeEvent","event","oldState","isTouchEvent","eventType","onGestureHandlerEvent","handler","handlerTag","State","UNDETERMINED","state","BEGAN","handlers","onBegin","ACTIVE","onStart","END","onEnd","onFinalize","undefined","FAILED","CANCELLED","EventType","TOUCHES_DOWN","onTouchesDown","TOUCHES_MOVE","onTouchesMove","TOUCHES_UP","onTouchesUp","TOUCHES_CANCELLED","onTouchesCancelled","onUpdate","onChange","changeEventCalculator","startListening","stopListening","DeviceEventEmitter","addListener","removeSubscription"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AAOA;;AAGA,IAAIA,+BAA2D,GAAG,IAAlE;AACA,IAAIC,0CAAsE,GAAG,IAA7E;AAEA,MAAMC,iBAA0C,GAAG;AACjDC,EAAAA,KAAK,EAAE,MAAM;AACXC,IAAAA,OAAO,CAACC,IAAR,CACE,uFADF;AAGD,G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ceEventEmitter, EmitterSubscription } from 'react-native';\nimport { State } from '../../State';\nimport { EventType } from '../../EventType';\nimport {\n GestureTouchEvent,\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from '../gestureHandlerCommon';\nimport { GestureStateManagerType } from './gestureStateManager';\nimport { findHandler } from '../handlersRegistry';\nimport { BaseGesture } from './gesture';\n\nlet gestureHandlerEventSubscription: EmitterSubscription | null = null;\nlet gestureHandlerStateChangeEventSubscription: EmitterSubscription | null = null;\n\nconst dummyStateManager: GestureStateManagerType = {\n begin: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n activate: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n end: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n fail: () => {\n console.warn(\n 'You have to use react-native-reanimated in order to control the state of the gesture.'\n );\n },\n};\n\nconst lastUpdateEvent: (GestureUpdateEvent | undefined)[] = [];\n\nfunction isStateChangeEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureStateChangeEvent {\n // @ts-ignore oldState doesn't exist on GestureTouchEvent and that's the point\n return event.oldState != null;\n}\n\nfunction isTouchEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n): event is GestureTouchEvent {\n return event.eventType != null;\n}\n\nfunction onGestureHandlerEvent(\n event: GestureUpdateEvent | GestureStateChangeEvent | GestureTouchEvent\n) {\n const handler = findHandler(event.handlerTag) as BaseGesture<\n Record\n >;\n\n if (handler) {\n if (isStateChangeEvent(event)) {\n if (\n event.oldState === State.UNDETERMINED &&\n event.state === State.BEGAN\n ) {\n handler.handlers.onBegin?.(event);\n } else if (\n (event.oldState === State.BEGAN ||\n event.oldState === State.UNDETERMINED) &&\n event.state === State.ACTIVE\n ) {\n handler.handlers.onStart?.(event);\n lastUpdateEvent[handler.handlers.handlerTag] = event;\n } else if (event.oldState !== event.state && event.state === State.END) {\n if (event.oldState === State.ACTIVE) {\n handler.handlers.onEnd?.(event, true);\n }\n handler.handlers.onFinalize?.(event, true);\n lastUpdateEvent[handler.handlers.handlerTag] = undefined;\n } else if (\n (event.state === State.FAILED || event.state === State.CANCELLED) &&\n event.oldState !== event.state\n ) {\n if (event.oldState === State.ACTIVE) {\n handler.handlers.onEnd?.(event, false);\n }\n handler.handlers.onFinalize?.(event, false);\n lastUpdateEvent[handler.handlers.handlerTag] = undefined;\n }\n } else if (isTouchEvent(event)) {\n switch (event.eventType) {\n case EventType.TOUCHES_DOWN:\n handler.handlers?.onTouchesDown?.(event, dummyStateManager);\n break;\n case EventType.TOUCHES_MOVE:\n handler.handlers?.onTouchesMove?.(event, dummyStateManager);\n break;\n case EventType.TOUCHES_UP:\n handler.handlers?.onTouchesUp?.(event, dummyStateManager);\n break;\n case EventType.TOUCHES_CANCELLED:\n handler.handlers?.onTouchesCancelled?.(event, dummyStateManager);\n break;\n }\n } else {\n handler.handlers.onUpdate?.(event);\n\n if (handler.handlers.onChange && handler.handlers.changeEventCalculator) {\n handler.handlers.onChange?.(\n handler.handlers.changeEventCalculator?.(\n event,\n lastUpdateEvent[handler.handlers.handlerTag]\n )\n );\n\n lastUpdateEvent[handler.handlers.handlerTag] = event;\n }\n }\n }\n}\n\nexport function startListening() {\n stopListening();\n\n gestureHandlerEventSubscription = DeviceEventEmitter.addListener(\n 'onGestureHandlerEvent',\n onGestureHandlerEvent\n );\n\n gestureHandlerStateChangeEventSubscription = DeviceEventEmitter.addListener(\n 'onGestureHandlerStateChange',\n onGestureHandlerEvent\n );\n}\n\nexport function stopListening() {\n if (gestureHandlerEventSubscription) {\n DeviceEventEmitter.removeSubscription(gestureHandlerEventSubscription);\n\n gestureHandlerEventSubscription = null;\n }\n\n if (gestureHandlerStateChangeEventSubscription) {\n DeviceEventEmitter.removeSubscription(\n gestureHandlerStateChangeEventSubscription\n );\n\n gestureHandlerStateChangeEventSubscription = null;\n }\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/flingGesture.js b/lib/commonjs/handlers/gestures/flingGesture.js
new file mode 100644
index 0000000000..4deac4cf39
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/flingGesture.js
@@ -0,0 +1,34 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.FlingGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+class FlingGesture extends _gesture.BaseGesture {
+ constructor() {
+ super();
+
+ _defineProperty(this, "config", {});
+
+ this.handlerName = 'FlingGestureHandler';
+ }
+
+ numberOfPointers(pointers) {
+ this.config.numberOfPointers = pointers;
+ return this;
+ }
+
+ direction(direction) {
+ this.config.direction = direction;
+ return this;
+ }
+
+}
+
+exports.FlingGesture = FlingGesture;
+//# sourceMappingURL=flingGesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/flingGesture.js.map b/lib/commonjs/handlers/gestures/flingGesture.js.map
new file mode 100644
index 0000000000..074539a670
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/flingGesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["flingGesture.ts"],"names":["FlingGesture","BaseGesture","constructor","handlerName","numberOfPointers","pointers","config","direction"],"mappings":";;;;;;;AAAA;;;;AAMO,MAAMA,YAAN,SAA2BC,oBAA3B,CAAwE;AAG7EC,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF0C,EAE1C;;AAGZ,SAAKC,WAAL,GAAmB,qBAAnB;AACD;;AAEDC,EAAAA,gBAAgB,CAACC,QAAD,EAAmB;AACjC,SAAKC,MAAL,CAAYF,gBAAZ,GAA+BC,QAA/B;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,SAAS,CAACA,SAAD,EAAoB;AAC3B,SAAKD,MAAL,CAAYC,SAAZ,GAAwBA,SAAxB;AACA,WAAO,IAAP;AACD;;AAjB4E","sourcesContent":["import { BaseGesture, BaseGestureConfig } from './gesture';\nimport {\n FlingGestureConfig,\n FlingGestureHandlerEventPayload,\n} from '../FlingGestureHandler';\n\nexport class FlingGesture extends BaseGesture {\n public config: BaseGestureConfig & FlingGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'FlingGestureHandler';\n }\n\n numberOfPointers(pointers: number) {\n this.config.numberOfPointers = pointers;\n return this;\n }\n\n direction(direction: number) {\n this.config.direction = direction;\n return this;\n }\n}\n\nexport type FlingGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/forceTouchGesture.js b/lib/commonjs/handlers/gestures/forceTouchGesture.js
new file mode 100644
index 0000000000..5dbd1c5d15
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/forceTouchGesture.js
@@ -0,0 +1,65 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ForceTouchGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+function changeEventCalculator(current, previous) {
+ 'worklet';
+
+ let changePayload;
+
+ if (previous === undefined) {
+ changePayload = {
+ forceChange: current.force
+ };
+ } else {
+ changePayload = {
+ forceChange: current.force - previous.force
+ };
+ }
+
+ return { ...current,
+ ...changePayload
+ };
+}
+
+class ForceTouchGesture extends _gesture.ContinousBaseGesture {
+ constructor() {
+ super();
+
+ _defineProperty(this, "config", {});
+
+ this.handlerName = 'ForceTouchGestureHandler';
+ }
+
+ minForce(force) {
+ this.config.minForce = force;
+ return this;
+ }
+
+ maxForce(force) {
+ this.config.maxForce = force;
+ return this;
+ }
+
+ feedbackOnActivation(value) {
+ this.config.feedbackOnActivation = value;
+ return this;
+ }
+
+ onChange(callback) {
+ // @ts-ignore TS being overprotective, ForceTouchGestureHandlerEventPayload is Record
+ this.handlers.changeEventCalculator = changeEventCalculator;
+ return super.onChange(callback);
+ }
+
+}
+
+exports.ForceTouchGesture = ForceTouchGesture;
+//# sourceMappingURL=forceTouchGesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/forceTouchGesture.js.map b/lib/commonjs/handlers/gestures/forceTouchGesture.js.map
new file mode 100644
index 0000000000..3655a312db
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/forceTouchGesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["forceTouchGesture.ts"],"names":["changeEventCalculator","current","previous","changePayload","undefined","forceChange","force","ForceTouchGesture","ContinousBaseGesture","constructor","handlerName","minForce","config","maxForce","feedbackOnActivation","value","onChange","callback","handlers"],"mappings":";;;;;;;AAAA;;;;AAWA,SAASA,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK;AADP,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK,KAAR,GAAgBJ,QAAQ,CAACI;AADxB,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAEM,MAAMI,iBAAN,SAAgCC,6BAAhC,CAGL;AAGAC,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF+C,EAE/C;;AAGZ,SAAKC,WAAL,GAAmB,0BAAnB;AACD;;AAEDC,EAAAA,QAAQ,CAACL,KAAD,EAAgB;AACtB,SAAKM,MAAL,CAAYD,QAAZ,GAAuBL,KAAvB;AACA,WAAO,IAAP;AACD;;AAEDO,EAAAA,QAAQ,CAACP,KAAD,EAAgB;AACtB,SAAKM,MAAL,CAAYC,QAAZ,GAAuBP,KAAvB;AACA,WAAO,IAAP;AACD;;AAEDQ,EAAAA,oBAAoB,CAACC,KAAD,EAAiB;AACnC,SAAKH,MAAL,CAAYE,oBAAZ,GAAmCC,KAAnC;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EASN;AACA;AACA,SAAKC,QAAL,CAAclB,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMgB,QAAN,CAAeC,QAAf,CAAP;AACD;;AArCD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\nimport {\n ForceTouchGestureConfig,\n ForceTouchGestureHandlerEventPayload,\n} from '../ForceTouchGestureHandler';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\ntype ForceTouchGestureChangeEventPayload = {\n forceChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent,\n previous?: GestureUpdateEvent\n) {\n 'worklet';\n let changePayload: ForceTouchGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n forceChange: current.force,\n };\n } else {\n changePayload = {\n forceChange: current.force - previous.force,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class ForceTouchGesture extends ContinousBaseGesture<\n ForceTouchGestureHandlerEventPayload,\n ForceTouchGestureChangeEventPayload\n> {\n public config: BaseGestureConfig & ForceTouchGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'ForceTouchGestureHandler';\n }\n\n minForce(force: number) {\n this.config.minForce = force;\n return this;\n }\n\n maxForce(force: number) {\n this.config.maxForce = force;\n return this;\n }\n\n feedbackOnActivation(value: boolean) {\n this.config.feedbackOnActivation = value;\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n GestureUpdateEvent<\n ForceTouchGestureHandlerEventPayload &\n ForceTouchGestureChangeEventPayload\n >\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, ForceTouchGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type ForceTouchGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/gesture.js b/lib/commonjs/handlers/gestures/gesture.js
new file mode 100644
index 0000000000..2b3e5e42be
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/gesture.js
@@ -0,0 +1,193 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ContinousBaseGesture = exports.BaseGesture = exports.Gesture = exports.CALLBACK_TYPE = void 0;
+
+var _handlersRegistry = require("../handlersRegistry");
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+const CALLBACK_TYPE = {
+ UNDEFINED: 0,
+ BEGAN: 1,
+ START: 2,
+ UPDATE: 3,
+ CHANGE: 4,
+ END: 5,
+ FINALIZE: 6,
+ TOUCHES_DOWN: 7,
+ TOUCHES_MOVE: 8,
+ TOUCHES_UP: 9,
+ TOUCHES_CANCELLED: 10
+}; // Allow using CALLBACK_TYPE as object and type
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+
+exports.CALLBACK_TYPE = CALLBACK_TYPE;
+
+class Gesture {}
+
+exports.Gesture = Gesture;
+
+class BaseGesture extends Gesture {
+ constructor(...args) {
+ super(...args);
+
+ _defineProperty(this, "handlerTag", -1);
+
+ _defineProperty(this, "handlerName", '');
+
+ _defineProperty(this, "config", {});
+
+ _defineProperty(this, "handlers", {
+ handlerTag: -1,
+ isWorklet: [false, false, false, false]
+ });
+ }
+
+ addDependency(key, gesture) {
+ const value = this.config[key];
+ this.config[key] = value ? Array().concat(value, gesture) : [gesture];
+ }
+
+ withRef(ref) {
+ this.config.ref = ref;
+ return this;
+ } // eslint-disable-next-line @typescript-eslint/ban-types
+
+
+ isWorklet(callback) {
+ //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
+ return callback.__workletHash !== undefined;
+ }
+
+ onBegin(callback) {
+ this.handlers.onBegin = callback;
+ this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);
+ return this;
+ }
+
+ onStart(callback) {
+ this.handlers.onStart = callback;
+ this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);
+ return this;
+ }
+
+ onEnd(callback) {
+ this.handlers.onEnd = callback; //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
+
+ this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);
+ return this;
+ }
+
+ onFinalize(callback) {
+ this.handlers.onFinalize = callback; //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false
+
+ this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);
+ return this;
+ }
+
+ onTouchesDown(callback) {
+ this.config.needsPointerData = true;
+ this.handlers.onTouchesDown = callback;
+ this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] = this.isWorklet(callback);
+ return this;
+ }
+
+ onTouchesMove(callback) {
+ this.config.needsPointerData = true;
+ this.handlers.onTouchesMove = callback;
+ this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] = this.isWorklet(callback);
+ return this;
+ }
+
+ onTouchesUp(callback) {
+ this.config.needsPointerData = true;
+ this.handlers.onTouchesUp = callback;
+ this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] = this.isWorklet(callback);
+ return this;
+ }
+
+ onTouchesCancelled(callback) {
+ this.config.needsPointerData = true;
+ this.handlers.onTouchesCancelled = callback;
+ this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] = this.isWorklet(callback);
+ return this;
+ }
+
+ enabled(enabled) {
+ this.config.enabled = enabled;
+ return this;
+ }
+
+ shouldCancelWhenOutside(value) {
+ this.config.shouldCancelWhenOutside = value;
+ return this;
+ }
+
+ hitSlop(hitSlop) {
+ this.config.hitSlop = hitSlop;
+ return this;
+ }
+
+ simultaneousWithExternalGesture(...gestures) {
+ for (const gesture of gestures) {
+ this.addDependency('simultaneousWith', gesture);
+ }
+
+ return this;
+ }
+
+ requireExternalGestureToFail(...gestures) {
+ for (const gesture of gestures) {
+ this.addDependency('requireToFail', gesture);
+ }
+
+ return this;
+ }
+
+ initialize() {
+ this.handlerTag = (0, _handlersRegistry.getNextHandlerTag)();
+ this.handlers = { ...this.handlers,
+ handlerTag: this.handlerTag
+ };
+
+ if (this.config.ref) {
+ this.config.ref.current = this;
+ }
+ }
+
+ toGestureArray() {
+ return [this];
+ } // eslint-disable-next-line @typescript-eslint/no-empty-function
+
+
+ prepare() {}
+
+}
+
+exports.BaseGesture = BaseGesture;
+
+class ContinousBaseGesture extends BaseGesture {
+ onUpdate(callback) {
+ this.handlers.onUpdate = callback;
+ this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);
+ return this;
+ }
+
+ onChange(callback) {
+ this.handlers.onChange = callback;
+ this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);
+ return this;
+ }
+
+ manualActivation(manualActivation) {
+ this.config.manualActivation = manualActivation;
+ return this;
+ }
+
+}
+
+exports.ContinousBaseGesture = ContinousBaseGesture;
+//# sourceMappingURL=gesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/gesture.js.map b/lib/commonjs/handlers/gestures/gesture.js.map
new file mode 100644
index 0000000000..aad27d9fde
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/gesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["gesture.ts"],"names":["CALLBACK_TYPE","UNDEFINED","BEGAN","START","UPDATE","CHANGE","END","FINALIZE","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED","Gesture","BaseGesture","handlerTag","isWorklet","addDependency","key","gesture","value","config","Array","concat","withRef","ref","callback","__workletHash","undefined","onBegin","handlers","onStart","onEnd","onFinalize","onTouchesDown","needsPointerData","onTouchesMove","onTouchesUp","onTouchesCancelled","enabled","shouldCancelWhenOutside","hitSlop","simultaneousWithExternalGesture","gestures","requireExternalGestureToFail","initialize","current","toGestureArray","prepare","ContinousBaseGesture","onUpdate","onChange","manualActivation"],"mappings":";;;;;;;AASA;;;;AAkEO,MAAMA,aAAa,GAAG;AAC3BC,EAAAA,SAAS,EAAE,CADgB;AAE3BC,EAAAA,KAAK,EAAE,CAFoB;AAG3BC,EAAAA,KAAK,EAAE,CAHoB;AAI3BC,EAAAA,MAAM,EAAE,CAJmB;AAK3BC,EAAAA,MAAM,EAAE,CALmB;AAM3BC,EAAAA,GAAG,EAAE,CANsB;AAO3BC,EAAAA,QAAQ,EAAE,CAPiB;AAQ3BC,EAAAA,YAAY,EAAE,CARa;AAS3BC,EAAAA,YAAY,EAAE,CATa;AAU3BC,EAAAA,UAAU,EAAE,CAVe;AAW3BC,EAAAA,iBAAiB,EAAE;AAXQ,CAAtB,C,CAcP;AACA;;;;AAGO,MAAeC,OAAf,CAAuB;;;;AAoBvB,MAAeC,WAAf,SAEGD,OAFH,CAEW;AAAA;AAAA;;AAAA,wCACI,CAAC,CADL;;AAAA,yCAEK,EAFL;;AAAA,oCAGmB,EAHnB;;AAAA,sCAImC;AACjDE,MAAAA,UAAU,EAAE,CAAC,CADoC;AAEjDC,MAAAA,SAAS,EAAE,CAAC,KAAD,EAAQ,KAAR,EAAe,KAAf,EAAsB,KAAtB;AAFsC,KAJnC;AAAA;;AASRC,EAAAA,aAAa,CACnBC,GADmB,EAEnBC,OAFmB,EAGnB;AACA,UAAMC,KAAK,GAAG,KAAKC,MAAL,CAAYH,GAAZ,CAAd;AACA,SAAKG,MAAL,CAAYH,GAAZ,IAAmBE,KAAK,GACpBE,KAAK,GAAeC,MAApB,CAA2BH,KAA3B,EAAkCD,OAAlC,CADoB,GAEpB,CAACA,OAAD,CAFJ;AAGD;;AAEDK,EAAAA,OAAO,CAACC,GAAD,EAAuD;AAC5D,SAAKJ,MAAL,CAAYI,GAAZ,GAAkBA,GAAlB;AACA,WAAO,IAAP;AACD,GAtBe,CAwBhB;;;AACUT,EAAAA,SAAS,CA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IAAP;AACD;;AApBkC","sourcesContent":["import { FlingGestureHandlerEventPayload } from '../FlingGestureHandler';\nimport { ForceTouchGestureHandlerEventPayload } from '../ForceTouchGestureHandler';\nimport {\n HitSlop,\n CommonGestureConfig,\n GestureTouchEvent,\n GestureStateChangeEvent,\n GestureUpdateEvent,\n} from '../gestureHandlerCommon';\nimport { getNextHandlerTag } from '../handlersRegistry';\nimport { GestureStateManagerType } from './gestureStateManager';\nimport { LongPressGestureHandlerEventPayload } from '../LongPressGestureHandler';\nimport { PanGestureHandlerEventPayload } from '../PanGestureHandler';\nimport { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';\nimport { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';\nimport { TapGestureHandlerEventPayload } from '../TapGestureHandler';\nimport { NativeViewGestureHandlerPayload } from '../NativeViewGestureHandler';\n\nexport type GestureType =\n | BaseGesture>\n | BaseGesture>\n | BaseGesture\n | BaseGesture\n | BaseGesture\n | BaseGesture\n | BaseGesture\n | BaseGesture\n | BaseGesture\n | BaseGesture;\n\nexport type GestureRef =\n | number\n | GestureType\n | React.RefObject\n | React.RefObject; // allow adding a ref to a gesture handler\nexport interface BaseGestureConfig\n extends CommonGestureConfig,\n Record {\n ref?: React.MutableRefObject;\n requireToFail?: GestureRef[];\n simultaneousWith?: GestureRef[];\n needsPointerData?: boolean;\n manualActivation?: boolean;\n}\n\ntype TouchEventHandlerType = (\n event: GestureTouchEvent,\n stateManager: GestureStateManagerType\n) => void;\n\nexport type HandlerCallbacks> = {\n handlerTag: number;\n onBegin?: (event: GestureStateChangeEvent) => void;\n onStart?: (event: GestureStateChangeEvent) => void;\n onEnd?: (\n event: GestureStateChangeEvent,\n success: boolean\n ) => void;\n onFinalize?: (\n event: GestureStateChangeEvent,\n success: boolean\n ) => void;\n onUpdate?: (event: GestureUpdateEvent) => void;\n onChange?: (event: any) => void;\n onTouchesDown?: TouchEventHandlerType;\n onTouchesMove?: TouchEventHandlerType;\n onTouchesUp?: TouchEventHandlerType;\n onTouchesCancelled?: TouchEventHandlerType;\n changeEventCalculator?: (\n current: GestureUpdateEvent>,\n previous?: GestureUpdateEvent>\n ) => GestureUpdateEvent>;\n isWorklet: boolean[];\n};\n\nexport const CALLBACK_TYPE = {\n UNDEFINED: 0,\n BEGAN: 1,\n START: 2,\n UPDATE: 3,\n CHANGE: 4,\n END: 5,\n FINALIZE: 6,\n TOUCHES_DOWN: 7,\n TOUCHES_MOVE: 8,\n TOUCHES_UP: 9,\n TOUCHES_CANCELLED: 10,\n} as const;\n\n// Allow using CALLBACK_TYPE as object and type\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type CALLBACK_TYPE = typeof CALLBACK_TYPE[keyof typeof CALLBACK_TYPE];\n\nexport abstract class Gesture {\n /**\n * Return array of gestures, providing the same interface for creating and updating\n * handlers, no matter which object was used to create gesture instance.\n */\n abstract toGestureArray(): GestureType[];\n\n /**\n * Assign handlerTag to the gesture instance and set ref.current (if a ref is set)\n */\n abstract initialize(): void;\n\n /**\n * Make sure that values of properties defining relations are arrays. Do any necessary\n * preprocessing required to configure relations between handlers. Called just before\n * updating the handler on the native side.\n */\n abstract prepare(): void;\n}\n\nexport abstract class BaseGesture<\n EventPayloadT extends Record\n> extends Gesture {\n public handlerTag = -1;\n public handlerName = '';\n public config: BaseGestureConfig = {};\n public handlers: HandlerCallbacks = {\n handlerTag: -1,\n isWorklet: [false, false, false, false],\n };\n\n private addDependency(\n key: 'simultaneousWith' | 'requireToFail',\n gesture: Exclude\n ) {\n const value = this.config[key];\n this.config[key] = value\n ? Array().concat(value, gesture)\n : [gesture];\n }\n\n withRef(ref: React.MutableRefObject) {\n this.config.ref = ref;\n return this;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n protected isWorklet(callback: Function) {\n //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n return callback.__workletHash !== undefined;\n }\n\n onBegin(callback: (event: GestureStateChangeEvent) => void) {\n this.handlers.onBegin = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.BEGAN] = this.isWorklet(callback);\n return this;\n }\n\n onStart(callback: (event: GestureStateChangeEvent) => void) {\n this.handlers.onStart = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.START] = this.isWorklet(callback);\n return this;\n }\n\n onEnd(\n callback: (\n event: GestureStateChangeEvent,\n success: boolean\n ) => void\n ) {\n this.handlers.onEnd = callback;\n //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.END] = this.isWorklet(callback);\n return this;\n }\n\n onFinalize(\n callback: (\n event: GestureStateChangeEvent,\n success: boolean\n ) => void\n ) {\n this.handlers.onFinalize = callback;\n //@ts-ignore if callback is a worklet, the property will be available, if not then the check will return false\n this.handlers.isWorklet[CALLBACK_TYPE.FINALIZE] = this.isWorklet(callback);\n return this;\n }\n\n onTouchesDown(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesDown = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_DOWN] = this.isWorklet(\n callback\n );\n\n return this;\n }\n\n onTouchesMove(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesMove = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_MOVE] = this.isWorklet(\n callback\n );\n\n return this;\n }\n\n onTouchesUp(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesUp = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_UP] = this.isWorklet(\n callback\n );\n\n return this;\n }\n\n onTouchesCancelled(callback: TouchEventHandlerType) {\n this.config.needsPointerData = true;\n this.handlers.onTouchesCancelled = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.TOUCHES_CANCELLED] = this.isWorklet(\n callback\n );\n\n return this;\n }\n\n enabled(enabled: boolean) {\n this.config.enabled = enabled;\n return this;\n }\n\n shouldCancelWhenOutside(value: boolean) {\n this.config.shouldCancelWhenOutside = value;\n return this;\n }\n\n hitSlop(hitSlop: HitSlop) {\n this.config.hitSlop = hitSlop;\n return this;\n }\n\n simultaneousWithExternalGesture(...gestures: Exclude[]) {\n for (const gesture of gestures) {\n this.addDependency('simultaneousWith', gesture);\n }\n return this;\n }\n\n requireExternalGestureToFail(...gestures: Exclude[]) {\n for (const gesture of gestures) {\n this.addDependency('requireToFail', gesture);\n }\n return this;\n }\n\n initialize() {\n this.handlerTag = getNextHandlerTag();\n this.handlers = { ...this.handlers, handlerTag: this.handlerTag };\n\n if (this.config.ref) {\n this.config.ref.current = this as GestureType;\n }\n }\n\n toGestureArray(): GestureType[] {\n return [this as GestureType];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n prepare() {}\n}\n\nexport abstract class ContinousBaseGesture<\n EventPayloadT extends Record,\n EventChangePayloadT extends Record\n> extends BaseGesture {\n onUpdate(callback: (event: GestureUpdateEvent) => void) {\n this.handlers.onUpdate = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.UPDATE] = this.isWorklet(callback);\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent\n ) => void\n ) {\n this.handlers.onChange = callback;\n this.handlers.isWorklet[CALLBACK_TYPE.CHANGE] = this.isWorklet(callback);\n return this;\n }\n\n manualActivation(manualActivation: boolean) {\n this.config.manualActivation = manualActivation;\n return this;\n }\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/gestureComposition.js b/lib/commonjs/handlers/gestures/gestureComposition.js
new file mode 100644
index 0000000000..c582b8e916
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/gestureComposition.js
@@ -0,0 +1,94 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ExclusiveGesture = exports.SimultaneousGesture = exports.ComposedGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+function extendRelation(currentRelation, extendWith) {
+ if (currentRelation === undefined) {
+ return [...extendWith];
+ } else {
+ return [...currentRelation, ...extendWith];
+ }
+}
+
+class ComposedGesture extends _gesture.Gesture {
+ constructor(...gestures) {
+ super();
+
+ _defineProperty(this, "gestures", []);
+
+ _defineProperty(this, "simultaneousGestures", []);
+
+ _defineProperty(this, "requireGesturesToFail", []);
+
+ this.gestures = gestures;
+ }
+
+ prepareSingleGesture(gesture, simultaneousGestures, requireGesturesToFail) {
+ if (gesture instanceof _gesture.BaseGesture) {
+ const newConfig = { ...gesture.config
+ };
+ newConfig.simultaneousWith = extendRelation(newConfig.simultaneousWith, simultaneousGestures);
+ newConfig.requireToFail = extendRelation(newConfig.requireToFail, requireGesturesToFail);
+ gesture.config = newConfig;
+ } else if (gesture instanceof ComposedGesture) {
+ gesture.simultaneousGestures = simultaneousGestures;
+ gesture.requireGesturesToFail = requireGesturesToFail;
+ gesture.prepare();
+ }
+ }
+
+ prepare() {
+ for (const gesture of this.gestures) {
+ this.prepareSingleGesture(gesture, this.simultaneousGestures, this.requireGesturesToFail);
+ }
+ }
+
+ initialize() {
+ for (const gesture of this.gestures) {
+ gesture.initialize();
+ }
+ }
+
+ toGestureArray() {
+ return this.gestures.flatMap(gesture => gesture.toGestureArray());
+ }
+
+}
+
+exports.ComposedGesture = ComposedGesture;
+
+class SimultaneousGesture extends ComposedGesture {
+ prepare() {
+ const simultaneousArray = this.gestures.flatMap(gesture => gesture.toGestureArray()).concat(this.simultaneousGestures);
+
+ for (const gesture of this.gestures) {
+ this.prepareSingleGesture(gesture, simultaneousArray, this.requireGesturesToFail);
+ }
+ }
+
+}
+
+exports.SimultaneousGesture = SimultaneousGesture;
+
+class ExclusiveGesture extends ComposedGesture {
+ prepare() {
+ const gestureArrays = this.gestures.map(gesture => gesture.toGestureArray());
+ let requireToFail = [];
+
+ for (let i = 0; i < this.gestures.length; i++) {
+ this.prepareSingleGesture(this.gestures[i], this.simultaneousGestures, this.requireGesturesToFail.concat(requireToFail));
+ requireToFail = requireToFail.concat(gestureArrays[i]);
+ }
+ }
+
+}
+
+exports.ExclusiveGesture = ExclusiveGesture;
+//# sourceMappingURL=gestureComposition.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/gestureComposition.js.map b/lib/commonjs/handlers/gestures/gestureComposition.js.map
new file mode 100644
index 0000000000..afbb97980f
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/gestureComposition.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["gestureComposition.ts"],"names":["extendRelation","currentRelation","extendWith","undefined","ComposedGesture","Gesture","constructor","gestures","prepareSingleGesture","gesture","simultaneousGestures","requireGesturesToFail","BaseGesture","newConfig","config","simultaneousWith","requireToFail","prepare","initialize","toGestureArray","flatMap","SimultaneousGesture","simultaneousArray","concat","ExclusiveGesture","gestureArrays","map","i","length"],"mappings":";;;;;;;AAAA;;;;AAEA,SAASA,cAAT,CACEC,eADF,EAEEC,UAFF,EAGE;AACA,MAAID,eAAe,KAAKE,SAAxB,EAAmC;AACjC,WAAO,CAAC,GAAGD,UAAJ,CAAP;AACD,GAFD,MAEO;AACL,WAAO,CAAC,GAAGD,eAAJ,EAAqB,GAAGC,UAAxB,CAAP;AACD;AACF;;AAEM,MAAME,eAAN,SAA8BC,gBAA9B,CAAsC;AAK3CC,EAAAA,WAAW,CAAC,GAAGC,QAAJ,EAAyB;AAClC;;AADkC,sCAJJ,EAII;;AAAA,kDAHY,EAGZ;;AAAA,mDAFa,EAEb;;AAElC,SAAKA,QAAL,GAAgBA,QAAhB;AACD;;AAESC,EAAAA,oBAAoB,CAC5BC,OAD4B,EAE5BC,oBAF4B,EAG5BC,qBAH4B,EAI5B;AACA,QAAIF,OAAO,YAAYG,oBAAvB,EAAoC;AAClC,YAAMC,SAAS,GAAG,EAAE,GAAGJ,OAAO,CAACK;AAAb,OAAlB;AAEAD,MAAAA,SAAS,CAACE,gBAAV,GAA6Bf,cAAc,CACzCa,SAAS,CAACE,gBAD+B,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,aAAa,GAAG,KAAKlB,QAAL,CAAcmB,GAAd,CAAmBjB,OAAD,IACtCA,OAAO,CAACU,cAAR,EADoB,CAAtB;AAIA,QAAIH,aAA4B,GAAG,EAAnC;;AAEA,SAAK,IAAIW,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAKpB,QAAL,CAAcqB,MAAlC,EAA0CD,CAAC,EAA3C,EAA+C;AAC7C,WAAKnB,oBAAL,CACE,KAAKD,QAAL,CAAcoB,CAAd,CADF,EAEE,KAAKjB,oBAFP,EAGE,KAAKC,qBAAL,CAA2BY,MAA3B,CAAkCP,aAAlC,CAHF;AAMAA,MAAAA,aAAa,GAAGA,aAAa,CAACO,MAAd,CAAqBE,aAAa,CAACE,CAAD,CAAlC,CAAhB;AACD;AACF;;AAjBmD","sourcesContent":["import { BaseGesture, Gesture, GestureRef, GestureType } from './gesture';\n\nfunction extendRelation(\n currentRelation: GestureRef[] | undefined,\n extendWith: GestureType[]\n) {\n if (currentRelation === undefined) {\n return [...extendWith];\n } else {\n return [...currentRelation, ...extendWith];\n }\n}\n\nexport class ComposedGesture extends Gesture {\n protected gestures: Gesture[] = [];\n protected simultaneousGestures: GestureType[] = [];\n protected requireGesturesToFail: GestureType[] = [];\n\n constructor(...gestures: Gesture[]) {\n super();\n this.gestures = gestures;\n }\n\n protected prepareSingleGesture(\n gesture: Gesture,\n simultaneousGestures: GestureType[],\n requireGesturesToFail: GestureType[]\n ) {\n if (gesture instanceof BaseGesture) {\n const newConfig = { ...gesture.config };\n\n newConfig.simultaneousWith = extendRelation(\n newConfig.simultaneousWith,\n simultaneousGestures\n );\n newConfig.requireToFail = extendRelation(\n newConfig.requireToFail,\n requireGesturesToFail\n );\n\n gesture.config = newConfig;\n } else if (gesture instanceof ComposedGesture) {\n gesture.simultaneousGestures = simultaneousGestures;\n gesture.requireGesturesToFail = requireGesturesToFail;\n gesture.prepare();\n }\n }\n\n prepare() {\n for (const gesture of this.gestures) {\n this.prepareSingleGesture(\n gesture,\n this.simultaneousGestures,\n this.requireGesturesToFail\n );\n }\n }\n\n initialize() {\n for (const gesture of this.gestures) {\n gesture.initialize();\n }\n }\n\n toGestureArray(): GestureType[] {\n return this.gestures.flatMap((gesture) => gesture.toGestureArray());\n }\n}\n\nexport class SimultaneousGesture extends ComposedGesture {\n prepare() {\n const simultaneousArray = this.gestures\n .flatMap((gesture) => gesture.toGestureArray())\n .concat(this.simultaneousGestures);\n\n for (const gesture of this.gestures) {\n this.prepareSingleGesture(\n gesture,\n simultaneousArray,\n this.requireGesturesToFail\n );\n }\n }\n}\n\nexport class ExclusiveGesture extends ComposedGesture {\n prepare() {\n const gestureArrays = this.gestures.map((gesture) =>\n gesture.toGestureArray()\n );\n\n let requireToFail: GestureType[] = [];\n\n for (let i = 0; i < this.gestures.length; i++) {\n this.prepareSingleGesture(\n this.gestures[i],\n this.simultaneousGestures,\n this.requireGesturesToFail.concat(requireToFail)\n );\n\n requireToFail = requireToFail.concat(gestureArrays[i]);\n }\n }\n}\n\nexport type ComposedGestureType = InstanceType;\nexport type RaceGestureType = ComposedGestureType;\nexport type SimultaneousGestureType = InstanceType;\nexport type ExclusiveGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/gestureObjects.js b/lib/commonjs/handlers/gestures/gestureObjects.js
new file mode 100644
index 0000000000..5bb9511201
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/gestureObjects.js
@@ -0,0 +1,85 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.GestureObjects = void 0;
+
+var _flingGesture = require("./flingGesture");
+
+var _forceTouchGesture = require("./forceTouchGesture");
+
+var _gestureComposition = require("./gestureComposition");
+
+var _longPressGesture = require("./longPressGesture");
+
+var _panGesture = require("./panGesture");
+
+var _pinchGesture = require("./pinchGesture");
+
+var _rotationGesture = require("./rotationGesture");
+
+var _tapGesture = require("./tapGesture");
+
+var _nativeGesture = require("./nativeGesture");
+
+var _manualGesture = require("./manualGesture");
+
+const GestureObjects = {
+ Tap: () => {
+ return new _tapGesture.TapGesture();
+ },
+ Pan: () => {
+ return new _panGesture.PanGesture();
+ },
+ Pinch: () => {
+ return new _pinchGesture.PinchGesture();
+ },
+ Rotation: () => {
+ return new _rotationGesture.RotationGesture();
+ },
+ Fling: () => {
+ return new _flingGesture.FlingGesture();
+ },
+ LongPress: () => {
+ return new _longPressGesture.LongPressGesture();
+ },
+ ForceTouch: () => {
+ return new _forceTouchGesture.ForceTouchGesture();
+ },
+ Native: () => {
+ return new _nativeGesture.NativeGesture();
+ },
+ Manual: () => {
+ return new _manualGesture.ManualGesture();
+ },
+
+ /**
+ * Builds a composed gesture consisting of gestures provided as parameters.
+ * The first one that becomes active cancels the rest of gestures.
+ */
+ Race: (...gestures) => {
+ return new _gestureComposition.ComposedGesture(...gestures);
+ },
+
+ /**
+ * Builds a composed gesture that allows all base gestures to run simultaneously.
+ */
+ Simultaneous(...gestures) {
+ return new _gestureComposition.SimultaneousGesture(...gestures);
+ },
+
+ /**
+ * Builds a composed gesture where only one of the provided gestures can become active.
+ * Priority is decided through the order of gestures: the first one has higher priority
+ * than the second one, second one has higher priority than the third one, and so on.
+ * For example, to make a gesture that recognizes both single and double tap you need
+ * to call Exclusive(doubleTap, singleTap).
+ */
+ Exclusive(...gestures) {
+ return new _gestureComposition.ExclusiveGesture(...gestures);
+ }
+
+};
+exports.GestureObjects = GestureObjects;
+//# sourceMappingURL=gestureObjects.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/gestureObjects.js.map b/lib/commonjs/handlers/gestures/gestureObjects.js.map
new file mode 100644
index 0000000000..268c7acb08
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/gestureObjects.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["gestureObjects.ts"],"names":["GestureObjects","Tap","TapGesture","Pan","PanGesture","Pinch","PinchGesture","Rotation","RotationGesture","Fling","FlingGesture","LongPress","LongPressGesture","ForceTouch","ForceTouchGesture","Native","NativeGesture","Manual","ManualGesture","Race","gestures","ComposedGesture","Simultaneous","SimultaneousGesture","Exclusive","ExclusiveGesture"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,MAAMA,cAAc,GAAG;AAC5BC,EAAAA,GAAG,EAAE,MAAM;AACT,WAAO,IAAIC,sBAAJ,EAAP;AACD,GAH2B;AAK5BC,EAAAA,GAAG,EAAE,MAAM;AACT,WAAO,IAAIC,sBAAJ,EAAP;AACD,GAP2B;AAS5BC,EAAAA,KAAK,EAAE,MAAM;AACX,WAAO,IAAIC,0BAAJ,EAAP;AACD,GAX2B;AAa5BC,EAAAA,QAAQ,EAAE,MAAM;AACd,WAAO,IAAIC,gCAAJ,EAAP;AACD,GAf2B;AAiB5BC,EAAAA,KAAK,EAAE,MAAM;AACX,WAAO,IAAIC,0BAAJ,EAAP;AACD,GAnB2B;AAqB5BC,EAAAA,SAAS,EAAE,MAAM;AACf,WAAO,IAAIC,kCAAJ,EAAP;AACD,GAvB2B;AAyB5BC,EAAAA,UAAU,EAAE,MAAM;AAChB,WAAO,IAAIC,oCAAJ,EAAP;AACD,GA3B2B;AA6B5BC,EAAAA,MAAM,EAAE,MAAM;AACZ,WAAO,IAAIC,4BAAJ,EAAP;AACD,GA/B2B;AAiC5BC,EAAAA,MAAM,EAAE,MAAM;AACZ,WAAO,IAAIC,4BAAJ,EAAP;AACD,GAnC2B;;AAqC5B;AACF;AACA;AACA;AACEC,EAAAA,IAAI,EAAE,CAAC,GAAGC,QAAJ,KAA4B;AAChC,WAAO,IAAIC,mCAAJ,CAAoB,GAAGD,QAAvB,CAAP;AACD,GA3C2B;;AA6C5B;AACF;AACA;AACEE,EAAAA,YAAY,CAAC,GAAGF,QAAJ,EAAyB;AACnC,WAAO,IAAIG,uCAAJ,CAAwB,GAAGH,QAA3B,CAAP;AACD,GAlD2B;;AAoD5B;AACF;AACA;AACA;AACA;AACA;AACA;AACEI,EAAAA,SAAS,CAAC,GAAGJ,QAAJ,EAAyB;AAChC,WAAO,IAAIK,oCAAJ,CAAqB,GAAGL,QAAxB,CAAP;AACD;;AA7D2B,CAAvB","sourcesContent":["import { FlingGesture } from './flingGesture';\nimport { ForceTouchGesture } from './forceTouchGesture';\nimport { Gesture } from './gesture';\nimport {\n ComposedGesture,\n ExclusiveGesture,\n SimultaneousGesture,\n} from './gestureComposition';\nimport { LongPressGesture } from './longPressGesture';\nimport { PanGesture } from './panGesture';\nimport { PinchGesture } from './pinchGesture';\nimport { RotationGesture } from './rotationGesture';\nimport { TapGesture } from './tapGesture';\nimport { NativeGesture } from './nativeGesture';\nimport { ManualGesture } from './manualGesture';\n\nexport const GestureObjects = {\n Tap: () => {\n return new TapGesture();\n },\n\n Pan: () => {\n return new PanGesture();\n },\n\n Pinch: () => {\n return new PinchGesture();\n },\n\n Rotation: () => {\n return new RotationGesture();\n },\n\n Fling: () => {\n return new FlingGesture();\n },\n\n LongPress: () => {\n return new LongPressGesture();\n },\n\n ForceTouch: () => {\n return new ForceTouchGesture();\n },\n\n Native: () => {\n return new NativeGesture();\n },\n\n Manual: () => {\n return new ManualGesture();\n },\n\n /**\n * Builds a composed gesture consisting of gestures provided as parameters.\n * The first one that becomes active cancels the rest of gestures.\n */\n Race: (...gestures: Gesture[]) => {\n return new ComposedGesture(...gestures);\n },\n\n /**\n * Builds a composed gesture that allows all base gestures to run simultaneously.\n */\n Simultaneous(...gestures: Gesture[]) {\n return new SimultaneousGesture(...gestures);\n },\n\n /**\n * Builds a composed gesture where only one of the provided gestures can become active.\n * Priority is decided through the order of gestures: the first one has higher priority\n * than the second one, second one has higher priority than the third one, and so on.\n * For example, to make a gesture that recognizes both single and double tap you need\n * to call Exclusive(doubleTap, singleTap).\n */\n Exclusive(...gestures: Gesture[]) {\n return new ExclusiveGesture(...gestures);\n },\n};\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/gestureStateManager.js b/lib/commonjs/handlers/gestures/gestureStateManager.js
new file mode 100644
index 0000000000..dece00fdd5
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/gestureStateManager.js
@@ -0,0 +1,58 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.GestureStateManager = void 0;
+
+var _reanimatedWrapper = require("./reanimatedWrapper");
+
+var _State = require("../../State");
+
+const GestureStateManager = {
+ create(handlerTag) {
+ 'worklet';
+
+ return {
+ begin: () => {
+ 'worklet';
+
+ if (_reanimatedWrapper.Reanimated) {
+ _reanimatedWrapper.Reanimated.setGestureState(handlerTag, _State.State.BEGAN);
+ } else {
+ console.warn('react-native-reanimated is required in order to use synchronous state management');
+ }
+ },
+ activate: () => {
+ 'worklet';
+
+ if (_reanimatedWrapper.Reanimated) {
+ _reanimatedWrapper.Reanimated.setGestureState(handlerTag, _State.State.ACTIVE);
+ } else {
+ console.warn('react-native-reanimated is required in order to use synchronous state management');
+ }
+ },
+ fail: () => {
+ 'worklet';
+
+ if (_reanimatedWrapper.Reanimated) {
+ _reanimatedWrapper.Reanimated.setGestureState(handlerTag, _State.State.FAILED);
+ } else {
+ console.warn('react-native-reanimated is required in order to use synchronous state management');
+ }
+ },
+ end: () => {
+ 'worklet';
+
+ if (_reanimatedWrapper.Reanimated) {
+ _reanimatedWrapper.Reanimated.setGestureState(handlerTag, _State.State.END);
+ } else {
+ console.warn('react-native-reanimated is required in order to use synchronous state management');
+ }
+ }
+ };
+ }
+
+};
+exports.GestureStateManager = GestureStateManager;
+//# sourceMappingURL=gestureStateManager.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/gestureStateManager.js.map b/lib/commonjs/handlers/gestures/gestureStateManager.js.map
new file mode 100644
index 0000000000..3be27408fa
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/gestureStateManager.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["gestureStateManager.ts"],"names":["GestureStateManager","create","handlerTag","begin","Reanimated","setGestureState","State","BEGAN","console","warn","activate","ACTIVE","fail","FAILED","end","END"],"mappings":";;;;;;;AAAA;;AACA;;AASO,MAAMA,mBAAmB,GAAG;AACjCC,EAAAA,MAAM,CAACC,UAAD,EAA8C;AAClD;;AACA,WAAO;AACLC,MAAAA,KAAK,EAAE,MAAM;AACX;;AACA,YAAIC,6BAAJ,EAAgB;AACdA,wCAAWC,eAAX,CAA2BH,UAA3B,EAAuCI,aAAMC,KAA7C;AACD,SAFD,MAEO;AACLC,UAAAA,OAAO,CAACC,IAAR,CACE,kFADF;AAGD;AACF,OAVI;AAYLC,MAAAA,QAAQ,EAAE,MAAM;AACd;;AACA,YAAIN,6BAAJ,EAAgB;AACdA,wCAAWC,eAAX,CAA2BH,UAA3B,EAAuCI,aAAMK,MAA7C;AACD,SAFD,MAEO;AACLH,UAAAA,OAAO,CAACC,IAAR,CACE,kFADF;AAGD;AACF,OArBI;AAuBLG,MAAAA,IAAI,EAAE,MAAM;AACV;;AACA,YAAIR,6BAAJ,EAAgB;AACdA,wCAAWC,eAAX,CAA2BH,UAA3B,EAAuCI,aAAMO,MAA7C;AACD,SAFD,MAEO;AACLL,UAAAA,OAAO,CAACC,IAAR,CACE,kFADF;AAGD;AACF,OAhCI;AAkCLK,MAAAA,GAAG,EAAE,MAAM;AACT;;AACA,YAAIV,6BAAJ,EAAgB;AACdA,wCAAWC,eAAX,CAA2BH,UAA3B,EAAuCI,aAAMS,GAA7C;AACD,SAFD,MAEO;AACLP,UAAAA,OAAO,CAACC,IAAR,CACE,kFADF;AAGD;AACF;AA3CI,KAAP;AA6CD;;AAhDgC,CAA5B","sourcesContent":["import { Reanimated } from './reanimatedWrapper';\nimport { State } from '../../State';\n\nexport interface GestureStateManagerType {\n begin: () => void;\n activate: () => void;\n fail: () => void;\n end: () => void;\n}\n\nexport const GestureStateManager = {\n create(handlerTag: number): GestureStateManagerType {\n 'worklet';\n return {\n begin: () => {\n 'worklet';\n if (Reanimated) {\n Reanimated.setGestureState(handlerTag, State.BEGAN);\n } else {\n console.warn(\n 'react-native-reanimated is required in order to use synchronous state management'\n );\n }\n },\n\n activate: () => {\n 'worklet';\n if (Reanimated) {\n Reanimated.setGestureState(handlerTag, State.ACTIVE);\n } else {\n console.warn(\n 'react-native-reanimated is required in order to use synchronous state management'\n );\n }\n },\n\n fail: () => {\n 'worklet';\n if (Reanimated) {\n Reanimated.setGestureState(handlerTag, State.FAILED);\n } else {\n console.warn(\n 'react-native-reanimated is required in order to use synchronous state management'\n );\n }\n },\n\n end: () => {\n 'worklet';\n if (Reanimated) {\n Reanimated.setGestureState(handlerTag, State.END);\n } else {\n console.warn(\n 'react-native-reanimated is required in order to use synchronous state management'\n );\n }\n },\n };\n },\n};\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/longPressGesture.js b/lib/commonjs/handlers/gestures/longPressGesture.js
new file mode 100644
index 0000000000..5f8eb2cad9
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/longPressGesture.js
@@ -0,0 +1,34 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.LongPressGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+class LongPressGesture extends _gesture.BaseGesture {
+ constructor() {
+ super();
+
+ _defineProperty(this, "config", {});
+
+ this.handlerName = 'LongPressGestureHandler';
+ }
+
+ minDuration(duration) {
+ this.config.minDurationMs = duration;
+ return this;
+ }
+
+ maxDistance(distance) {
+ this.config.maxDist = distance;
+ return this;
+ }
+
+}
+
+exports.LongPressGesture = LongPressGesture;
+//# sourceMappingURL=longPressGesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/longPressGesture.js.map b/lib/commonjs/handlers/gestures/longPressGesture.js.map
new file mode 100644
index 0000000000..5d2978fa76
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/longPressGesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["longPressGesture.ts"],"names":["LongPressGesture","BaseGesture","constructor","handlerName","minDuration","duration","config","minDurationMs","maxDistance","distance","maxDist"],"mappings":";;;;;;;AAAA;;;;AAMO,MAAMA,gBAAN,SAA+BC,oBAA/B,CAAgF;AAGrFC,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF8C,EAE9C;;AAGZ,SAAKC,WAAL,GAAmB,yBAAnB;AACD;;AAEDC,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKC,MAAL,CAAYC,aAAZ,GAA4BF,QAA5B;AACA,WAAO,IAAP;AACD;;AAEDG,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKH,MAAL,CAAYI,OAAZ,GAAsBD,QAAtB;AACA,WAAO,IAAP;AACD;;AAjBoF","sourcesContent":["import { BaseGesture, BaseGestureConfig } from './gesture';\nimport {\n LongPressGestureConfig,\n LongPressGestureHandlerEventPayload,\n} from '../LongPressGestureHandler';\n\nexport class LongPressGesture extends BaseGesture {\n public config: BaseGestureConfig & LongPressGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'LongPressGestureHandler';\n }\n\n minDuration(duration: number) {\n this.config.minDurationMs = duration;\n return this;\n }\n\n maxDistance(distance: number) {\n this.config.maxDist = distance;\n return this;\n }\n}\n\nexport type LongPressGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/manualGesture.js b/lib/commonjs/handlers/gestures/manualGesture.js
new file mode 100644
index 0000000000..c7cfaf3de4
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/manualGesture.js
@@ -0,0 +1,31 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.ManualGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function changeEventCalculator(current, _previous) {
+ 'worklet';
+
+ return current;
+}
+
+class ManualGesture extends _gesture.ContinousBaseGesture {
+ constructor() {
+ super();
+ this.handlerName = 'ManualGestureHandler';
+ }
+
+ onChange(callback) {
+ // @ts-ignore TS being overprotective, Record is Record
+ this.handlers.changeEventCalculator = changeEventCalculator;
+ return super.onChange(callback);
+ }
+
+}
+
+exports.ManualGesture = ManualGesture;
+//# sourceMappingURL=manualGesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/manualGesture.js.map b/lib/commonjs/handlers/gestures/manualGesture.js.map
new file mode 100644
index 0000000000..4272d43965
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/manualGesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["manualGesture.ts"],"names":["changeEventCalculator","current","_previous","ManualGesture","ContinousBaseGesture","constructor","handlerName","onChange","callback","handlers"],"mappings":";;;;;;;AACA;;AAEA,SAASA,qBAAT,CACEC,OADF,EAEEC,SAFF,EAGE;AACA;;AACA,SAAOD,OAAP;AACD;;AAEM,MAAME,aAAN,SAA4BC,6BAA5B,CAGL;AACAC,EAAAA,WAAW,GAAG;AACZ;AAEA,SAAKC,WAAL,GAAmB,sBAAnB;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EAEN;AACA;AACA,SAAKC,QAAL,CAAcT,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMO,QAAN,CAAeC,QAAf,CAAP;AACD;;AAbD","sourcesContent":["import { GestureUpdateEvent } from '../gestureHandlerCommon';\nimport { ContinousBaseGesture } from './gesture';\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent>,\n _previous?: GestureUpdateEvent>\n) {\n 'worklet';\n return current;\n}\n\nexport class ManualGesture extends ContinousBaseGesture<\n Record,\n Record\n> {\n constructor() {\n super();\n\n this.handlerName = 'ManualGestureHandler';\n }\n\n onChange(\n callback: (event: GestureUpdateEvent>) => void\n ) {\n // @ts-ignore TS being overprotective, Record is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type ManualGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/nativeGesture.js b/lib/commonjs/handlers/gestures/nativeGesture.js
new file mode 100644
index 0000000000..7deb3f0560
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/nativeGesture.js
@@ -0,0 +1,34 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.NativeGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+class NativeGesture extends _gesture.BaseGesture {
+ constructor() {
+ super();
+
+ _defineProperty(this, "config", {});
+
+ this.handlerName = 'NativeViewGestureHandler';
+ }
+
+ shouldActivateOnStart(value) {
+ this.config.shouldActivateOnStart = value;
+ return this;
+ }
+
+ disallowInterruption(value) {
+ this.config.disallowInterruption = value;
+ return this;
+ }
+
+}
+
+exports.NativeGesture = NativeGesture;
+//# sourceMappingURL=nativeGesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/nativeGesture.js.map b/lib/commonjs/handlers/gestures/nativeGesture.js.map
new file mode 100644
index 0000000000..7514e3896e
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/nativeGesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["nativeGesture.ts"],"names":["NativeGesture","BaseGesture","constructor","handlerName","shouldActivateOnStart","value","config","disallowInterruption"],"mappings":";;;;;;;AAAA;;;;AAMO,MAAMA,aAAN,SAA4BC,oBAA5B,CAAyE;AAG9EC,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAF+C,EAE/C;;AAGZ,SAAKC,WAAL,GAAmB,0BAAnB;AACD;;AAEDC,EAAAA,qBAAqB,CAACC,KAAD,EAAiB;AACpC,SAAKC,MAAL,CAAYF,qBAAZ,GAAoCC,KAApC;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,oBAAoB,CAACF,KAAD,EAAiB;AACnC,SAAKC,MAAL,CAAYC,oBAAZ,GAAmCF,KAAnC;AACA,WAAO,IAAP;AACD;;AAjB6E","sourcesContent":["import { BaseGestureConfig, BaseGesture } from './gesture';\nimport {\n NativeViewGestureConfig,\n NativeViewGestureHandlerPayload,\n} from '../NativeViewGestureHandler';\n\nexport class NativeGesture extends BaseGesture {\n public config: BaseGestureConfig & NativeViewGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'NativeViewGestureHandler';\n }\n\n shouldActivateOnStart(value: boolean) {\n this.config.shouldActivateOnStart = value;\n return this;\n }\n\n disallowInterruption(value: boolean) {\n this.config.disallowInterruption = value;\n return this;\n }\n}\n\nexport type NativeGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/panGesture.js b/lib/commonjs/handlers/gestures/panGesture.js
new file mode 100644
index 0000000000..6375c530de
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/panGesture.js
@@ -0,0 +1,144 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.PanGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+function changeEventCalculator(current, previous) {
+ 'worklet';
+
+ let changePayload;
+
+ if (previous === undefined) {
+ changePayload = {
+ changeX: current.translationX,
+ changeY: current.translationY
+ };
+ } else {
+ changePayload = {
+ changeX: current.translationX - previous.translationX,
+ changeY: current.translationY - previous.translationY
+ };
+ }
+
+ return { ...current,
+ ...changePayload
+ };
+}
+
+class PanGesture extends _gesture.ContinousBaseGesture {
+ constructor() {
+ super();
+
+ _defineProperty(this, "config", {});
+
+ this.handlerName = 'PanGestureHandler';
+ }
+
+ activeOffsetY(offset) {
+ if (Array.isArray(offset)) {
+ this.config.activeOffsetYStart = offset[0];
+ this.config.activeOffsetYEnd = offset[1];
+ } else if (offset < 0) {
+ this.config.activeOffsetYStart = offset;
+ } else {
+ this.config.activeOffsetYEnd = offset;
+ }
+
+ return this;
+ }
+
+ activeOffsetX(offset) {
+ if (Array.isArray(offset)) {
+ this.config.activeOffsetXStart = offset[0];
+ this.config.activeOffsetXEnd = offset[1];
+ } else if (offset < 0) {
+ this.config.activeOffsetXStart = offset;
+ } else {
+ this.config.activeOffsetXEnd = offset;
+ }
+
+ return this;
+ }
+
+ failOffsetY(offset) {
+ if (Array.isArray(offset)) {
+ this.config.failOffsetYStart = offset[0];
+ this.config.failOffsetYEnd = offset[1];
+ } else if (offset < 0) {
+ this.config.failOffsetYStart = offset;
+ } else {
+ this.config.failOffsetYEnd = offset;
+ }
+
+ return this;
+ }
+
+ failOffsetX(offset) {
+ if (Array.isArray(offset)) {
+ this.config.failOffsetXStart = offset[0];
+ this.config.failOffsetXEnd = offset[1];
+ } else if (offset < 0) {
+ this.config.failOffsetXStart = offset;
+ } else {
+ this.config.failOffsetXEnd = offset;
+ }
+
+ return this;
+ }
+
+ minPointers(minPointers) {
+ this.config.minPointers = minPointers;
+ return this;
+ }
+
+ maxPointers(maxPointers) {
+ this.config.maxPointers = maxPointers;
+ return this;
+ }
+
+ minDistance(distance) {
+ this.config.minDist = distance;
+ return this;
+ }
+
+ minVelocity(velocity) {
+ this.config.minVelocity = velocity;
+ return this;
+ }
+
+ minVelocityX(velocity) {
+ this.config.minVelocityX = velocity;
+ return this;
+ }
+
+ minVelocityY(velocity) {
+ this.config.minVelocityY = velocity;
+ return this;
+ }
+
+ averageTouches(value) {
+ this.config.avgTouches = value;
+ return this;
+ }
+
+ enableTrackpadTwoFingerGesture(value) {
+ this.config.enableTrackpadTwoFingerGesture = value;
+ return this;
+ }
+
+ onChange(callback) {
+ // @ts-ignore TS being overprotective, PanGestureHandlerEventPayload is Record
+ this.handlers.changeEventCalculator = changeEventCalculator;
+ return super.onChange(callback);
+ }
+
+}
+
+exports.PanGesture = PanGesture;
+//# sourceMappingURL=panGesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/panGesture.js.map b/lib/commonjs/handlers/gestures/panGesture.js.map
new file mode 100644
index 0000000000..f2e8d56e92
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/panGesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["panGesture.ts"],"names":["changeEventCalculator","current","previous","changePayload","undefined","changeX","translationX","changeY","translationY","PanGesture","ContinousBaseGesture","constructor","handlerName","activeOffsetY","offset","Array","isArray","config","activeOffsetYStart","activeOffsetYEnd","activeOffsetX","activeOffsetXStart","activeOffsetXEnd","failOffsetY","failOffsetYStart","failOffsetYEnd","failOffsetX","failOffsetXStart","failOffsetXEnd","minPointers","maxPointers","minDistance","distance","minDist","minVelocity","velocity","minVelocityX","minVelocityY","averageTouches","value","avgTouches","enableTrackpadTwoFingerGesture","onChange","callback","handlers"],"mappings":";;;;;;;AAAA;;;;AAYA,SAASA,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,OAAO,EAAEJ,OAAO,CAACK,YADH;AAEdC,MAAAA,OAAO,EAAEN,OAAO,CAACO;AAFH,KAAhB;AAID,GALD,MAKO;AACLL,IAAAA,aAAa,GAAG;AACdE,MAAAA,OAAO,EAAEJ,OAAO,CAACK,YAAR,GAAuBJ,QAAQ,CAACI,YAD3B;AAEdC,MAAAA,OAAO,EAAEN,OAAO,CAACO,YAAR,GAAuBN,QAAQ,CAACM;AAF3B,KAAhB;AAID;;AAED,SAAO,EAAE,GAAGP,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAEM,MAAMM,UAAN,SAAyBC,6BAAzB,CAGL;AAGAC,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAFwC,EAExC;;AAGZ,SAAKC,WAAL,GAAmB,mBAAnB;AACD;;AAEDC,EAAAA,aAAa,CAACC,MAAD,EAA4B;AACvC,QAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAJ,EA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EAAiB;AAC7C,SAAKtB,MAAL,CAAYwB,8BAAZ,GAA6CF,KAA7C;AACA,WAAO,IAAP;AACD;;AAEDG,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAc5C,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAM0C,QAAN,CAAeC,QAAf,CAAP;AACD;;AA3GD","sourcesContent":["import { BaseGestureConfig, ContinousBaseGesture } from './gesture';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\nimport {\n PanGestureConfig,\n PanGestureHandlerEventPayload,\n} from '../PanGestureHandler';\n\ntype PanGestureChangeEventPayload = {\n changeX: number;\n changeY: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent,\n previous?: GestureUpdateEvent\n) {\n 'worklet';\n let changePayload: PanGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n changeX: current.translationX,\n changeY: current.translationY,\n };\n } else {\n changePayload = {\n changeX: current.translationX - previous.translationX,\n changeY: current.translationY - previous.translationY,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class PanGesture extends ContinousBaseGesture<\n PanGestureHandlerEventPayload,\n PanGestureChangeEventPayload\n> {\n public config: BaseGestureConfig & PanGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'PanGestureHandler';\n }\n\n activeOffsetY(offset: number | number[]) {\n if (Array.isArray(offset)) {\n this.config.activeOffsetYStart = offset[0];\n this.config.activeOffsetYEnd = offset[1];\n } else if (offset < 0) {\n this.config.activeOffsetYStart = offset;\n } else {\n this.config.activeOffsetYEnd = offset;\n }\n return this;\n }\n\n activeOffsetX(offset: number | number[]) {\n if (Array.isArray(offset)) {\n this.config.activeOffsetXStart = offset[0];\n this.config.activeOffsetXEnd = offset[1];\n } else if (offset < 0) {\n this.config.activeOffsetXStart = offset;\n } else {\n this.config.activeOffsetXEnd = offset;\n }\n return this;\n }\n\n failOffsetY(offset: number | number[]) {\n if (Array.isArray(offset)) {\n this.config.failOffsetYStart = offset[0];\n this.config.failOffsetYEnd = offset[1];\n } else if (offset < 0) {\n this.config.failOffsetYStart = offset;\n } else {\n this.config.failOffsetYEnd = offset;\n }\n return this;\n }\n\n failOffsetX(offset: number | number[]) {\n if (Array.isArray(offset)) {\n this.config.failOffsetXStart = offset[0];\n this.config.failOffsetXEnd = offset[1];\n } else if (offset < 0) {\n this.config.failOffsetXStart = offset;\n } else {\n this.config.failOffsetXEnd = offset;\n }\n return this;\n }\n\n minPointers(minPointers: number) {\n this.config.minPointers = minPointers;\n return this;\n }\n\n maxPointers(maxPointers: number) {\n this.config.maxPointers = maxPointers;\n return this;\n }\n\n minDistance(distance: number) {\n this.config.minDist = distance;\n return this;\n }\n\n minVelocity(velocity: number) {\n this.config.minVelocity = velocity;\n return this;\n }\n\n minVelocityX(velocity: number) {\n this.config.minVelocityX = velocity;\n return this;\n }\n\n minVelocityY(velocity: number) {\n this.config.minVelocityY = velocity;\n return this;\n }\n\n averageTouches(value: boolean) {\n this.config.avgTouches = value;\n return this;\n }\n\n enableTrackpadTwoFingerGesture(value: boolean) {\n this.config.enableTrackpadTwoFingerGesture = value;\n return this;\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n PanGestureHandlerEventPayload & PanGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, PanGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type PanGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/pinchGesture.js b/lib/commonjs/handlers/gestures/pinchGesture.js
new file mode 100644
index 0000000000..bd51a5ffa6
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/pinchGesture.js
@@ -0,0 +1,45 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.PinchGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function changeEventCalculator(current, previous) {
+ 'worklet';
+
+ let changePayload;
+
+ if (previous === undefined) {
+ changePayload = {
+ scaleChange: current.scale
+ };
+ } else {
+ changePayload = {
+ scaleChange: current.scale / previous.scale
+ };
+ }
+
+ return { ...current,
+ ...changePayload
+ };
+}
+
+class PinchGesture extends _gesture.ContinousBaseGesture {
+ constructor() {
+ super();
+ this.handlerName = 'PinchGestureHandler';
+ }
+
+ onChange(callback) {
+ // @ts-ignore TS being overprotective, PinchGestureHandlerEventPayload is Record
+ this.handlers.changeEventCalculator = changeEventCalculator;
+ return super.onChange(callback);
+ }
+
+}
+
+exports.PinchGesture = PinchGesture;
+//# sourceMappingURL=pinchGesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/pinchGesture.js.map b/lib/commonjs/handlers/gestures/pinchGesture.js.map
new file mode 100644
index 0000000000..47bf2c87d4
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/pinchGesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["pinchGesture.ts"],"names":["changeEventCalculator","current","previous","changePayload","undefined","scaleChange","scale","PinchGesture","ContinousBaseGesture","constructor","handlerName","onChange","callback","handlers"],"mappings":";;;;;;;AAAA;;AAQA,SAASA,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK;AADP,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,WAAW,EAAEJ,OAAO,CAACK,KAAR,GAAgBJ,QAAQ,CAACI;AADxB,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAEM,MAAMI,YAAN,SAA2BC,6BAA3B,CAGL;AACAC,EAAAA,WAAW,GAAG;AACZ;AAEA,SAAKC,WAAL,GAAmB,qBAAnB;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAcb,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMW,QAAN,CAAeC,QAAf,CAAP;AACD;;AAjBD","sourcesContent":["import { ContinousBaseGesture } from './gesture';\nimport { PinchGestureHandlerEventPayload } from '../PinchGestureHandler';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\ntype PinchGestureChangeEventPayload = {\n scaleChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent,\n previous?: GestureUpdateEvent\n) {\n 'worklet';\n let changePayload: PinchGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n scaleChange: current.scale,\n };\n } else {\n changePayload = {\n scaleChange: current.scale / previous.scale,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class PinchGesture extends ContinousBaseGesture<\n PinchGestureHandlerEventPayload,\n PinchGestureChangeEventPayload\n> {\n constructor() {\n super();\n\n this.handlerName = 'PinchGestureHandler';\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n PinchGestureHandlerEventPayload & PinchGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, PinchGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type PinchGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/reanimatedWrapper.js b/lib/commonjs/handlers/gestures/reanimatedWrapper.js
new file mode 100644
index 0000000000..7e376f661d
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/reanimatedWrapper.js
@@ -0,0 +1,24 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.Reanimated = void 0;
+let Reanimated;
+exports.Reanimated = Reanimated;
+
+try {
+ exports.Reanimated = Reanimated = require('react-native-reanimated');
+
+ if (!Reanimated.setGestureState) {
+ Reanimated.setGestureState = () => {
+ 'worklet';
+
+ console.warn('Please use newer version of react-native-reanimated in order to control state of the gestures.');
+ };
+ } // When 'react-native-reanimated' is not available we want to
+ // quietly continue
+ // eslint-disable-next-line no-empty
+
+} catch (e) {}
+//# sourceMappingURL=reanimatedWrapper.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map b/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map
new file mode 100644
index 0000000000..ecd0cccaef
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["reanimatedWrapper.ts"],"names":["Reanimated","require","setGestureState","console","warn","e"],"mappings":";;;;;;AAUA,IAAIA,UAAJ;;;AAkBA,IAAI;AACF,uBAAAA,UAAU,GAAGC,OAAO,CAAC,yBAAD,CAApB;;AAEA,MAAI,CAACD,UAAU,CAACE,eAAhB,EAAiC;AAC/BF,IAAAA,UAAU,CAACE,eAAX,GAA6B,MAAM;AACjC;;AACAC,MAAAA,OAAO,CAACC,IAAR,CACE,gGADF;AAGD,KALD;AAMD,GAVC,CAWF;AACA;AACA;;AACD,CAdD,CAcE,OAAOC,CAAP,EAAU,CAAE","sourcesContent":["import { ComponentClass } from 'react';\nimport {\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from '../gestureHandlerCommon';\n\nexport interface SharedValue {\n value: T;\n}\n\nlet Reanimated: {\n default: {\n // Slightly modified definition copied from 'react-native-reanimated'\n // eslint-disable-next-line @typescript-eslint/ban-types\n createAnimatedComponent(\n component: ComponentClass
,\n options?: unknown\n ): ComponentClass
;\n };\n useEvent: (\n callback: (event: GestureUpdateEvent | GestureStateChangeEvent) => void,\n events: string[],\n rebuild: boolean\n ) => unknown;\n useSharedValue: (value: T) => SharedValue;\n setGestureState: (handlerTag: number, newState: number) => void;\n};\n\ntry {\n Reanimated = require('react-native-reanimated');\n\n if (!Reanimated.setGestureState) {\n Reanimated.setGestureState = () => {\n 'worklet';\n console.warn(\n 'Please use newer version of react-native-reanimated in order to control state of the gestures.'\n );\n };\n }\n // When 'react-native-reanimated' is not available we want to\n // quietly continue\n // eslint-disable-next-line no-empty\n} catch (e) {}\n\nexport { Reanimated };\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/rotationGesture.js b/lib/commonjs/handlers/gestures/rotationGesture.js
new file mode 100644
index 0000000000..94a33bacb6
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/rotationGesture.js
@@ -0,0 +1,45 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.RotationGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function changeEventCalculator(current, previous) {
+ 'worklet';
+
+ let changePayload;
+
+ if (previous === undefined) {
+ changePayload = {
+ rotationChange: current.rotation
+ };
+ } else {
+ changePayload = {
+ rotationChange: current.rotation - previous.rotation
+ };
+ }
+
+ return { ...current,
+ ...changePayload
+ };
+}
+
+class RotationGesture extends _gesture.ContinousBaseGesture {
+ constructor() {
+ super();
+ this.handlerName = 'RotationGestureHandler';
+ }
+
+ onChange(callback) {
+ // @ts-ignore TS being overprotective, RotationGestureHandlerEventPayload is Record
+ this.handlers.changeEventCalculator = changeEventCalculator;
+ return super.onChange(callback);
+ }
+
+}
+
+exports.RotationGesture = RotationGesture;
+//# sourceMappingURL=rotationGesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/rotationGesture.js.map b/lib/commonjs/handlers/gestures/rotationGesture.js.map
new file mode 100644
index 0000000000..357dbc8bb9
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/rotationGesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["rotationGesture.ts"],"names":["changeEventCalculator","current","previous","changePayload","undefined","rotationChange","rotation","RotationGesture","ContinousBaseGesture","constructor","handlerName","onChange","callback","handlers"],"mappings":";;;;;;;AAAA;;AAQA,SAASA,qBAAT,CACEC,OADF,EAEEC,QAFF,EAGE;AACA;;AACA,MAAIC,aAAJ;;AACA,MAAID,QAAQ,KAAKE,SAAjB,EAA4B;AAC1BD,IAAAA,aAAa,GAAG;AACdE,MAAAA,cAAc,EAAEJ,OAAO,CAACK;AADV,KAAhB;AAGD,GAJD,MAIO;AACLH,IAAAA,aAAa,GAAG;AACdE,MAAAA,cAAc,EAAEJ,OAAO,CAACK,QAAR,GAAmBJ,QAAQ,CAACI;AAD9B,KAAhB;AAGD;;AAED,SAAO,EAAE,GAAGL,OAAL;AAAc,OAAGE;AAAjB,GAAP;AACD;;AAEM,MAAMI,eAAN,SAA8BC,6BAA9B,CAGL;AACAC,EAAAA,WAAW,GAAG;AACZ;AAEA,SAAKC,WAAL,GAAmB,wBAAnB;AACD;;AAEDC,EAAAA,QAAQ,CACNC,QADM,EAMN;AACA;AACA,SAAKC,QAAL,CAAcb,qBAAd,GAAsCA,qBAAtC;AACA,WAAO,MAAMW,QAAN,CAAeC,QAAf,CAAP;AACD;;AAjBD","sourcesContent":["import { ContinousBaseGesture } from './gesture';\nimport { RotationGestureHandlerEventPayload } from '../RotationGestureHandler';\nimport { GestureUpdateEvent } from '../gestureHandlerCommon';\n\ntype RotationGestureChangeEventPayload = {\n rotationChange: number;\n};\n\nfunction changeEventCalculator(\n current: GestureUpdateEvent,\n previous?: GestureUpdateEvent\n) {\n 'worklet';\n let changePayload: RotationGestureChangeEventPayload;\n if (previous === undefined) {\n changePayload = {\n rotationChange: current.rotation,\n };\n } else {\n changePayload = {\n rotationChange: current.rotation - previous.rotation,\n };\n }\n\n return { ...current, ...changePayload };\n}\n\nexport class RotationGesture extends ContinousBaseGesture<\n RotationGestureHandlerEventPayload,\n RotationGestureChangeEventPayload\n> {\n constructor() {\n super();\n\n this.handlerName = 'RotationGestureHandler';\n }\n\n onChange(\n callback: (\n event: GestureUpdateEvent<\n RotationGestureHandlerEventPayload & RotationGestureChangeEventPayload\n >\n ) => void\n ) {\n // @ts-ignore TS being overprotective, RotationGestureHandlerEventPayload is Record\n this.handlers.changeEventCalculator = changeEventCalculator;\n return super.onChange(callback);\n }\n}\n\nexport type RotationGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/tapGesture.js b/lib/commonjs/handlers/gestures/tapGesture.js
new file mode 100644
index 0000000000..34111adb9f
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/tapGesture.js
@@ -0,0 +1,59 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.TapGesture = void 0;
+
+var _gesture = require("./gesture");
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+class TapGesture extends _gesture.BaseGesture {
+ constructor() {
+ super();
+
+ _defineProperty(this, "config", {});
+
+ this.handlerName = 'TapGestureHandler';
+ }
+
+ minPointers(minPointers) {
+ this.config.minPointers = minPointers;
+ return this;
+ }
+
+ numberOfTaps(count) {
+ this.config.numberOfTaps = count;
+ return this;
+ }
+
+ maxDistance(maxDist) {
+ this.config.maxDist = maxDist;
+ return this;
+ }
+
+ maxDuration(duration) {
+ this.config.maxDurationMs = duration;
+ return this;
+ }
+
+ maxDelay(delay) {
+ this.config.maxDelayMs = delay;
+ return this;
+ }
+
+ maxDeltaX(delta) {
+ this.config.maxDeltaX = delta;
+ return this;
+ }
+
+ maxDeltaY(delta) {
+ this.config.maxDeltaY = delta;
+ return this;
+ }
+
+}
+
+exports.TapGesture = TapGesture;
+//# sourceMappingURL=tapGesture.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/gestures/tapGesture.js.map b/lib/commonjs/handlers/gestures/tapGesture.js.map
new file mode 100644
index 0000000000..1fa6e950ff
--- /dev/null
+++ b/lib/commonjs/handlers/gestures/tapGesture.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["tapGesture.ts"],"names":["TapGesture","BaseGesture","constructor","handlerName","minPointers","config","numberOfTaps","count","maxDistance","maxDist","maxDuration","duration","maxDurationMs","maxDelay","delay","maxDelayMs","maxDeltaX","delta","maxDeltaY"],"mappings":";;;;;;;AAAA;;;;AAMO,MAAMA,UAAN,SAAyBC,oBAAzB,CAAoE;AAGzEC,EAAAA,WAAW,GAAG;AACZ;;AADY,oCAFwC,EAExC;;AAGZ,SAAKC,WAAL,GAAmB,mBAAnB;AACD;;AAEDC,EAAAA,WAAW,CAACA,WAAD,EAAsB;AAC/B,SAAKC,MAAL,CAAYD,WAAZ,GAA0BA,WAA1B;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,YAAY,CAACC,KAAD,EAAgB;AAC1B,SAAKF,MAAL,CAAYC,YAAZ,GAA2BC,KAA3B;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,WAAW,CAACC,OAAD,EAAkB;AAC3B,SAAKJ,MAAL,CAAYI,OAAZ,GAAsBA,OAAtB;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,WAAW,CAACC,QAAD,EAAmB;AAC5B,SAAKN,MAAL,CAAYO,aAAZ,GAA4BD,QAA5B;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,QAAQ,CAACC,KAAD,EAAgB;AACtB,SAAKT,MAAL,CAAYU,UAAZ,GAAyBD,KAAzB;AACA,WAAO,IAAP;AACD;;AAEDE,EAAAA,SAAS,CAACC,KAAD,EAAgB;AACvB,SAAKZ,MAAL,CAAYW,SAAZ,GAAwBC,KAAxB;AACA,WAAO,IAAP;AACD;;AAEDC,EAAAA,SAAS,CAACD,KAAD,EAAgB;AACvB,SAAKZ,MAAL,CAAYa,SAAZ,GAAwBD,KAAxB;AACA,WAAO,IAAP;AACD;;AA1CwE","sourcesContent":["import { BaseGestureConfig, BaseGesture } from './gesture';\nimport {\n TapGestureConfig,\n TapGestureHandlerEventPayload,\n} from '../TapGestureHandler';\n\nexport class TapGesture extends BaseGesture {\n public config: BaseGestureConfig & TapGestureConfig = {};\n\n constructor() {\n super();\n\n this.handlerName = 'TapGestureHandler';\n }\n\n minPointers(minPointers: number) {\n this.config.minPointers = minPointers;\n return this;\n }\n\n numberOfTaps(count: number) {\n this.config.numberOfTaps = count;\n return this;\n }\n\n maxDistance(maxDist: number) {\n this.config.maxDist = maxDist;\n return this;\n }\n\n maxDuration(duration: number) {\n this.config.maxDurationMs = duration;\n return this;\n }\n\n maxDelay(delay: number) {\n this.config.maxDelayMs = delay;\n return this;\n }\n\n maxDeltaX(delta: number) {\n this.config.maxDeltaX = delta;\n return this;\n }\n\n maxDeltaY(delta: number) {\n this.config.maxDeltaY = delta;\n return this;\n }\n}\n\nexport type TapGestureType = InstanceType;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/handlers/handlersRegistry.js b/lib/commonjs/handlers/handlersRegistry.js
new file mode 100644
index 0000000000..3ac12105ea
--- /dev/null
+++ b/lib/commonjs/handlers/handlersRegistry.js
@@ -0,0 +1,31 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.getNextHandlerTag = getNextHandlerTag;
+exports.registerHandler = registerHandler;
+exports.unregisterHandler = unregisterHandler;
+exports.findHandler = findHandler;
+exports.handlerIDToTag = void 0;
+const handlerIDToTag = {};
+exports.handlerIDToTag = handlerIDToTag;
+const handlers = new Map();
+let handlerTag = 1;
+
+function getNextHandlerTag() {
+ return handlerTag++;
+}
+
+function registerHandler(handlerTag, handler) {
+ handlers.set(handlerTag, handler);
+}
+
+function unregisterHandler(handlerTag) {
+ handlers.delete(handlerTag);
+}
+
+function findHandler(handlerTag) {
+ return handlers.get(handlerTag);
+}
+//# sourceMappingURL=handlersRegistry.js.map
\ No newline at end of file
diff --git a/lib/commonjs/handlers/handlersRegistry.js.map b/lib/commonjs/handlers/handlersRegistry.js.map
new file mode 100644
index 0000000000..6a868ab0b6
--- /dev/null
+++ b/lib/commonjs/handlers/handlersRegistry.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["handlersRegistry.ts"],"names":["handlerIDToTag","handlers","Map","handlerTag","getNextHandlerTag","registerHandler","handler","set","unregisterHandler","delete","findHandler","get"],"mappings":";;;;;;;;;;AAEO,MAAMA,cAAsC,GAAG,EAA/C;;AACP,MAAMC,QAAQ,GAAG,IAAIC,GAAJ,EAAjB;AAEA,IAAIC,UAAU,GAAG,CAAjB;;AAEO,SAASC,iBAAT,GAAqC;AAC1C,SAAOD,UAAU,EAAjB;AACD;;AAEM,SAASE,eAAT,CAAyBF,UAAzB,EAA6CG,OAA7C,EAAmE;AACxEL,EAAAA,QAAQ,CAACM,GAAT,CAAaJ,UAAb,EAAyBG,OAAzB;AACD;;AAEM,SAASE,iBAAT,CAA2BL,UAA3B,EAA+C;AACpDF,EAAAA,QAAQ,CAACQ,MAAT,CAAgBN,UAAhB;AACD;;AAEM,SAASO,WAAT,CAAqBP,UAArB,EAAyC;AAC9C,SAAOF,QAAQ,CAACU,GAAT,CAAaR,UAAb,CAAP;AACD","sourcesContent":["import { GestureType } from './gestures/gesture';\n\nexport const handlerIDToTag: Record = {};\nconst handlers = new Map();\n\nlet handlerTag = 1;\n\nexport function getNextHandlerTag(): number {\n return handlerTag++;\n}\n\nexport function registerHandler(handlerTag: number, handler: GestureType) {\n handlers.set(handlerTag, handler);\n}\n\nexport function unregisterHandler(handlerTag: number) {\n handlers.delete(handlerTag);\n}\n\nexport function findHandler(handlerTag: number) {\n return handlers.get(handlerTag);\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/index.js b/lib/commonjs/index.js
new file mode 100644
index 0000000000..53f35b08a8
--- /dev/null
+++ b/lib/commonjs/index.js
@@ -0,0 +1,232 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "Directions", {
+ enumerable: true,
+ get: function () {
+ return _Directions.Directions;
+ }
+});
+Object.defineProperty(exports, "State", {
+ enumerable: true,
+ get: function () {
+ return _State.State;
+ }
+});
+Object.defineProperty(exports, "gestureHandlerRootHOC", {
+ enumerable: true,
+ get: function () {
+ return _gestureHandlerRootHOC.default;
+ }
+});
+Object.defineProperty(exports, "GestureHandlerRootView", {
+ enumerable: true,
+ get: function () {
+ return _GestureHandlerRootView.default;
+ }
+});
+Object.defineProperty(exports, "TapGestureHandler", {
+ enumerable: true,
+ get: function () {
+ return _TapGestureHandler.TapGestureHandler;
+ }
+});
+Object.defineProperty(exports, "ForceTouchGestureHandler", {
+ enumerable: true,
+ get: function () {
+ return _ForceTouchGestureHandler.ForceTouchGestureHandler;
+ }
+});
+Object.defineProperty(exports, "LongPressGestureHandler", {
+ enumerable: true,
+ get: function () {
+ return _LongPressGestureHandler.LongPressGestureHandler;
+ }
+});
+Object.defineProperty(exports, "PanGestureHandler", {
+ enumerable: true,
+ get: function () {
+ return _PanGestureHandler.PanGestureHandler;
+ }
+});
+Object.defineProperty(exports, "PinchGestureHandler", {
+ enumerable: true,
+ get: function () {
+ return _PinchGestureHandler.PinchGestureHandler;
+ }
+});
+Object.defineProperty(exports, "RotationGestureHandler", {
+ enumerable: true,
+ get: function () {
+ return _RotationGestureHandler.RotationGestureHandler;
+ }
+});
+Object.defineProperty(exports, "FlingGestureHandler", {
+ enumerable: true,
+ get: function () {
+ return _FlingGestureHandler.FlingGestureHandler;
+ }
+});
+Object.defineProperty(exports, "createNativeWrapper", {
+ enumerable: true,
+ get: function () {
+ return _createNativeWrapper.default;
+ }
+});
+Object.defineProperty(exports, "GestureDetector", {
+ enumerable: true,
+ get: function () {
+ return _GestureDetector.GestureDetector;
+ }
+});
+Object.defineProperty(exports, "Gesture", {
+ enumerable: true,
+ get: function () {
+ return _gestureObjects.GestureObjects;
+ }
+});
+Object.defineProperty(exports, "NativeViewGestureHandler", {
+ enumerable: true,
+ get: function () {
+ return _NativeViewGestureHandler.NativeViewGestureHandler;
+ }
+});
+Object.defineProperty(exports, "RawButton", {
+ enumerable: true,
+ get: function () {
+ return _GestureButtons.RawButton;
+ }
+});
+Object.defineProperty(exports, "BaseButton", {
+ enumerable: true,
+ get: function () {
+ return _GestureButtons.BaseButton;
+ }
+});
+Object.defineProperty(exports, "RectButton", {
+ enumerable: true,
+ get: function () {
+ return _GestureButtons.RectButton;
+ }
+});
+Object.defineProperty(exports, "BorderlessButton", {
+ enumerable: true,
+ get: function () {
+ return _GestureButtons.BorderlessButton;
+ }
+});
+Object.defineProperty(exports, "TouchableHighlight", {
+ enumerable: true,
+ get: function () {
+ return _touchables.TouchableHighlight;
+ }
+});
+Object.defineProperty(exports, "TouchableNativeFeedback", {
+ enumerable: true,
+ get: function () {
+ return _touchables.TouchableNativeFeedback;
+ }
+});
+Object.defineProperty(exports, "TouchableOpacity", {
+ enumerable: true,
+ get: function () {
+ return _touchables.TouchableOpacity;
+ }
+});
+Object.defineProperty(exports, "TouchableWithoutFeedback", {
+ enumerable: true,
+ get: function () {
+ return _touchables.TouchableWithoutFeedback;
+ }
+});
+Object.defineProperty(exports, "ScrollView", {
+ enumerable: true,
+ get: function () {
+ return _GestureComponents.ScrollView;
+ }
+});
+Object.defineProperty(exports, "Switch", {
+ enumerable: true,
+ get: function () {
+ return _GestureComponents.Switch;
+ }
+});
+Object.defineProperty(exports, "TextInput", {
+ enumerable: true,
+ get: function () {
+ return _GestureComponents.TextInput;
+ }
+});
+Object.defineProperty(exports, "DrawerLayoutAndroid", {
+ enumerable: true,
+ get: function () {
+ return _GestureComponents.DrawerLayoutAndroid;
+ }
+});
+Object.defineProperty(exports, "FlatList", {
+ enumerable: true,
+ get: function () {
+ return _GestureComponents.FlatList;
+ }
+});
+Object.defineProperty(exports, "Swipeable", {
+ enumerable: true,
+ get: function () {
+ return _Swipeable.default;
+ }
+});
+Object.defineProperty(exports, "DrawerLayout", {
+ enumerable: true,
+ get: function () {
+ return _DrawerLayout.default;
+ }
+});
+
+var _init = require("./init");
+
+var _Directions = require("./Directions");
+
+var _State = require("./State");
+
+var _gestureHandlerRootHOC = _interopRequireDefault(require("./gestureHandlerRootHOC"));
+
+var _GestureHandlerRootView = _interopRequireDefault(require("./GestureHandlerRootView"));
+
+var _TapGestureHandler = require("./handlers/TapGestureHandler");
+
+var _ForceTouchGestureHandler = require("./handlers/ForceTouchGestureHandler");
+
+var _LongPressGestureHandler = require("./handlers/LongPressGestureHandler");
+
+var _PanGestureHandler = require("./handlers/PanGestureHandler");
+
+var _PinchGestureHandler = require("./handlers/PinchGestureHandler");
+
+var _RotationGestureHandler = require("./handlers/RotationGestureHandler");
+
+var _FlingGestureHandler = require("./handlers/FlingGestureHandler");
+
+var _createNativeWrapper = _interopRequireDefault(require("./handlers/createNativeWrapper"));
+
+var _GestureDetector = require("./handlers/gestures/GestureDetector");
+
+var _gestureObjects = require("./handlers/gestures/gestureObjects");
+
+var _NativeViewGestureHandler = require("./handlers/NativeViewGestureHandler");
+
+var _GestureButtons = require("./components/GestureButtons");
+
+var _touchables = require("./components/touchables");
+
+var _GestureComponents = require("./components/GestureComponents");
+
+var _Swipeable = _interopRequireDefault(require("./components/Swipeable"));
+
+var _DrawerLayout = _interopRequireDefault(require("./components/DrawerLayout"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+(0, _init.initialize)();
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/lib/commonjs/index.js.map b/lib/commonjs/index.js.map
new file mode 100644
index 0000000000..00f4743e2d
--- /dev/null
+++ b/lib/commonjs/index.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AA4CA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAiBA;;AAOA;;AAMA;;AAMA;;AA8CA;;AASA;;;;AAEA","sourcesContent":["import { initialize } from './init';\n\nexport { Directions } from './Directions';\nexport { State } from './State';\nexport { default as gestureHandlerRootHOC } from './gestureHandlerRootHOC';\nexport { default as GestureHandlerRootView } from './GestureHandlerRootView';\nexport type {\n // event types\n GestureEvent,\n HandlerStateChangeEvent,\n // event payloads types\n GestureEventPayload,\n HandlerStateChangeEventPayload,\n // pointer events\n GestureTouchEvent,\n TouchData,\n // new api event types\n GestureUpdateEvent,\n GestureStateChangeEvent,\n} from './handlers/gestureHandlerCommon';\nexport type { GestureType } from './handlers/gestures/gesture';\nexport type {\n TapGestureHandlerEventPayload,\n TapGestureHandlerProps,\n} from './handlers/TapGestureHandler';\nexport type {\n ForceTouchGestureHandlerEventPayload,\n ForceTouchGestureHandlerProps,\n} from './handlers/ForceTouchGestureHandler';\nexport type {\n LongPressGestureHandlerEventPayload,\n LongPressGestureHandlerProps,\n} from './handlers/LongPressGestureHandler';\nexport type {\n PanGestureHandlerEventPayload,\n PanGestureHandlerProps,\n} from './handlers/PanGestureHandler';\nexport type {\n PinchGestureHandlerEventPayload,\n PinchGestureHandlerProps,\n} from './handlers/PinchGestureHandler';\nexport type {\n RotationGestureHandlerEventPayload,\n RotationGestureHandlerProps,\n} from './handlers/RotationGestureHandler';\nexport type {\n FlingGestureHandlerEventPayload,\n FlingGestureHandlerProps,\n} from './handlers/FlingGestureHandler';\nexport { TapGestureHandler } from './handlers/TapGestureHandler';\nexport { ForceTouchGestureHandler } from './handlers/ForceTouchGestureHandler';\nexport { LongPressGestureHandler } from './handlers/LongPressGestureHandler';\nexport { PanGestureHandler } from './handlers/PanGestureHandler';\nexport { PinchGestureHandler } from './handlers/PinchGestureHandler';\nexport { RotationGestureHandler } from './handlers/RotationGestureHandler';\nexport { FlingGestureHandler } from './handlers/FlingGestureHandler';\nexport { default as createNativeWrapper } from './handlers/createNativeWrapper';\nexport type {\n NativeViewGestureHandlerPayload,\n NativeViewGestureHandlerProps,\n} from './handlers/NativeViewGestureHandler';\nexport { GestureDetector } from './handlers/gestures/GestureDetector';\nexport { GestureObjects as Gesture } from './handlers/gestures/gestureObjects';\nexport type { TapGestureType as TapGesture } from './handlers/gestures/tapGesture';\nexport type { PanGestureType as PanGesture } from './handlers/gestures/panGesture';\nexport type { FlingGestureType as FlingGesture } from './handlers/gestures/flingGesture';\nexport type { LongPressGestureType as LongPressGesture } from './handlers/gestures/longPressGesture';\nexport type { PinchGestureType as PinchGesture } from './handlers/gestures/pinchGesture';\nexport type { RotationGestureType as RotationGesture } from './handlers/gestures/rotationGesture';\nexport type { ForceTouchGestureType as ForceTouchGesture } from './handlers/gestures/forceTouchGesture';\nexport type { NativeGestureType as NativeGesture } from './handlers/gestures/nativeGesture';\nexport type { ManualGestureType as ManualGesture } from './handlers/gestures/manualGesture';\nexport type {\n ComposedGestureType as ComposedGesture,\n RaceGestureType as RaceGesture,\n SimultaneousGestureType as SimultaneousGesture,\n ExclusiveGestureType as ExclusiveGesture,\n} from './handlers/gestures/gestureComposition';\nexport type { GestureStateManagerType as GestureStateManager } from './handlers/gestures/gestureStateManager';\nexport { NativeViewGestureHandler } from './handlers/NativeViewGestureHandler';\nexport type {\n RawButtonProps,\n BaseButtonProps,\n RectButtonProps,\n BorderlessButtonProps,\n} from './components/GestureButtons';\nexport {\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n} from './components/GestureButtons';\nexport {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n} from './components/touchables';\nexport {\n ScrollView,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n FlatList,\n} from './components/GestureComponents';\nexport type {\n //events\n GestureHandlerGestureEvent,\n GestureHandlerStateChangeEvent,\n //event payloads\n GestureHandlerGestureEventNativeEvent,\n GestureHandlerStateChangeNativeEvent,\n NativeViewGestureHandlerGestureEvent,\n NativeViewGestureHandlerStateChangeEvent,\n TapGestureHandlerGestureEvent,\n TapGestureHandlerStateChangeEvent,\n ForceTouchGestureHandlerGestureEvent,\n ForceTouchGestureHandlerStateChangeEvent,\n LongPressGestureHandlerGestureEvent,\n LongPressGestureHandlerStateChangeEvent,\n PanGestureHandlerGestureEvent,\n PanGestureHandlerStateChangeEvent,\n PinchGestureHandlerGestureEvent,\n PinchGestureHandlerStateChangeEvent,\n RotationGestureHandlerGestureEvent,\n RotationGestureHandlerStateChangeEvent,\n FlingGestureHandlerGestureEvent,\n FlingGestureHandlerStateChangeEvent,\n // handlers props\n NativeViewGestureHandlerProperties,\n TapGestureHandlerProperties,\n LongPressGestureHandlerProperties,\n PanGestureHandlerProperties,\n PinchGestureHandlerProperties,\n RotationGestureHandlerProperties,\n FlingGestureHandlerProperties,\n ForceTouchGestureHandlerProperties,\n // buttons props\n RawButtonProperties,\n BaseButtonProperties,\n RectButtonProperties,\n BorderlessButtonProperties,\n} from './handlers/gestureHandlerTypesCompat';\n\nexport { default as Swipeable } from './components/Swipeable';\nexport type {\n DrawerLayoutProps,\n DrawerPosition,\n DrawerState,\n DrawerType,\n DrawerLockMode,\n DrawerKeyboardDismissMode,\n} from './components/DrawerLayout';\nexport { default as DrawerLayout } from './components/DrawerLayout';\n\ninitialize();\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/init.js b/lib/commonjs/init.js
new file mode 100644
index 0000000000..73ae9d230f
--- /dev/null
+++ b/lib/commonjs/init.js
@@ -0,0 +1,13 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.initialize = initialize;
+
+var _eventReceiver = require("./handlers/gestures/eventReceiver");
+
+function initialize() {
+ (0, _eventReceiver.startListening)();
+}
+//# sourceMappingURL=init.js.map
\ No newline at end of file
diff --git a/lib/commonjs/init.js.map b/lib/commonjs/init.js.map
new file mode 100644
index 0000000000..6371c19eb7
--- /dev/null
+++ b/lib/commonjs/init.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["init.ts"],"names":["initialize"],"mappings":";;;;;;;AAAA;;AAEO,SAASA,UAAT,GAAsB;AAC3B;AACD","sourcesContent":["import { startListening } from './handlers/gestures/eventReceiver';\n\nexport function initialize() {\n startListening();\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/mocks.js b/lib/commonjs/mocks.js
new file mode 100644
index 0000000000..5b4fdc033b
--- /dev/null
+++ b/lib/commonjs/mocks.js
@@ -0,0 +1,64 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _reactNative = require("react-native");
+
+var _State = require("./State");
+
+var _Directions = require("./Directions");
+
+const NOOP = () => {// do nothing
+};
+
+const PanGestureHandler = _reactNative.View;
+const attachGestureHandler = NOOP;
+const createGestureHandler = NOOP;
+const dropGestureHandler = NOOP;
+const updateGestureHandler = NOOP;
+const NativeViewGestureHandler = _reactNative.View;
+const TapGestureHandler = _reactNative.View;
+const ForceTouchGestureHandler = _reactNative.View;
+const LongPressGestureHandler = _reactNative.View;
+const PinchGestureHandler = _reactNative.View;
+const RotationGestureHandler = _reactNative.View;
+const FlingGestureHandler = _reactNative.View;
+const RawButton = _reactNative.TouchableNativeFeedback;
+const BaseButton = _reactNative.TouchableNativeFeedback;
+const RectButton = _reactNative.TouchableNativeFeedback;
+const BorderlessButton = _reactNative.TouchableNativeFeedback;
+var _default = {
+ TouchableHighlight: _reactNative.TouchableHighlight,
+ TouchableNativeFeedback: _reactNative.TouchableNativeFeedback,
+ TouchableOpacity: _reactNative.TouchableOpacity,
+ TouchableWithoutFeedback: _reactNative.TouchableWithoutFeedback,
+ ScrollView: _reactNative.ScrollView,
+ FlatList: _reactNative.FlatList,
+ Switch: _reactNative.Switch,
+ TextInput: _reactNative.TextInput,
+ DrawerLayoutAndroid: _reactNative.DrawerLayoutAndroid,
+ NativeViewGestureHandler,
+ TapGestureHandler,
+ ForceTouchGestureHandler,
+ LongPressGestureHandler,
+ PinchGestureHandler,
+ RotationGestureHandler,
+ FlingGestureHandler,
+ RawButton,
+ BaseButton,
+ RectButton,
+ BorderlessButton,
+ PanGestureHandler,
+ attachGestureHandler,
+ createGestureHandler,
+ dropGestureHandler,
+ updateGestureHandler,
+ // probably can be removed
+ Directions: _Directions.Directions,
+ State: _State.State
+};
+exports.default = _default;
+//# sourceMappingURL=mocks.js.map
\ No newline at end of file
diff --git a/lib/commonjs/mocks.js.map b/lib/commonjs/mocks.js.map
new file mode 100644
index 0000000000..cce7f5cd4d
--- /dev/null
+++ b/lib/commonjs/mocks.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["mocks.ts"],"names":["NOOP","PanGestureHandler","View","attachGestureHandler","createGestureHandler","dropGestureHandler","updateGestureHandler","NativeViewGestureHandler","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","RawButton","TouchableNativeFeedback","BaseButton","RectButton","BorderlessButton","TouchableHighlight","TouchableOpacity","TouchableWithoutFeedback","ScrollView","FlatList","Switch","TextInput","DrawerLayoutAndroid","Directions","State"],"mappings":";;;;;;;AAAA;;AAYA;;AACA;;AAEA,MAAMA,IAAI,GAAG,MAAM,CACjB;AACD,CAFD;;AAGA,MAAMC,iBAAiB,GAAGC,iBAA1B;AACA,MAAMC,oBAAoB,GAAGH,IAA7B;AACA,MAAMI,oBAAoB,GAAGJ,IAA7B;AACA,MAAMK,kBAAkB,GAAGL,IAA3B;AACA,MAAMM,oBAAoB,GAAGN,IAA7B;AACA,MAAMO,wBAAwB,GAAGL,iBAAjC;AACA,MAAMM,iBAAiB,GAAGN,iBAA1B;AACA,MAAMO,wBAAwB,GAAGP,iBAAjC;AACA,MAAMQ,uBAAuB,GAAGR,iBAAhC;AACA,MAAMS,mBAAmB,GAAGT,iBAA5B;AACA,MAAMU,sBAAsB,GAAGV,iBAA/B;AACA,MAAMW,mBAAmB,GAAGX,iBAA5B;AACA,MAAMY,SAAS,GAAGC,oCAAlB;AACA,MAAMC,UAAU,GAAGD,oCAAnB;AACA,MAAME,UAAU,GAAGF,oCAAnB;AACA,MAAMG,gBAAgB,GAAGH,oCAAzB;eAEe;AACbI,EAAAA,kBAAkB,EAAlBA,+BADa;AAEbJ,EAAAA,uBAAuB,EAAvBA,oCAFa;AAGbK,EAAAA,gBAAgB,EAAhBA,6BAHa;AAIbC,EAAAA,wBAAwB,EAAxBA,qCAJa;AAKbC,EAAAA,UAAU,EAAVA,uBALa;AAMbC,EAAAA,QAAQ,EAARA,qBANa;AAObC,EAAAA,MAAM,EAANA,mBAPa;AAQbC,EAAAA,SAAS,EAATA,sBARa;AASbC,EAAAA,mBAAmB,EAAnBA,gCATa;AAUbnB,EAAAA,wBAVa;AAWbC,EAAAA,iBAXa;AAYbC,EAAAA,wBAZa;AAabC,EAAAA,uBAba;AAcbC,EAAAA,mBAda;AAebC,EAAAA,sBAfa;AAgBbC,EAAAA,mBAhBa;AAiBbC,EAAAA,SAjBa;AAkBbE,EAAAA,UAlBa;AAmBbC,EAAAA,UAnBa;AAoBbC,EAAAA,gBApBa;AAqBbjB,EAAAA,iBArBa;AAsBbE,EAAAA,oBAtBa;AAuBbC,EAAAA,oBAvBa;AAwBbC,EAAAA,kBAxBa;AAyBbC,EAAAA,oBAzBa;AA0Bb;AACAqB,EAAAA,UAAU,EAAVA,sBA3Ba;AA4BbC,EAAAA,KAAK,EAALA;AA5Ba,C","sourcesContent":["import {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n ScrollView,\n FlatList,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n View,\n} from 'react-native';\nimport { State } from './State';\nimport { Directions } from './Directions';\n\nconst NOOP = () => {\n // do nothing\n};\nconst PanGestureHandler = View;\nconst attachGestureHandler = NOOP;\nconst createGestureHandler = NOOP;\nconst dropGestureHandler = NOOP;\nconst updateGestureHandler = NOOP;\nconst NativeViewGestureHandler = View;\nconst TapGestureHandler = View;\nconst ForceTouchGestureHandler = View;\nconst LongPressGestureHandler = View;\nconst PinchGestureHandler = View;\nconst RotationGestureHandler = View;\nconst FlingGestureHandler = View;\nconst RawButton = TouchableNativeFeedback;\nconst BaseButton = TouchableNativeFeedback;\nconst RectButton = TouchableNativeFeedback;\nconst BorderlessButton = TouchableNativeFeedback;\n\nexport default {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n ScrollView,\n FlatList,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n NativeViewGestureHandler,\n TapGestureHandler,\n ForceTouchGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n PanGestureHandler,\n attachGestureHandler,\n createGestureHandler,\n dropGestureHandler,\n updateGestureHandler,\n // probably can be removed\n Directions,\n State,\n} as const;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/typeUtils.js b/lib/commonjs/typeUtils.js
new file mode 100644
index 0000000000..ae0eefb321
--- /dev/null
+++ b/lib/commonjs/typeUtils.js
@@ -0,0 +1,2 @@
+"use strict";
+//# sourceMappingURL=typeUtils.js.map
\ No newline at end of file
diff --git a/lib/commonjs/typeUtils.js.map b/lib/commonjs/typeUtils.js.map
new file mode 100644
index 0000000000..9ffd4b22fc
--- /dev/null
+++ b/lib/commonjs/typeUtils.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
\ No newline at end of file
diff --git a/lib/commonjs/utils.js b/lib/commonjs/utils.js
new file mode 100644
index 0000000000..b1720bf8e0
--- /dev/null
+++ b/lib/commonjs/utils.js
@@ -0,0 +1,15 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.toArray = toArray;
+
+function toArray(object) {
+ if (!Array.isArray(object)) {
+ return [object];
+ }
+
+ return object;
+}
+//# sourceMappingURL=utils.js.map
\ No newline at end of file
diff --git a/lib/commonjs/utils.js.map b/lib/commonjs/utils.js.map
new file mode 100644
index 0000000000..31448144f1
--- /dev/null
+++ b/lib/commonjs/utils.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["utils.ts"],"names":["toArray","object","Array","isArray"],"mappings":";;;;;;;AAAO,SAASA,OAAT,CAAoBC,MAApB,EAA0C;AAC/C,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAL,EAA4B;AAC1B,WAAO,CAACA,MAAD,CAAP;AACD;;AAED,SAAOA,MAAP;AACD","sourcesContent":["export function toArray(object: T | T[]): T[] {\n if (!Array.isArray(object)) {\n return [object];\n }\n\n return object;\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/DiscreteGestureHandler.js b/lib/commonjs/web/DiscreteGestureHandler.js
new file mode 100644
index 0000000000..e9cf916a19
--- /dev/null
+++ b/lib/commonjs/web/DiscreteGestureHandler.js
@@ -0,0 +1,105 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _GestureHandler = _interopRequireDefault(require("./GestureHandler"));
+
+var _utils = require("./utils");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/* eslint-disable eslint-comments/no-unlimited-disable */
+
+/* eslint-disable */
+class DiscreteGestureHandler extends _GestureHandler.default {
+ get isDiscrete() {
+ return true;
+ }
+
+ get shouldEnableGestureOnSetup() {
+ return true;
+ }
+
+ shouldFailUnderCustomCriteria({
+ x,
+ y,
+ deltaX,
+ deltaY
+ }, {
+ maxDeltaX,
+ maxDeltaY,
+ maxDistSq,
+ shouldCancelWhenOutside
+ }) {
+ if (shouldCancelWhenOutside) {
+ if (!this.isPointInView({
+ x,
+ y
+ })) {
+ return true;
+ }
+ }
+
+ return (0, _utils.TEST_MAX_IF_NOT_NAN)(Math.abs(deltaX), maxDeltaX) || (0, _utils.TEST_MAX_IF_NOT_NAN)(Math.abs(deltaY), maxDeltaY) || (0, _utils.TEST_MAX_IF_NOT_NAN)(Math.abs(deltaY * deltaY + deltaX * deltaX), maxDistSq);
+ }
+
+ transformNativeEvent({
+ center: {
+ x,
+ y
+ }
+ }) {
+ // @ts-ignore FIXME(TS)
+ const rect = this.view.getBoundingClientRect();
+ return {
+ absoluteX: x,
+ absoluteY: y,
+ x: x - rect.left,
+ y: y - rect.top
+ };
+ }
+
+ isGestureEnabledForEvent({
+ minPointers,
+ maxPointers,
+ maxDeltaX,
+ maxDeltaY,
+ maxDistSq,
+ shouldCancelWhenOutside
+ }, _recognizer, {
+ maxPointers: pointerLength,
+ center,
+ deltaX,
+ deltaY
+ }) {
+ const validPointerCount = pointerLength >= minPointers && pointerLength <= maxPointers;
+
+ if (this.shouldFailUnderCustomCriteria({ ...center,
+ deltaX,
+ deltaY
+ }, {
+ maxDeltaX,
+ maxDeltaY,
+ maxDistSq,
+ shouldCancelWhenOutside
+ }) || // A user probably won't land a multi-pointer tap on the first tick (so we cannot just cancel each time)
+ // but if the gesture is running and the user adds or subtracts another pointer then it should fail.
+ !validPointerCount && this.isGestureRunning) {
+ return {
+ failed: true
+ };
+ }
+
+ return {
+ success: validPointerCount
+ };
+ }
+
+}
+
+var _default = DiscreteGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=DiscreteGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/DiscreteGestureHandler.js.map b/lib/commonjs/web/DiscreteGestureHandler.js.map
new file mode 100644
index 0000000000..a15efc5aa5
--- /dev/null
+++ b/lib/commonjs/web/DiscreteGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["DiscreteGestureHandler.ts"],"names":["DiscreteGestureHandler","GestureHandler","isDiscrete","shouldEnableGestureOnSetup","shouldFailUnderCustomCriteria","x","y","deltaX","deltaY","maxDeltaX","maxDeltaY","maxDistSq","shouldCancelWhenOutside","isPointInView","Math","abs","transformNativeEvent","center","rect","view","getBoundingClientRect","absoluteX","absoluteY","left","top","isGestureEnabledForEvent","minPointers","maxPointers","_recognizer","pointerLength","validPointerCount","isGestureRunning","failed","success"],"mappings":";;;;;;;AAEA;;AACA;;;;AAHA;;AACA;AAIA,MAAeA,sBAAf,SAA8CC,uBAA9C,CAA6D;AAC7C,MAAVC,UAAU,GAAG;AACf,WAAO,IAAP;AACD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AAA;AANF,GADsB,EAStBgB,WATsB,EAUtB;AAAED,IAAAA,WAAW,EAAEE,aAAf;AAA8BZ,IAAAA,MAA9B;AAAsCV,IAAAA,MAAtC;AAA8CC,IAAAA;AAA9C,GAVsB,EAWtB;AACA,UAAMsB,iBAAiB,GACrBD,aAAa,IAAIH,WAAjB,IAAgCG,aAAa,IAAIF,WADnD;;AAGA,QACE,KAAKvB,6BAAL,CACE,EAAE,GAAGa,MAAL;AAAaV,MAAAA,MAAb;AAAqBC,MAAAA;AAArB,KADF,EAEE;AACEC,MAAAA,SADF;AAEEC,MAAAA,SAFF;AAGEC,MAAAA,SAHF;AAIEC,MAAAA;AAJF,KAFF,KASA;AACA;AACC,KAACkB,iBAAD,IAAsB,KAAKC,gBAZ9B,EAaE;AACA,aAAO;AAAEC,QAAAA,MAAM,EAAE;AAAV,OAAP;AACD;;AAED,WAAO;AAAEC,MAAAA,OAAO,EAAEH;AAAX,KAAP;AACD;;AAzE0D;;eA4E9C9B,sB","sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport GestureHandler from './GestureHandler';\nimport { TEST_MAX_IF_NOT_NAN } from './utils';\n\nabstract class DiscreteGestureHandler extends GestureHandler {\n get isDiscrete() {\n return true;\n }\n\n get shouldEnableGestureOnSetup() {\n return true;\n }\n\n shouldFailUnderCustomCriteria(\n { x, y, deltaX, deltaY }: any,\n { maxDeltaX, maxDeltaY, maxDistSq, shouldCancelWhenOutside }: any\n ) {\n if (shouldCancelWhenOutside) {\n if (!this.isPointInView({ x, y })) {\n return true;\n }\n }\n return (\n TEST_MAX_IF_NOT_NAN(Math.abs(deltaX), maxDeltaX) ||\n TEST_MAX_IF_NOT_NAN(Math.abs(deltaY), maxDeltaY) ||\n TEST_MAX_IF_NOT_NAN(\n Math.abs(deltaY * deltaY + deltaX * deltaX),\n maxDistSq\n )\n );\n }\n\n transformNativeEvent({ center: { x, y } }: any) {\n // @ts-ignore FIXME(TS)\n const rect = this.view!.getBoundingClientRect();\n\n return {\n absoluteX: x,\n absoluteY: y,\n x: x - rect.left,\n y: y - rect.top,\n };\n }\n\n isGestureEnabledForEvent(\n {\n minPointers,\n maxPointers,\n maxDeltaX,\n maxDeltaY,\n maxDistSq,\n shouldCancelWhenOutside,\n }: any,\n _recognizer: any,\n { maxPointers: pointerLength, center, deltaX, deltaY }: any\n ) {\n const validPointerCount =\n pointerLength >= minPointers && pointerLength <= maxPointers;\n\n if (\n this.shouldFailUnderCustomCriteria(\n { ...center, deltaX, deltaY },\n {\n maxDeltaX,\n maxDeltaY,\n maxDistSq,\n shouldCancelWhenOutside,\n }\n ) ||\n // A user probably won't land a multi-pointer tap on the first tick (so we cannot just cancel each time)\n // but if the gesture is running and the user adds or subtracts another pointer then it should fail.\n (!validPointerCount && this.isGestureRunning)\n ) {\n return { failed: true };\n }\n\n return { success: validPointerCount };\n }\n}\n\nexport default DiscreteGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/DraggingGestureHandler.js b/lib/commonjs/web/DraggingGestureHandler.js
new file mode 100644
index 0000000000..82a4e21530
--- /dev/null
+++ b/lib/commonjs/web/DraggingGestureHandler.js
@@ -0,0 +1,53 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _GestureHandler = _interopRequireDefault(require("./GestureHandler"));
+
+var _reactNative = require("react-native");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/* eslint-disable eslint-comments/no-unlimited-disable */
+
+/* eslint-disable */
+class DraggingGestureHandler extends _GestureHandler.default {
+ get shouldEnableGestureOnSetup() {
+ return true;
+ }
+
+ transformNativeEvent({
+ deltaX,
+ deltaY,
+ velocityX,
+ velocityY,
+ center: {
+ x,
+ y
+ }
+ }) {
+ // @ts-ignore FIXME(TS)
+ const rect = this.view.getBoundingClientRect();
+
+ const ratio = _reactNative.PixelRatio.get();
+
+ return {
+ translationX: deltaX - (this.__initialX || 0),
+ translationY: deltaY - (this.__initialY || 0),
+ absoluteX: x,
+ absoluteY: y,
+ velocityX: velocityX * ratio,
+ velocityY: velocityY * ratio,
+ x: x - rect.left,
+ y: y - rect.top
+ };
+ }
+
+}
+
+var _default = DraggingGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=DraggingGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/DraggingGestureHandler.js.map b/lib/commonjs/web/DraggingGestureHandler.js.map
new file mode 100644
index 0000000000..f2b17a86fd
--- /dev/null
+++ b/lib/commonjs/web/DraggingGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["DraggingGestureHandler.ts"],"names":["DraggingGestureHandler","GestureHandler","shouldEnableGestureOnSetup","transformNativeEvent","deltaX","deltaY","velocityX","velocityY","center","x","y","rect","view","getBoundingClientRect","ratio","PixelRatio","get","translationX","__initialX","translationY","__initialY","absoluteX","absoluteY","left","top"],"mappings":";;;;;;;AAEA;;AACA;;;;AAHA;;AACA;AAIA,MAAeA,sBAAf,SAA8CC,uBAA9C,CAA6D;AAC7B,MAA1BC,0BAA0B,GAAG;AAC/B,WAAO,IAAP;AACD;;AAEDC,EAAAA,oBAAoB,CAAC;AACnBC,IAAAA,MADmB;AAEnBC,IAAAA,MAFmB;AAGnBC,IAAAA,SAHmB;AAInBC,IAAAA,SAJmB;AAKnBC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,CAAF;AAAKC,MAAAA;AAAL;AALW,GAAD,EAMD;AACjB;AACA,UAAMC,IAAI,GAAG,KAAKC,IAAL,CAAWC,qBAAX,EAAb;;AACA,UAAMC,KAAK,GAAGC,wBAAWC,GAAX,EAAd;;AACA,WAAO;AACLC,MAAAA,YAAY,EAAEb,MAAM,IAAI,KAAKc,UAAL,IAAmB,CAAvB,CADf;AAELC,MAAAA,YAAY,EAAEd,MAAM,IAAI,KAAKe,UAAL,IAAmB,CAAvB,CAFf;AAGLC,MAAAA,SAAS,EAAEZ,CAHN;AAILa,MAAAA,SAAS,EAAEZ,CAJN;AAKLJ,MAAAA,SAAS,EAAEA,SAAS,GAAGQ,KALlB;AAMLP,MAAAA,SAAS,EAAEA,SAAS,GAAGO,KANlB;AAOLL,MAAAA,CAAC,EAAEA,CAAC,GAAGE,IAAI,CAACY,IAPP;AAQLb,MAAAA,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACa;AARP,KAAP;AAUD;;AAzB0D;;eA4B9CxB,sB","sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport GestureHandler, { HammerInputExt } from './GestureHandler';\nimport { PixelRatio } from 'react-native';\n\nabstract class DraggingGestureHandler extends GestureHandler {\n get shouldEnableGestureOnSetup() {\n return true;\n }\n\n transformNativeEvent({\n deltaX,\n deltaY,\n velocityX,\n velocityY,\n center: { x, y },\n }: HammerInputExt) {\n // @ts-ignore FIXME(TS)\n const rect = this.view!.getBoundingClientRect();\n const ratio = PixelRatio.get();\n return {\n translationX: deltaX - (this.__initialX || 0),\n translationY: deltaY - (this.__initialY || 0),\n absoluteX: x,\n absoluteY: y,\n velocityX: velocityX * ratio,\n velocityY: velocityY * ratio,\n x: x - rect.left,\n y: y - rect.top,\n };\n }\n}\n\nexport default DraggingGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/Errors.js b/lib/commonjs/web/Errors.js
new file mode 100644
index 0000000000..01eeb4eea8
--- /dev/null
+++ b/lib/commonjs/web/Errors.js
@@ -0,0 +1,16 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.GesturePropError = void 0;
+
+class GesturePropError extends Error {
+ constructor(name, value, expectedType) {
+ super(`Invalid property \`${name}: ${value}\` expected \`${expectedType}\``);
+ }
+
+}
+
+exports.GesturePropError = GesturePropError;
+//# sourceMappingURL=Errors.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/Errors.js.map b/lib/commonjs/web/Errors.js.map
new file mode 100644
index 0000000000..97a926b421
--- /dev/null
+++ b/lib/commonjs/web/Errors.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["Errors.ts"],"names":["GesturePropError","Error","constructor","name","value","expectedType"],"mappings":";;;;;;;AAAO,MAAMA,gBAAN,SAA+BC,KAA/B,CAAqC;AAC1CC,EAAAA,WAAW,CAACC,IAAD,EAAeC,KAAf,EAA+BC,YAA/B,EAAqD;AAC9D,UACG,sBAAqBF,IAAK,KAAIC,KAAM,iBAAgBC,YAAa,IADpE;AAGD;;AALyC","sourcesContent":["export class GesturePropError extends Error {\n constructor(name: string, value: unknown, expectedType: string) {\n super(\n `Invalid property \\`${name}: ${value}\\` expected \\`${expectedType}\\``\n );\n }\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/FlingGestureHandler.js b/lib/commonjs/web/FlingGestureHandler.js
new file mode 100644
index 0000000000..554f5fd888
--- /dev/null
+++ b/lib/commonjs/web/FlingGestureHandler.js
@@ -0,0 +1,170 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _hammerjs = _interopRequireDefault(require("@egjs/hammerjs"));
+
+var _constants = require("./constants");
+
+var _Errors = require("./Errors");
+
+var _DraggingGestureHandler = _interopRequireDefault(require("./DraggingGestureHandler"));
+
+var _utils = require("./utils");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/* eslint-disable eslint-comments/no-unlimited-disable */
+
+/* eslint-disable */
+class FlingGestureHandler extends _DraggingGestureHandler.default {
+ get name() {
+ return 'swipe';
+ }
+
+ get NativeGestureClass() {
+ return _hammerjs.default.Swipe;
+ }
+
+ onGestureActivated(event) {
+ this.sendEvent({ ...event,
+ eventType: _hammerjs.default.INPUT_MOVE,
+ isFinal: false,
+ isFirst: true
+ });
+ this.isGestureRunning = false;
+ this.hasGestureFailed = false;
+ this.sendEvent({ ...event,
+ eventType: _hammerjs.default.INPUT_END,
+ isFinal: true
+ });
+ }
+
+ onRawEvent(ev) {
+ super.onRawEvent(ev);
+
+ if (this.hasGestureFailed) {
+ return;
+ } // Hammer doesn't send a `cancel` event for taps.
+ // Manually fail the event.
+
+
+ if (ev.isFinal) {
+ setTimeout(() => {
+ if (this.isGestureRunning) {
+ this.cancelEvent(ev);
+ }
+ });
+ } else if (!this.hasGestureFailed && !this.isGestureRunning) {
+ // Tap Gesture start event
+ const gesture = this.hammer.get(this.name); // @ts-ignore FIXME(TS)
+
+ if (gesture.options.enable(gesture, ev)) {
+ this.onStart(ev);
+ this.sendEvent(ev);
+ }
+ }
+ }
+
+ getHammerConfig() {
+ return {
+ // @ts-ignore FIXME(TS)
+ pointers: this.config.numberOfPointers,
+ direction: this.getDirection()
+ };
+ }
+
+ getTargetDirections(direction) {
+ const directions = [];
+
+ if (direction & _constants.Direction.RIGHT) {
+ directions.push(_hammerjs.default.DIRECTION_RIGHT);
+ }
+
+ if (direction & _constants.Direction.LEFT) {
+ directions.push(_hammerjs.default.DIRECTION_LEFT);
+ }
+
+ if (direction & _constants.Direction.UP) {
+ directions.push(_hammerjs.default.DIRECTION_UP);
+ }
+
+ if (direction & _constants.Direction.DOWN) {
+ directions.push(_hammerjs.default.DIRECTION_DOWN);
+ } // const hammerDirection = directions.reduce((a, b) => a | b, 0);
+
+
+ return directions;
+ }
+
+ getDirection() {
+ // @ts-ignore FIXME(TS)
+ const {
+ direction
+ } = this.getConfig();
+ let directions = [];
+
+ if (direction & _constants.Direction.RIGHT) {
+ directions.push(_hammerjs.default.DIRECTION_HORIZONTAL);
+ }
+
+ if (direction & _constants.Direction.LEFT) {
+ directions.push(_hammerjs.default.DIRECTION_HORIZONTAL);
+ }
+
+ if (direction & _constants.Direction.UP) {
+ directions.push(_hammerjs.default.DIRECTION_VERTICAL);
+ }
+
+ if (direction & _constants.Direction.DOWN) {
+ directions.push(_hammerjs.default.DIRECTION_VERTICAL);
+ }
+
+ directions = [...new Set(directions)];
+ if (directions.length === 0) return _hammerjs.default.DIRECTION_NONE;
+ if (directions.length === 1) return directions[0];
+ return _hammerjs.default.DIRECTION_ALL;
+ }
+
+ isGestureEnabledForEvent({
+ numberOfPointers
+ }, _recognizer, {
+ maxPointers: pointerLength
+ }) {
+ const validPointerCount = pointerLength === numberOfPointers;
+
+ if (!validPointerCount && this.isGestureRunning) {
+ return {
+ failed: true
+ };
+ }
+
+ return {
+ success: validPointerCount
+ };
+ }
+
+ updateGestureConfig({
+ numberOfPointers = 1,
+ direction,
+ ...props
+ }) {
+ if ((0, _utils.isnan)(direction) || typeof direction !== 'number') {
+ throw new _Errors.GesturePropError('direction', direction, 'number');
+ }
+
+ return super.updateGestureConfig({
+ numberOfPointers,
+ direction,
+ ...props
+ });
+ }
+
+}
+
+var _default = FlingGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=FlingGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/FlingGestureHandler.js.map b/lib/commonjs/web/FlingGestureHandler.js.map
new file mode 100644
index 0000000000..226f11494c
--- /dev/null
+++ b/lib/commonjs/web/FlingGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["FlingGestureHandler.ts"],"names":["FlingGestureHandler","DraggingGestureHandler","name","NativeGestureClass","Hammer","Swipe","onGestureActivated","event","sendEvent","eventType","INPUT_MOVE","isFinal","isFirst","isGestureRunning","hasGestureFailed","INPUT_END","onRawEvent","ev","setTimeout","cancelEvent","gesture","hammer","get","options","enable","onStart","getHammerConfig","pointers","config","numberOfPointers","direction","getDirection","getTargetDirections","directions","Direction","RIGHT","push","DIRECTION_RIGHT","LEFT","DIRECTION_LEFT","UP","DIRECTION_UP","DOWN","DIRECTION_DOWN","getConfig","DIRECTION_HORIZONTAL","DIRECTION_VERTICAL","Set","length","DIRECTION_NONE","DIRECTION_ALL","isGestureEnabledForEvent","_recognizer","maxPointers","pointerLength","validPointerCount","failed","success","updateGestureConfig","props","GesturePropError"],"mappings":";;;;;;;AAEA;;AAEA;;AACA;;AACA;;AACA;;;;AAPA;;AACA;AASA,MAAMA,mBAAN,SAAkC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AX,CAAgBhC,kBAAO0C,kBAAvB;AACD;;AACDb,IAAAA,UAAU,GAAG,CAAC,GAAG,IAAIc,GAAJ,CAAQd,UAAR,CAAJ,CAAb;AAEA,QAAIA,UAAU,CAACe,MAAX,KAAsB,CAA1B,EAA6B,OAAO5C,kBAAO6C,cAAd;AAC7B,QAAIhB,UAAU,CAACe,MAAX,KAAsB,CAA1B,EAA6B,OAAOf,UAAU,CAAC,CAAD,CAAjB;AAC7B,WAAO7B,kBAAO8C,aAAd;AACD;;AAEDC,EAAAA,wBAAwB,CACtB;AAAEtB,IAAAA;AAAF,GADsB,EAEtBuB,WAFsB,EAGtB;AAAEC,IAAAA,WAAW,EAAEC;AAAf,GAHsB,EAItB;AACA,UAAMC,iBAAiB,GAAGD,aAAa,KAAKzB,gBAA5C;;AACA,QAAI,CAAC0B,iBAAD,IAAsB,KAAK1C,gBAA/B,EAAiD;AAC/C,aAAO;AAAE2C,QAAAA,MAAM,EAAE;AAAV,OAAP;AACD;;AACD,WAAO;AAAEC,MAAAA,OAAO,EAAEF;AAAX,KAAP;AACD;;AAEDG,EAAAA,mBAAmB,CAAC;AAAE7B,IAAAA,gBAAgB,GAAG,CAArB;AAAwBC,IAAAA,SAAxB;AAAmC,OAAG6B;AAAtC,GAAD,EAAqD;AACtE,QAAI,kBAAM7B,SAAN,KAAoB,OAAOA,SAAP,KAAqB,QAA7C,EAAuD;AACrD,YAAM,IAAI8B,wBAAJ,CAAqB,WAArB,EAAkC9B,SAAlC,EAA6C,QAA7C,CAAN;AACD;;AACD,WAAO,MAAM4B,mBAAN,CAA0B;AAC/B7B,MAAAA,gBAD+B;AAE/BC,MAAAA,SAF+B;AAG/B,SAAG6B;AAH4B,KAA1B,CAAP;AAKD;;AAxHsD;;eA2H1C3D,mB","sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport Hammer from '@egjs/hammerjs';\n\nimport { Direction } from './constants';\nimport { GesturePropError } from './Errors';\nimport DraggingGestureHandler from './DraggingGestureHandler';\nimport { isnan } from './utils';\nimport { HammerInputExt } from './GestureHandler';\n\nclass FlingGestureHandler extends DraggingGestureHandler {\n get name() {\n return 'swipe';\n }\n\n get NativeGestureClass() {\n return Hammer.Swipe;\n }\n\n onGestureActivated(event: HammerInputExt) {\n this.sendEvent({\n ...event,\n eventType: Hammer.INPUT_MOVE,\n isFinal: false,\n isFirst: true,\n });\n this.isGestureRunning = false;\n this.hasGestureFailed = false;\n this.sendEvent({\n ...event,\n eventType: Hammer.INPUT_END,\n isFinal: true,\n });\n }\n\n onRawEvent(ev: HammerInputExt) {\n super.onRawEvent(ev);\n if (this.hasGestureFailed) {\n return;\n }\n // Hammer doesn't send a `cancel` event for taps.\n // Manually fail the event.\n if (ev.isFinal) {\n setTimeout(() => {\n if (this.isGestureRunning) {\n this.cancelEvent(ev);\n }\n });\n } else if (!this.hasGestureFailed && !this.isGestureRunning) {\n // Tap Gesture start event\n const gesture = this.hammer!.get(this.name);\n // @ts-ignore FIXME(TS)\n if (gesture.options.enable(gesture, ev)) {\n this.onStart(ev);\n this.sendEvent(ev);\n }\n }\n }\n\n getHammerConfig() {\n return {\n // @ts-ignore FIXME(TS)\n pointers: this.config.numberOfPointers,\n direction: this.getDirection(),\n };\n }\n\n getTargetDirections(direction: number) {\n const directions = [];\n if (direction & Direction.RIGHT) {\n directions.push(Hammer.DIRECTION_RIGHT);\n }\n if (direction & Direction.LEFT) {\n directions.push(Hammer.DIRECTION_LEFT);\n }\n if (direction & Direction.UP) {\n directions.push(Hammer.DIRECTION_UP);\n }\n if (direction & Direction.DOWN) {\n directions.push(Hammer.DIRECTION_DOWN);\n }\n // const hammerDirection = directions.reduce((a, b) => a | b, 0);\n return directions;\n }\n\n getDirection() {\n // @ts-ignore FIXME(TS)\n const { direction } = this.getConfig();\n\n let directions = [];\n if (direction & Direction.RIGHT) {\n directions.push(Hammer.DIRECTION_HORIZONTAL);\n }\n if (direction & Direction.LEFT) {\n directions.push(Hammer.DIRECTION_HORIZONTAL);\n }\n if (direction & Direction.UP) {\n directions.push(Hammer.DIRECTION_VERTICAL);\n }\n if (direction & Direction.DOWN) {\n directions.push(Hammer.DIRECTION_VERTICAL);\n }\n directions = [...new Set(directions)];\n\n if (directions.length === 0) return Hammer.DIRECTION_NONE;\n if (directions.length === 1) return directions[0];\n return Hammer.DIRECTION_ALL;\n }\n\n isGestureEnabledForEvent(\n { numberOfPointers }: any,\n _recognizer: any,\n { maxPointers: pointerLength }: any\n ) {\n const validPointerCount = pointerLength === numberOfPointers;\n if (!validPointerCount && this.isGestureRunning) {\n return { failed: true };\n }\n return { success: validPointerCount };\n }\n\n updateGestureConfig({ numberOfPointers = 1, direction, ...props }: any) {\n if (isnan(direction) || typeof direction !== 'number') {\n throw new GesturePropError('direction', direction, 'number');\n }\n return super.updateGestureConfig({\n numberOfPointers,\n direction,\n ...props,\n });\n }\n}\n\nexport default FlingGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/GestureHandler.js b/lib/commonjs/web/GestureHandler.js
new file mode 100644
index 0000000000..88cf5228cc
--- /dev/null
+++ b/lib/commonjs/web/GestureHandler.js
@@ -0,0 +1,533 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _hammerjs = _interopRequireDefault(require("@egjs/hammerjs"));
+
+var _reactNative = require("react-native");
+
+var _State = require("../State");
+
+var _constants = require("./constants");
+
+var NodeManager = _interopRequireWildcard(require("./NodeManager"));
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+let gestureInstances = 0;
+
+class GestureHandler {
+ get id() {
+ return `${this.name}${this.gestureInstance}`;
+ }
+
+ get isDiscrete() {
+ return false;
+ }
+
+ get shouldEnableGestureOnSetup() {
+ throw new Error('Must override GestureHandler.shouldEnableGestureOnSetup');
+ }
+
+ constructor() {
+ _defineProperty(this, "handlerTag", void 0);
+
+ _defineProperty(this, "isGestureRunning", false);
+
+ _defineProperty(this, "view", null);
+
+ _defineProperty(this, "hasCustomActivationCriteria", void 0);
+
+ _defineProperty(this, "hasGestureFailed", false);
+
+ _defineProperty(this, "hammer", null);
+
+ _defineProperty(this, "initialRotation", null);
+
+ _defineProperty(this, "__initialX", void 0);
+
+ _defineProperty(this, "__initialY", void 0);
+
+ _defineProperty(this, "config", {});
+
+ _defineProperty(this, "previousState", _State.State.UNDETERMINED);
+
+ _defineProperty(this, "pendingGestures", {});
+
+ _defineProperty(this, "oldState", _State.State.UNDETERMINED);
+
+ _defineProperty(this, "lastSentState", null);
+
+ _defineProperty(this, "gestureInstance", void 0);
+
+ _defineProperty(this, "_stillWaiting", void 0);
+
+ _defineProperty(this, "propsRef", void 0);
+
+ _defineProperty(this, "ref", void 0);
+
+ _defineProperty(this, "clearSelfAsPending", () => {
+ if (Array.isArray(this.config.waitFor)) {
+ for (const gesture of this.config.waitFor) {
+ gesture.removePendingGesture(this.id);
+ }
+ }
+ });
+
+ _defineProperty(this, "destroy", () => {
+ this.clearSelfAsPending();
+
+ if (this.hammer) {
+ this.hammer.stop(false);
+ this.hammer.destroy();
+ }
+
+ this.hammer = null;
+ });
+
+ _defineProperty(this, "isPointInView", ({
+ x,
+ y
+ }) => {
+ // @ts-ignore FIXME(TS)
+ const rect = this.view.getBoundingClientRect();
+ const pointerInside = x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
+ return pointerInside;
+ });
+
+ _defineProperty(this, "sendEvent", nativeEvent => {
+ const {
+ onGestureHandlerEvent,
+ onGestureHandlerStateChange
+ } = this.propsRef.current;
+ const event = this.transformEventData(nativeEvent);
+ invokeNullableMethod(onGestureHandlerEvent, event);
+
+ if (this.lastSentState !== event.nativeEvent.state) {
+ this.lastSentState = event.nativeEvent.state;
+ invokeNullableMethod(onGestureHandlerStateChange, event);
+ }
+ });
+
+ _defineProperty(this, "sync", () => {
+ const gesture = this.hammer.get(this.name);
+ if (!gesture) return;
+
+ const enable = (recognizer, inputData) => {
+ if (!this.config.enabled) {
+ this.isGestureRunning = false;
+ this.hasGestureFailed = false;
+ return false;
+ } // Prevent events before the system is ready.
+
+
+ if (!inputData || !recognizer.options || typeof inputData.maxPointers === 'undefined') {
+ return this.shouldEnableGestureOnSetup;
+ }
+
+ if (this.hasGestureFailed) {
+ return false;
+ }
+
+ if (!this.isDiscrete) {
+ if (this.isGestureRunning) {
+ return true;
+ } // The built-in hammer.js "waitFor" doesn't work across multiple views.
+ // Only process if there are views to wait for.
+
+
+ this._stillWaiting = this._getPendingGestures(); // This gesture should continue waiting.
+
+ if (this._stillWaiting.length) {
+ // Check to see if one of the gestures you're waiting for has started.
+ // If it has then the gesture should fail.
+ for (const gesture of this._stillWaiting) {
+ // When the target gesture has started, this gesture must force fail.
+ if (!gesture.isDiscrete && gesture.isGestureRunning) {
+ this.hasGestureFailed = true;
+ this.isGestureRunning = false;
+ return false;
+ }
+ } // This gesture shouldn't start until the others have finished.
+
+
+ return false;
+ }
+ } // Use default behaviour
+
+
+ if (!this.hasCustomActivationCriteria) {
+ return true;
+ }
+
+ const deltaRotation = this.initialRotation == null ? 0 : inputData.rotation - this.initialRotation; // @ts-ignore FIXME(TS)
+
+ const {
+ success,
+ failed
+ } = this.isGestureEnabledForEvent(this.getConfig(), recognizer, { ...inputData,
+ deltaRotation
+ });
+
+ if (failed) {
+ this.simulateCancelEvent(inputData);
+ this.hasGestureFailed = true;
+ }
+
+ return success;
+ };
+
+ const params = this.getHammerConfig(); // @ts-ignore FIXME(TS)
+
+ gesture.set({ ...params,
+ enable
+ });
+ });
+
+ this.gestureInstance = gestureInstances++;
+ this.hasCustomActivationCriteria = false;
+ }
+
+ getConfig() {
+ return this.config;
+ }
+
+ onWaitingEnded(_gesture) {}
+
+ removePendingGesture(id) {
+ delete this.pendingGestures[id];
+ }
+
+ addPendingGesture(gesture) {
+ this.pendingGestures[gesture.id] = gesture;
+ }
+
+ isGestureEnabledForEvent(_config, _recognizer, _event) {
+ return {
+ success: true
+ };
+ }
+
+ get NativeGestureClass() {
+ throw new Error('Must override GestureHandler.NativeGestureClass');
+ }
+
+ updateHasCustomActivationCriteria(_config) {
+ return true;
+ }
+
+ updateGestureConfig({
+ enabled = true,
+ ...props
+ }) {
+ this.clearSelfAsPending();
+ this.config = ensureConfig({
+ enabled,
+ ...props
+ });
+ this.hasCustomActivationCriteria = this.updateHasCustomActivationCriteria(this.config);
+
+ if (Array.isArray(this.config.waitFor)) {
+ for (const gesture of this.config.waitFor) {
+ gesture.addPendingGesture(this);
+ }
+ }
+
+ if (this.hammer) {
+ this.sync();
+ }
+
+ return this.config;
+ }
+
+ getState(type) {
+ // @ts-ignore TODO(TS) check if this is needed
+ if (type == 0) {
+ return 0;
+ }
+
+ return _constants.EventMap[type];
+ }
+
+ transformEventData(event) {
+ const {
+ eventType,
+ maxPointers: numberOfPointers
+ } = event; // const direction = DirectionMap[ev.direction];
+
+ const changedTouch = event.changedPointers[0];
+ const pointerInside = this.isPointInView({
+ x: changedTouch.clientX,
+ y: changedTouch.clientY
+ }); // TODO(TS) Remove cast after https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50966 is merged.
+
+ const state = this.getState(eventType);
+
+ if (state !== this.previousState) {
+ this.oldState = this.previousState;
+ this.previousState = state;
+ }
+
+ return {
+ nativeEvent: {
+ numberOfPointers,
+ state,
+ pointerInside,
+ ...this.transformNativeEvent(event),
+ // onHandlerStateChange only
+ handlerTag: this.handlerTag,
+ target: this.ref,
+ oldState: this.oldState
+ },
+ timeStamp: Date.now()
+ };
+ }
+
+ transformNativeEvent(_event) {
+ return {};
+ }
+
+ cancelPendingGestures(event) {
+ for (const gesture of Object.values(this.pendingGestures)) {
+ if (gesture && gesture.isGestureRunning) {
+ gesture.hasGestureFailed = true;
+ gesture.cancelEvent(event);
+ }
+ }
+ }
+
+ notifyPendingGestures() {
+ for (const gesture of Object.values(this.pendingGestures)) {
+ if (gesture) {
+ gesture.onWaitingEnded(this);
+ }
+ }
+ } // FIXME event is undefined in runtime when firstly invoked (see Draggable example), check other functions taking event as input
+
+
+ onGestureEnded(event) {
+ this.isGestureRunning = false;
+ this.cancelPendingGestures(event);
+ }
+
+ forceInvalidate(event) {
+ if (this.isGestureRunning) {
+ this.hasGestureFailed = true;
+ this.cancelEvent(event);
+ }
+ }
+
+ cancelEvent(event) {
+ this.notifyPendingGestures();
+ this.sendEvent({ ...event,
+ eventType: _hammerjs.default.INPUT_CANCEL,
+ isFinal: true
+ });
+ this.onGestureEnded(event);
+ }
+
+ onRawEvent({
+ isFirst
+ }) {
+ if (isFirst) {
+ this.hasGestureFailed = false;
+ }
+ }
+
+ setView(ref, propsRef) {
+ if (ref == null) {
+ this.destroy();
+ this.view = null;
+ return;
+ }
+
+ this.propsRef = propsRef;
+ this.ref = ref;
+ this.view = (0, _reactNative.findNodeHandle)(ref);
+ this.hammer = new _hammerjs.default.Manager(this.view);
+ this.oldState = _State.State.UNDETERMINED;
+ this.previousState = _State.State.UNDETERMINED;
+ this.lastSentState = null;
+ const {
+ NativeGestureClass
+ } = this; // @ts-ignore TODO(TS)
+
+ const gesture = new NativeGestureClass(this.getHammerConfig());
+ this.hammer.add(gesture);
+ this.hammer.on('hammer.input', ev => {
+ if (!this.config.enabled) {
+ this.hasGestureFailed = false;
+ this.isGestureRunning = false;
+ return;
+ }
+
+ this.onRawEvent(ev); // TODO: Bacon: Check against something other than null
+ // The isFirst value is not called when the first rotation is calculated.
+
+ if (this.initialRotation === null && ev.rotation !== 0) {
+ this.initialRotation = ev.rotation;
+ }
+
+ if (ev.isFinal) {
+ // in favor of a willFail otherwise the last frame of the gesture will be captured.
+ setTimeout(() => {
+ this.initialRotation = null;
+ this.hasGestureFailed = false;
+ });
+ }
+ });
+ this.setupEvents();
+ this.sync();
+ }
+
+ setupEvents() {
+ // TODO(TS) Hammer types aren't exactly that what we get in runtime
+ if (!this.isDiscrete) {
+ this.hammer.on(`${this.name}start`, event => this.onStart(event));
+ this.hammer.on(`${this.name}end ${this.name}cancel`, event => {
+ this.onGestureEnded(event);
+ });
+ }
+
+ this.hammer.on(this.name, ev => this.onGestureActivated(ev)); // TODO(TS) remove cast after https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50438 is merged
+ }
+
+ onStart({
+ deltaX,
+ deltaY,
+ rotation
+ }) {
+ // Reset the state for the next gesture
+ this.oldState = _State.State.UNDETERMINED;
+ this.previousState = _State.State.UNDETERMINED;
+ this.lastSentState = null;
+ this.isGestureRunning = true;
+ this.__initialX = deltaX;
+ this.__initialY = deltaY;
+ this.initialRotation = rotation;
+ }
+
+ onGestureActivated(ev) {
+ this.sendEvent(ev);
+ }
+
+ onSuccess() {}
+
+ _getPendingGestures() {
+ if (Array.isArray(this.config.waitFor) && this.config.waitFor.length) {
+ // Get the list of gestures that this gesture is still waiting for.
+ // Use `=== false` in case a ref that isn't a gesture handler is used.
+ const stillWaiting = this.config.waitFor.filter(({
+ hasGestureFailed
+ }) => hasGestureFailed === false);
+ return stillWaiting;
+ }
+
+ return [];
+ }
+
+ getHammerConfig() {
+ const pointers = this.config.minPointers === this.config.maxPointers ? this.config.minPointers : 0;
+ return {
+ pointers
+ };
+ }
+
+ simulateCancelEvent(_inputData) {}
+
+} // TODO(TS) investigate this method
+// Used for sending data to a callback or AnimatedEvent
+
+
+function invokeNullableMethod(method, event) {
+ if (method) {
+ if (typeof method === 'function') {
+ method(event);
+ } else {
+ // For use with reanimated's AnimatedEvent
+ if ('__getHandler' in method && typeof method.__getHandler === 'function') {
+ const handler = method.__getHandler();
+
+ invokeNullableMethod(handler, event);
+ } else {
+ if ('__nodeConfig' in method) {
+ const {
+ argMapping
+ } = method.__nodeConfig;
+
+ if (Array.isArray(argMapping)) {
+ for (const [index, [key, value]] of argMapping.entries()) {
+ if (key in event.nativeEvent) {
+ // @ts-ignore fix method type
+ const nativeValue = event.nativeEvent[key];
+
+ if (value && value.setValue) {
+ // Reanimated API
+ value.setValue(nativeValue);
+ } else {
+ // RN Animated API
+ method.__nodeConfig.argMapping[index] = [key, nativeValue];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+} // Validate the props
+
+
+function ensureConfig(config) {
+ const props = { ...config
+ }; // TODO(TS) We use ! to assert that if property is present then value is not empty (null, undefined)
+
+ if ('minDist' in config) {
+ props.minDist = config.minDist;
+ props.minDistSq = props.minDist * props.minDist;
+ }
+
+ if ('minVelocity' in config) {
+ props.minVelocity = config.minVelocity;
+ props.minVelocitySq = props.minVelocity * props.minVelocity;
+ }
+
+ if ('maxDist' in config) {
+ props.maxDist = config.maxDist;
+ props.maxDistSq = config.maxDist * config.maxDist;
+ }
+
+ if ('waitFor' in config) {
+ props.waitFor = asArray(config.waitFor).map(({
+ handlerTag
+ }) => NodeManager.getHandler(handlerTag)).filter(v => v);
+ } else {
+ props.waitFor = null;
+ }
+
+ const configProps = ['minPointers', 'maxPointers', 'minDist', 'maxDist', 'maxDistSq', 'minVelocitySq', 'minDistSq', 'minVelocity', 'failOffsetXStart', 'failOffsetYStart', 'failOffsetXEnd', 'failOffsetYEnd', 'activeOffsetXStart', 'activeOffsetXEnd', 'activeOffsetYStart', 'activeOffsetYEnd'];
+ configProps.forEach(prop => {
+ if (typeof props[prop] === 'undefined') {
+ props[prop] = Number.NaN;
+ }
+ });
+ return props; // TODO(TS) how to convince TS that props are filled?
+}
+
+function asArray(value) {
+ // TODO(TS) use config.waitFor type
+ return value == null ? [] : Array.isArray(value) ? value : [value];
+}
+
+var _default = GestureHandler;
+exports.default = _default;
+//# sourceMappingURL=GestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/GestureHandler.js.map b/lib/commonjs/web/GestureHandler.js.map
new file mode 100644
index 0000000000..07c80e18dc
--- /dev/null
+++ b/lib/commonjs/web/GestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["GestureHandler.ts"],"names":["gestureInstances","GestureHandler","id","name","gestureInstance","isDiscrete","shouldEnableGestureOnSetup","Error","constructor","State","UNDETERMINED","Array","isArray","config","waitFor","gesture","removePendingGesture","clearSelfAsPending","hammer","stop","destroy","x","y","rect","view","getBoundingClientRect","pointerInside","left","right","top","bottom","nativeEvent","onGestureHandlerEvent","onGestureHandlerStateChange","propsRef","current","event","transformEventData","invokeNullableMethod","lastSentState","state","get","enable","recognizer","inputData","enabled","isGestureRunning","hasGestureFailed","options","maxPointers","_stillWaiting","_getPendingGestures","length","hasCustomActivationCriteria","deltaRotation","initialRotation","rotation","success","failed","isGestureEnabledForEvent","getConfig","simulateCancelEvent","params","getHammerConfig","set","onWaitingEnded","_gesture","pendingGestures","addPendingGesture","_config","_recognizer","_event","NativeGestureClass","updateHasCustomActivationCriteria","updateGestureConfig","props","ensureConfig","sync","getState","type","EventMap","eventType","numberOfPointers","changedTouch","changedPointers","isPointInView","clientX","clientY","previousState","oldState","transformNativeEvent","handlerTag","target","ref","timeStamp","Date","now","cancelPendingGestures","Object","values","cancelEvent","notifyPendingGestures","onGestureEnded","forceInvalidate","sendEvent","Hammer","INPUT_CANCEL","isFinal","onRawEvent","isFirst","setView","Manager","add","on","ev","setTimeout","setupEvents","onStart","onGestureActivated","deltaX","deltaY","__initialX","__initialY","onSuccess","stillWaiting","filter","pointers","minPointers","_inputData","method","__getHandler","handler","argMapping","__nodeConfig","index","key","value","entries","nativeValue","setValue","minDist","minDistSq","minVelocity","minVelocitySq","maxDist","maxDistSq","asArray","map","NodeManager","getHandler","v","configProps","forEach","prop","Number","NaN"],"mappings":";;;;;;;AAEA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AA4BA,IAAIA,gBAAgB,GAAG,CAAvB;;AAEA,MAAeC,cAAf,CAA8B;AAsBtB,MAAFC,EAAE,GAAG;AACP,WAAQ,GAAE,KAAKC,IAAK,GAAE,KAAKC,eAAgB,EAA3C;AACD;;AAEa,MAAVC,UAAU,GAAG;AACf,WAAO,KAAP;AACD;;AAE6B,MAA1BC,0BAA0B,GAAY;AACxC,UAAM,IAAIC,KAAJ,CAAU,yDAAV,CAAN;AACD;;AAEDC,EAAAA,WAAW,GAAG;AAAA;;AAAA,8CAhCY,KAgCZ;;AAAA,kCA/Be,IA+Bf;;AAAA;;AAAA,8CA7Be,KA6Bf;;AAAA,oCA5B2B,IA4B3B;;AAAA,6CA3B6B,IA2B7B;;AAAA;;AAAA;;AAAA,oCAxBa,EAwBb;;AAAA,2CAvBmBC,aAAMC,YAuBzB;;AAAA,6CAtBkC,EAsBlC;;AAAA,sCArBYD,aAAMC,YAqBlB;;AAAA,2CApBwB,IAoBxB;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,gDAmCO,MAAM;AACzB,UAAIC,KAAK,CAACC,OAAN,CAAc,KAAKC,MAAL,CAAYC,OAA1B,CAAJ,EAAwC;AACtC,aAAK,MAAMC,OAAX,IAAsB,KAAKF,MAAL,CAAYC,OAAlC,EAA2C;AACzCC,UAAAA,OAAO,CAACC,oBAAR,CAA6B,KAAKd,EAAlC;AACD;AACF;AACF,KAzCa;;AAAA,qCA8DJ,MAAM;AACd,WAAKe,kBAAL;;AAEA,UAAI,KAAKC,MAAT,EAAiB;AACf,aAAKA,MAAL,CAA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AAC;AAAExD,MAAAA;AAAF,KAAD,KACHyD,WAAW,CAACC,UAAZ,CAAuB1D,UAAvB,CAFY,EAIbkC,MAJa,CAILyB,CAAD,IAAOA,CAJD,CAAhB;AAKD,GAND,MAMO;AACL3E,IAAAA,KAAK,CAAC7D,OAAN,GAAgB,IAAhB;AACD;;AAED,QAAMyI,WAAW,GAAG,CAClB,aADkB,EAElB,aAFkB,EAGlB,SAHkB,EAIlB,SAJkB,EAKlB,WALkB,EAMlB,eANkB,EAOlB,WAPkB,EAQlB,aARkB,EASlB,kBATkB,EAUlB,kBAVkB,EAWlB,gBAXkB,EAYlB,gBAZkB,EAalB,oBAbkB,EAclB,kBAdkB,EAelB,oBAfkB,EAgBlB,kBAhBkB,CAApB;AAkBAA,EAAAA,WAAW,CAACC,OAAZ,CAAqBC,IAAD,IAAsC;AACxD,QAAI,OAAO9E,KAAK,CAAC8E,IAAD,CAAZ,KAAuB,WAA3B,EAAwC;AACtC9E,MAAAA,KAAK,CAAC8E,IAAD,CAAL,GAAcC,MAAM,CAACC,GAArB;AACD;AACF,GAJD;AAKA,SAAOhF,KAAP,CAjDsD,CAiDpB;AACnC;;AAED,SAASuE,OAAT,CAAoBV,KAApB,EAAoC;AAClC;AACA,SAAOA,KAAK,IAAI,IAAT,GAAgB,EAAhB,GAAqB7H,KAAK,CAACC,OAAN,CAAc4H,KAAd,IAAuBA,KAAvB,GAA+B,CAACA,KAAD,CAA3D;AACD;;eAEcvI,c","sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport Hammer from '@egjs/hammerjs';\nimport { findNodeHandle } from 'react-native';\n\nimport { State } from '../State';\nimport { EventMap } from './constants';\nimport * as NodeManager from './NodeManager';\n\n// TODO(TS) Replace with HammerInput if https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50438/files is merged\nexport type HammerInputExt = Omit;\n\nexport type Config = Partial<{\n enabled: boolean;\n minPointers: number;\n maxPointers: number;\n minDist: number;\n minDistSq: number;\n minVelocity: number;\n minVelocitySq: number;\n maxDist: number;\n maxDistSq: number;\n failOffsetXStart: number;\n failOffsetYStart: number;\n failOffsetXEnd: number;\n failOffsetYEnd: number;\n activeOffsetXStart: number;\n activeOffsetXEnd: number;\n activeOffsetYStart: number;\n activeOffsetYEnd: number;\n waitFor: any[] | null;\n}>;\n\ntype NativeEvent = ReturnType;\n\nlet gestureInstances = 0;\n\nabstract class GestureHandler {\n public handlerTag: any;\n public isGestureRunning = false;\n public view: number | null = null;\n protected hasCustomActivationCriteria: boolean;\n protected hasGestureFailed = false;\n protected hammer: HammerManager | null = null;\n protected initialRotation: number | null = null;\n protected __initialX: any;\n protected __initialY: any;\n protected config: Config = {};\n protected previousState: State = State.UNDETERMINED;\n private pendingGestures: Record = {};\n private oldState: State = State.UNDETERMINED;\n private lastSentState: State | null = null;\n private gestureInstance: number;\n private _stillWaiting: any;\n private propsRef: any;\n private ref: any;\n\n abstract get name(): string;\n\n get id() {\n return `${this.name}${this.gestureInstance}`;\n }\n\n get isDiscrete() {\n return false;\n }\n\n get shouldEnableGestureOnSetup(): boolean {\n throw new Error('Must override GestureHandler.shouldEnableGestureOnSetup');\n }\n\n constructor() {\n this.gestureInstance = gestureInstances++;\n this.hasCustomActivationCriteria = false;\n }\n\n getConfig() {\n return this.config;\n }\n\n onWaitingEnded(_gesture: this) {}\n\n removePendingGesture(id: string) {\n delete this.pendingGestures[id];\n }\n\n addPendingGesture(gesture: this) {\n this.pendingGestures[gesture.id] = gesture;\n }\n\n isGestureEnabledForEvent(\n _config: any,\n _recognizer: any,\n _event: any\n ): { failed?: boolean; success?: boolean } {\n return { success: true };\n }\n\n get NativeGestureClass(): RecognizerStatic {\n throw new Error('Must override GestureHandler.NativeGestureClass');\n }\n\n updateHasCustomActivationCriteria(_config: Config) {\n return true;\n }\n\n clearSelfAsPending = () => {\n if (Array.isArray(this.config.waitFor)) {\n for (const gesture of this.config.waitFor) {\n gesture.removePendingGesture(this.id);\n }\n }\n };\n\n updateGestureConfig({ enabled = true, ...props }) {\n this.clearSelfAsPending();\n\n this.config = ensureConfig({ enabled, ...props });\n this.hasCustomActivationCriteria = this.updateHasCustomActivationCriteria(\n this.config\n );\n if (Array.isArray(this.config.waitFor)) {\n for (const gesture of this.config.waitFor) {\n gesture.addPendingGesture(this);\n }\n }\n\n if (this.hammer) {\n this.sync();\n }\n return this.config;\n }\n\n destroy = () => {\n this.clearSelfAsPending();\n\n if (this.hammer) {\n this.hammer.stop(false);\n this.hammer.destroy();\n }\n this.hammer = null;\n };\n\n isPointInView = ({ x, y }: { x: number; y: number }) => {\n // @ts-ignore FIXME(TS)\n const rect = this.view!.getBoundingClientRect();\n const pointerInside =\n x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;\n return pointerInside;\n };\n\n getState(type: keyof typeof EventMap): State {\n // @ts-ignore TODO(TS) check if this is needed\n if (type == 0) {\n return 0;\n }\n return EventMap[type];\n }\n\n transformEventData(event: HammerInputExt) {\n const { eventType, maxPointers: numberOfPointers } = event;\n // const direction = DirectionMap[ev.direction];\n const changedTouch = event.changedPointers[0];\n const pointerInside = this.isPointInView({\n x: changedTouch.clientX,\n y: changedTouch.clientY,\n });\n\n // TODO(TS) Remove cast after https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50966 is merged.\n const state = this.getState(eventType as 1 | 2 | 4 | 8);\n if (state !== this.previousState) {\n this.oldState = this.previousState;\n this.previousState = state;\n }\n\n return {\n nativeEvent: {\n numberOfPointers,\n state,\n pointerInside,\n ...this.transformNativeEvent(event),\n // onHandlerStateChange only\n handlerTag: this.handlerTag,\n target: this.ref,\n oldState: this.oldState,\n },\n timeStamp: Date.now(),\n };\n }\n\n transformNativeEvent(_event: HammerInputExt) {\n return {};\n }\n\n sendEvent = (nativeEvent: HammerInputExt) => {\n const {\n onGestureHandlerEvent,\n onGestureHandlerStateChange,\n } = this.propsRef.current;\n\n const event = this.transformEventData(nativeEvent);\n\n invokeNullableMethod(onGestureHandlerEvent, event);\n if (this.lastSentState !== event.nativeEvent.state) {\n this.lastSentState = event.nativeEvent.state as State;\n invokeNullableMethod(onGestureHandlerStateChange, event);\n }\n };\n\n cancelPendingGestures(event: HammerInputExt) {\n for (const gesture of Object.values(this.pendingGestures)) {\n if (gesture && gesture.isGestureRunning) {\n gesture.hasGestureFailed = true;\n gesture.cancelEvent(event);\n }\n }\n }\n\n notifyPendingGestures() {\n for (const gesture of Object.values(this.pendingGestures)) {\n if (gesture) {\n gesture.onWaitingEnded(this);\n }\n }\n }\n\n // FIXME event is undefined in runtime when firstly invoked (see Draggable example), check other functions taking event as input\n onGestureEnded(event: HammerInputExt) {\n this.isGestureRunning = false;\n this.cancelPendingGestures(event);\n }\n\n forceInvalidate(event: HammerInputExt) {\n if (this.isGestureRunning) {\n this.hasGestureFailed = true;\n this.cancelEvent(event);\n }\n }\n\n cancelEvent(event: HammerInputExt) {\n this.notifyPendingGestures();\n this.sendEvent({\n ...event,\n eventType: Hammer.INPUT_CANCEL,\n isFinal: true,\n });\n this.onGestureEnded(event);\n }\n\n onRawEvent({ isFirst }: HammerInputExt) {\n if (isFirst) {\n this.hasGestureFailed = false;\n }\n }\n\n setView(ref: Parameters['0'], propsRef: any) {\n if (ref == null) {\n this.destroy();\n this.view = null;\n return;\n }\n\n this.propsRef = propsRef;\n this.ref = ref;\n\n this.view = findNodeHandle(ref);\n this.hammer = new Hammer.Manager(this.view as any);\n\n this.oldState = State.UNDETERMINED;\n this.previousState = State.UNDETERMINED;\n this.lastSentState = null;\n\n const { NativeGestureClass } = this;\n // @ts-ignore TODO(TS)\n const gesture = new NativeGestureClass(this.getHammerConfig());\n this.hammer.add(gesture);\n\n this.hammer.on('hammer.input', (ev: HammerInput) => {\n if (!this.config.enabled) {\n this.hasGestureFailed = false;\n this.isGestureRunning = false;\n return;\n }\n\n this.onRawEvent((ev as unknown) as HammerInputExt);\n\n // TODO: Bacon: Check against something other than null\n // The isFirst value is not called when the first rotation is calculated.\n if (this.initialRotation === null && ev.rotation !== 0) {\n this.initialRotation = ev.rotation;\n }\n if (ev.isFinal) {\n // in favor of a willFail otherwise the last frame of the gesture will be captured.\n setTimeout(() => {\n this.initialRotation = null;\n this.hasGestureFailed = false;\n });\n }\n });\n\n this.setupEvents();\n this.sync();\n }\n\n setupEvents() {\n // TODO(TS) Hammer types aren't exactly that what we get in runtime\n if (!this.isDiscrete) {\n this.hammer!.on(`${this.name}start`, (event: HammerInput) =>\n this.onStart((event as unknown) as HammerInputExt)\n );\n this.hammer!.on(\n `${this.name}end ${this.name}cancel`,\n (event: HammerInput) => {\n this.onGestureEnded((event as unknown) as HammerInputExt);\n }\n );\n }\n this.hammer!.on(this.name, (ev: HammerInput) =>\n this.onGestureActivated((ev as unknown) as HammerInputExt)\n ); // TODO(TS) remove cast after https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50438 is merged\n }\n\n onStart({ deltaX, deltaY, rotation }: HammerInputExt) {\n // Reset the state for the next gesture\n this.oldState = State.UNDETERMINED;\n this.previousState = State.UNDETERMINED;\n this.lastSentState = null;\n\n this.isGestureRunning = true;\n this.__initialX = deltaX;\n this.__initialY = deltaY;\n this.initialRotation = rotation;\n }\n\n onGestureActivated(ev: HammerInputExt) {\n this.sendEvent(ev);\n }\n\n onSuccess() {}\n\n _getPendingGestures() {\n if (Array.isArray(this.config.waitFor) && this.config.waitFor.length) {\n // Get the list of gestures that this gesture is still waiting for.\n // Use `=== false` in case a ref that isn't a gesture handler is used.\n const stillWaiting = this.config.waitFor.filter(\n ({ hasGestureFailed }) => hasGestureFailed === false\n );\n return stillWaiting;\n }\n return [];\n }\n\n getHammerConfig() {\n const pointers =\n this.config.minPointers === this.config.maxPointers\n ? this.config.minPointers\n : 0;\n return {\n pointers,\n };\n }\n\n sync = () => {\n const gesture = this.hammer!.get(this.name);\n if (!gesture) return;\n\n const enable = (recognizer: any, inputData: any) => {\n if (!this.config.enabled) {\n this.isGestureRunning = false;\n this.hasGestureFailed = false;\n return false;\n }\n\n // Prevent events before the system is ready.\n if (\n !inputData ||\n !recognizer.options ||\n typeof inputData.maxPointers === 'undefined'\n ) {\n return this.shouldEnableGestureOnSetup;\n }\n\n if (this.hasGestureFailed) {\n return false;\n }\n\n if (!this.isDiscrete) {\n if (this.isGestureRunning) {\n return true;\n }\n // The built-in hammer.js \"waitFor\" doesn't work across multiple views.\n // Only process if there are views to wait for.\n this._stillWaiting = this._getPendingGestures();\n // This gesture should continue waiting.\n if (this._stillWaiting.length) {\n // Check to see if one of the gestures you're waiting for has started.\n // If it has then the gesture should fail.\n for (const gesture of this._stillWaiting) {\n // When the target gesture has started, this gesture must force fail.\n if (!gesture.isDiscrete && gesture.isGestureRunning) {\n this.hasGestureFailed = true;\n this.isGestureRunning = false;\n return false;\n }\n }\n // This gesture shouldn't start until the others have finished.\n return false;\n }\n }\n\n // Use default behaviour\n if (!this.hasCustomActivationCriteria) {\n return true;\n }\n\n const deltaRotation =\n this.initialRotation == null\n ? 0\n : inputData.rotation - this.initialRotation;\n // @ts-ignore FIXME(TS)\n const { success, failed } = this.isGestureEnabledForEvent(\n this.getConfig(),\n recognizer,\n {\n ...inputData,\n deltaRotation,\n }\n );\n\n if (failed) {\n this.simulateCancelEvent(inputData);\n this.hasGestureFailed = true;\n }\n return success;\n };\n\n const params = this.getHammerConfig();\n // @ts-ignore FIXME(TS)\n gesture.set({ ...params, enable });\n };\n\n simulateCancelEvent(_inputData: any) {}\n}\n\n// TODO(TS) investigate this method\n// Used for sending data to a callback or AnimatedEvent\nfunction invokeNullableMethod(\n method:\n | ((event: NativeEvent) => void)\n | { __getHandler: () => (event: NativeEvent) => void }\n | { __nodeConfig: { argMapping: any } },\n event: NativeEvent\n) {\n if (method) {\n if (typeof method === 'function') {\n method(event);\n } else {\n // For use with reanimated's AnimatedEvent\n if (\n '__getHandler' in method &&\n typeof method.__getHandler === 'function'\n ) {\n const handler = method.__getHandler();\n invokeNullableMethod(handler, event);\n } else {\n if ('__nodeConfig' in method) {\n const { argMapping } = method.__nodeConfig;\n if (Array.isArray(argMapping)) {\n for (const [index, [key, value]] of argMapping.entries()) {\n if (key in event.nativeEvent) {\n // @ts-ignore fix method type\n const nativeValue = event.nativeEvent[key];\n if (value && value.setValue) {\n // Reanimated API\n value.setValue(nativeValue);\n } else {\n // RN Animated API\n method.__nodeConfig.argMapping[index] = [key, nativeValue];\n }\n }\n }\n }\n }\n }\n }\n }\n}\n\n// Validate the props\nfunction ensureConfig(config: Config): Required {\n const props = { ...config };\n\n // TODO(TS) We use ! to assert that if property is present then value is not empty (null, undefined)\n if ('minDist' in config) {\n props.minDist = config.minDist;\n props.minDistSq = props.minDist! * props.minDist!;\n }\n if ('minVelocity' in config) {\n props.minVelocity = config.minVelocity;\n props.minVelocitySq = props.minVelocity! * props.minVelocity!;\n }\n if ('maxDist' in config) {\n props.maxDist = config.maxDist;\n props.maxDistSq = config.maxDist! * config.maxDist!;\n }\n if ('waitFor' in config) {\n props.waitFor = asArray(config.waitFor)\n .map(({ handlerTag }: { handlerTag: number }) =>\n NodeManager.getHandler(handlerTag)\n )\n .filter((v) => v);\n } else {\n props.waitFor = null;\n }\n\n const configProps = [\n 'minPointers',\n 'maxPointers',\n 'minDist',\n 'maxDist',\n 'maxDistSq',\n 'minVelocitySq',\n 'minDistSq',\n 'minVelocity',\n 'failOffsetXStart',\n 'failOffsetYStart',\n 'failOffsetXEnd',\n 'failOffsetYEnd',\n 'activeOffsetXStart',\n 'activeOffsetXEnd',\n 'activeOffsetYStart',\n 'activeOffsetYEnd',\n ] as const;\n configProps.forEach((prop: typeof configProps[number]) => {\n if (typeof props[prop] === 'undefined') {\n props[prop] = Number.NaN;\n }\n });\n return props as Required; // TODO(TS) how to convince TS that props are filled?\n}\n\nfunction asArray(value: T | T[]) {\n // TODO(TS) use config.waitFor type\n return value == null ? [] : Array.isArray(value) ? value : [value];\n}\n\nexport default GestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/IndiscreteGestureHandler.js b/lib/commonjs/web/IndiscreteGestureHandler.js
new file mode 100644
index 0000000000..af2ea46cd0
--- /dev/null
+++ b/lib/commonjs/web/IndiscreteGestureHandler.js
@@ -0,0 +1,54 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _GestureHandler = _interopRequireDefault(require("./GestureHandler"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * The base class for **Rotation** and **Pinch** gesture handlers.
+ */
+class IndiscreteGestureHandler extends _GestureHandler.default {
+ get shouldEnableGestureOnSetup() {
+ return false;
+ }
+
+ updateGestureConfig({
+ minPointers = 2,
+ maxPointers = 2,
+ ...props
+ }) {
+ return super.updateGestureConfig({
+ minPointers,
+ maxPointers,
+ ...props
+ });
+ }
+
+ isGestureEnabledForEvent({
+ minPointers,
+ maxPointers
+ }, _recognizer, {
+ maxPointers: pointerLength
+ }) {
+ if (pointerLength > maxPointers) {
+ return {
+ failed: true
+ };
+ }
+
+ const validPointerCount = pointerLength >= minPointers;
+ return {
+ success: validPointerCount
+ };
+ }
+
+}
+
+var _default = IndiscreteGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=IndiscreteGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/IndiscreteGestureHandler.js.map b/lib/commonjs/web/IndiscreteGestureHandler.js.map
new file mode 100644
index 0000000000..e2d9306c95
--- /dev/null
+++ b/lib/commonjs/web/IndiscreteGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["IndiscreteGestureHandler.ts"],"names":["IndiscreteGestureHandler","GestureHandler","shouldEnableGestureOnSetup","updateGestureConfig","minPointers","maxPointers","props","isGestureEnabledForEvent","_recognizer","pointerLength","failed","validPointerCount","success"],"mappings":";;;;;;;AAAA;;;;AAEA;AACA;AACA;AACA,MAAeA,wBAAf,SAAgDC,uBAAhD,CAA+D;AAC/B,MAA1BC,0BAA0B,GAAG;AAC/B,WAAO,KAAP;AACD;;AAEDC,EAAAA,mBAAmB,CAAC;AAAEC,IAAAA,WAAW,GAAG,CAAhB;AAAmBC,IAAAA,WAAW,GAAG,CAAjC;AAAoC,OAAGC;AAAvC,GAAD,EAAiD;AAClE,WAAO,MAAMH,mBAAN,CAA0B;AAC/BC,MAAAA,WAD+B;AAE/BC,MAAAA,WAF+B;AAG/B,SAAGC;AAH4B,KAA1B,CAAP;AAKD;;AAEDC,EAAAA,wBAAwB,CACtB;AAAEH,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GADsB,EAEtBG,WAFsB,EAGtB;AAAEH,IAAAA,WAAW,EAAEI;AAAf,GAHsB,EAItB;AACA,QAAIA,aAAa,GAAGJ,WAApB,EAAiC;AAC/B,aAAO;AAAEK,QAAAA,MAAM,EAAE;AAAV,OAAP;AACD;;AACD,UAAMC,iBAAiB,GAAGF,aAAa,IAAIL,WAA3C;AACA,WAAO;AACLQ,MAAAA,OAAO,EAAED;AADJ,KAAP;AAGD;;AAzB4D;;eA2BhDX,wB","sourcesContent":["import GestureHandler from './GestureHandler';\n\n/**\n * The base class for **Rotation** and **Pinch** gesture handlers.\n */\nabstract class IndiscreteGestureHandler extends GestureHandler {\n get shouldEnableGestureOnSetup() {\n return false;\n }\n\n updateGestureConfig({ minPointers = 2, maxPointers = 2, ...props }) {\n return super.updateGestureConfig({\n minPointers,\n maxPointers,\n ...props,\n });\n }\n\n isGestureEnabledForEvent(\n { minPointers, maxPointers }: any,\n _recognizer: any,\n { maxPointers: pointerLength }: any\n ) {\n if (pointerLength > maxPointers) {\n return { failed: true };\n }\n const validPointerCount = pointerLength >= minPointers;\n return {\n success: validPointerCount,\n };\n }\n}\nexport default IndiscreteGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/LongPressGestureHandler.js b/lib/commonjs/web/LongPressGestureHandler.js
new file mode 100644
index 0000000000..4b4db63b41
--- /dev/null
+++ b/lib/commonjs/web/LongPressGestureHandler.js
@@ -0,0 +1,71 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _hammerjs = _interopRequireDefault(require("@egjs/hammerjs"));
+
+var _State = require("../State");
+
+var _PressGestureHandler = _interopRequireDefault(require("./PressGestureHandler"));
+
+var _utils = require("./utils");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/* eslint-disable eslint-comments/no-unlimited-disable */
+
+/* eslint-disable */
+class LongPressGestureHandler extends _PressGestureHandler.default {
+ get minDurationMs() {
+ // @ts-ignore FIXNE(TS)
+ return (0, _utils.isnan)(this.config.minDurationMs) ? 251 : this.config.minDurationMs;
+ }
+
+ get maxDist() {
+ // @ts-ignore FIXNE(TS)
+ return (0, _utils.isnan)(this.config.maxDist) ? 9 : this.config.maxDist;
+ }
+
+ updateHasCustomActivationCriteria({
+ maxDistSq
+ }) {
+ return !(0, _utils.isValidNumber)(maxDistSq);
+ }
+
+ getConfig() {
+ if (!this.hasCustomActivationCriteria) {
+ // Default config
+ // If no params have been defined then this config should emulate the native gesture as closely as possible.
+ return {
+ shouldCancelWhenOutside: true,
+ maxDistSq: 10
+ };
+ }
+
+ return this.config;
+ }
+
+ getHammerConfig() {
+ return { ...super.getHammerConfig(),
+ // threshold: this.maxDist,
+ time: this.minDurationMs
+ };
+ }
+
+ getState(type) {
+ return {
+ [_hammerjs.default.INPUT_START]: _State.State.ACTIVE,
+ [_hammerjs.default.INPUT_MOVE]: _State.State.ACTIVE,
+ [_hammerjs.default.INPUT_END]: _State.State.END,
+ [_hammerjs.default.INPUT_CANCEL]: _State.State.FAILED
+ }[type];
+ }
+
+}
+
+var _default = LongPressGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=LongPressGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/LongPressGestureHandler.js.map b/lib/commonjs/web/LongPressGestureHandler.js.map
new file mode 100644
index 0000000000..193998a796
--- /dev/null
+++ b/lib/commonjs/web/LongPressGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["LongPressGestureHandler.ts"],"names":["LongPressGestureHandler","PressGestureHandler","minDurationMs","config","maxDist","updateHasCustomActivationCriteria","maxDistSq","getConfig","hasCustomActivationCriteria","shouldCancelWhenOutside","getHammerConfig","time","getState","type","Hammer","INPUT_START","State","ACTIVE","INPUT_MOVE","INPUT_END","END","INPUT_CANCEL","FAILED"],"mappings":";;;;;;;AAEA;;AAEA;;AACA;;AACA;;;;AANA;;AACA;AASA,MAAMA,uBAAN,SAAsCC,4BAAtC,CAA0D;AACvC,MAAbC,aAAa,GAAW;AAC1B;AACA,WAAO,kBAAM,KAAKC,MAAL,CAAYD,aAAlB,IAAmC,GAAnC,GAAyC,KAAKC,MAAL,CAAYD,aAA5D;AACD;;AAEU,MAAPE,OAAO,GAAG;AACZ;AACA,WAAO,kBAAM,KAAKD,MAAL,CAAYC,OAAlB,IAA6B,CAA7B,GAAiC,KAAKD,MAAL,CAAYC,OAApD;AACD;;AAEDC,EAAAA,iCAAiC,CAAC;AAAEC,IAAAA;AAAF,GAAD,EAAwB;AACvD,WAAO,CAAC,0BAAcA,SAAd,CAAR;AACD;;AAEDC,EAAAA,SAAS,GAAG;AACV,QAAI,CAAC,KAAKC,2BAAV,EAAuC;AACrC;AACA;AACA,aAAO;AACLC,QAAAA,uBAAuB,EAAE,IADpB;AAELH,QAAAA,SAAS,EAAE;AAFN,OAAP;AAID;;AACD,WAAO,KAAKH,MAAZ;AACD;;AAEDO,EAAAA,eAAe,GAAG;AAChB,WAAO,EACL,GAAG,MAAMA,eAAN,EADE;AAEL;AACAC,MAAAA,IAAI,EAAE,KAAKT;AAHN,KAAP;AAKD;;AAEDU,EAAAA,QAAQ,CAACC,IAAD,EAAsC;AAC5C,WAAO;AACL,OAACC,kBAAOC,WAAR,GAAsBC,aAAMC,MADvB;AAEL,OAACH,kBAAOI,UAAR,GAAqBF,aAAMC,MAFtB;AAGL,OAACH,kBAAOK,SAAR,GAAoBH,aAAMI,GAHrB;AAIL,OAACN,kBAAOO,YAAR,GAAuBL,aAAMM;AAJxB,MAKLT,IALK,CAAP;AAMD;;AA1CuD;;eA6C3Cb,uB","sourcesContent":["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\nimport Hammer from '@egjs/hammerjs';\n\nimport { State } from '../State';\nimport PressGestureHandler from './PressGestureHandler';\nimport { isnan, isValidNumber } from './utils';\nimport { Config } from './GestureHandler';\nimport { HammerInputNames } from './constants';\n\nclass LongPressGestureHandler extends PressGestureHandler {\n get minDurationMs(): number {\n // @ts-ignore FIXNE(TS)\n return isnan(this.config.minDurationMs) ? 251 : this.config.minDurationMs;\n }\n\n get maxDist() {\n // @ts-ignore FIXNE(TS)\n return isnan(this.config.maxDist) ? 9 : this.config.maxDist;\n }\n\n updateHasCustomActivationCriteria({ maxDistSq }: Config) {\n return !isValidNumber(maxDistSq);\n }\n\n getConfig() {\n if (!this.hasCustomActivationCriteria) {\n // Default config\n // If no params have been defined then this config should emulate the native gesture as closely as possible.\n return {\n shouldCancelWhenOutside: true,\n maxDistSq: 10,\n };\n }\n return this.config;\n }\n\n getHammerConfig() {\n return {\n ...super.getHammerConfig(),\n // threshold: this.maxDist,\n time: this.minDurationMs,\n };\n }\n\n getState(type: keyof typeof HammerInputNames) {\n return {\n [Hammer.INPUT_START]: State.ACTIVE,\n [Hammer.INPUT_MOVE]: State.ACTIVE,\n [Hammer.INPUT_END]: State.END,\n [Hammer.INPUT_CANCEL]: State.FAILED,\n }[type];\n }\n}\n\nexport default LongPressGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/NativeViewGestureHandler.js b/lib/commonjs/web/NativeViewGestureHandler.js
new file mode 100644
index 0000000000..0bc023bfce
--- /dev/null
+++ b/lib/commonjs/web/NativeViewGestureHandler.js
@@ -0,0 +1,62 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _DiscreteGestureHandler = _interopRequireDefault(require("./DiscreteGestureHandler"));
+
+var NodeManager = _interopRequireWildcard(require("./NodeManager"));
+
+var _PressGestureHandler = _interopRequireDefault(require("./PressGestureHandler"));
+
+var _utils = require("./utils");
+
+function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
+
+function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+class NativeViewGestureHandler extends _PressGestureHandler.default {
+ onRawEvent(ev) {
+ super.onRawEvent(ev);
+
+ if (!ev.isFinal) {
+ // if (this.ref instanceof ScrollView) {
+ if ((0, _utils.TEST_MIN_IF_NOT_NAN)((0, _utils.VEC_LEN_SQ)({
+ x: ev.deltaX,
+ y: ev.deltaY
+ }), 10)) {
+ // @ts-ignore FIXME(TS) config type
+ if (this.config.disallowInterruption) {
+ const gestures = Object.values(NodeManager.getNodes()).filter(gesture => {
+ const {
+ handlerTag,
+ view,
+ isGestureRunning
+ } = gesture;
+ return (// Check if this gesture isn't self
+ handlerTag !== this.handlerTag && // Ensure the gesture needs to be cancelled
+ isGestureRunning && // ScrollView can cancel discrete gestures like taps and presses
+ gesture instanceof _DiscreteGestureHandler.default && // Ensure a view exists and is a child of the current view
+ view && // @ts-ignore FIXME(TS) view type
+ this.view.contains(view)
+ );
+ }); // Cancel all of the gestures that passed the filter
+
+ for (const gesture of gestures) {
+ // TODO: Bacon: Send some cached event.
+ gesture.forceInvalidate(ev);
+ }
+ }
+ }
+ }
+ }
+
+}
+
+var _default = NativeViewGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=NativeViewGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/NativeViewGestureHandler.js.map b/lib/commonjs/web/NativeViewGestureHandler.js.map
new file mode 100644
index 0000000000..7d3db538b0
--- /dev/null
+++ b/lib/commonjs/web/NativeViewGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["NativeViewGestureHandler.ts"],"names":["NativeViewGestureHandler","PressGestureHandler","onRawEvent","ev","isFinal","x","deltaX","y","deltaY","config","disallowInterruption","gestures","Object","values","NodeManager","getNodes","filter","gesture","handlerTag","view","isGestureRunning","DiscreteGestureHandler","contains","forceInvalidate"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,wBAAN,SAAuCC,4BAAvC,CAA2D;AACzDC,EAAAA,UAAU,CAACC,EAAD,EAAqB;AAC7B,UAAMD,UAAN,CAAiBC,EAAjB;;AACA,QAAI,CAACA,EAAE,CAACC,OAAR,EAAiB;AACf;AACA,UAAI,gCAAoB,uBAAW;AAAEC,QAAAA,CAAC,EAAEF,EAAE,CAACG,MAAR;AAAgBC,QAAAA,CAAC,EAAEJ,EAAE,CAACK;AAAtB,OAAX,CAApB,EAAgE,EAAhE,CAAJ,EAAyE;AACvE;AACA,YAAI,KAAKC,MAAL,CAAYC,oBAAhB,EAAsC;AACpC,gBAAMC,QAAQ,GAAGC,MAAM,CAACC,MAAP,CAAcC,WAAW,CAACC,QAAZ,EAAd,EAAsCC,MAAtC,CACdC,OAAD,IAAa;AACX,kBAAM;AAAEC,cAAAA,UAAF;AAAcC,cAAAA,IAAd;AAAoBC,cAAAA;AAApB,gBAAyCH,OAA/C;AACA,mBACE;AACAC,cAAAA,UAAU,KAAK,KAAKA,UAApB,IACA;AACAE,cAAAA,gBAFA,IAGA;AACAH,cAAAA,OAAO,YAAYI,+BAJnB,IAKA;AACAF,cAAAA,IANA,IAOA;AACA,mBAAKA,IAAL,CAAUG,QAAV,CAAmBH,IAAnB;AAVF;AAYD,WAfc,CAAjB,CADoC,CAkBpC;;AACA,eAAK,MAAMF,OAAX,IAAsBN,QAAtB,EAAgC;AAC9B;AACAM,YAAAA,OAAO,CAACM,eAAR,CAAwBpB,EAAxB;AACD;AACF;AACF;AACF;AACF;;AAjCwD;;eAoC5CH,wB","sourcesContent":["import DiscreteGestureHandler from './DiscreteGestureHandler';\nimport { HammerInputExt } from './GestureHandler';\nimport * as NodeManager from './NodeManager';\nimport PressGestureHandler from './PressGestureHandler';\nimport { TEST_MIN_IF_NOT_NAN, VEC_LEN_SQ } from './utils';\n\nclass NativeViewGestureHandler extends PressGestureHandler {\n onRawEvent(ev: HammerInputExt) {\n super.onRawEvent(ev);\n if (!ev.isFinal) {\n // if (this.ref instanceof ScrollView) {\n if (TEST_MIN_IF_NOT_NAN(VEC_LEN_SQ({ x: ev.deltaX, y: ev.deltaY }), 10)) {\n // @ts-ignore FIXME(TS) config type\n if (this.config.disallowInterruption) {\n const gestures = Object.values(NodeManager.getNodes()).filter(\n (gesture) => {\n const { handlerTag, view, isGestureRunning } = gesture;\n return (\n // Check if this gesture isn't self\n handlerTag !== this.handlerTag &&\n // Ensure the gesture needs to be cancelled\n isGestureRunning &&\n // ScrollView can cancel discrete gestures like taps and presses\n gesture instanceof DiscreteGestureHandler &&\n // Ensure a view exists and is a child of the current view\n view &&\n // @ts-ignore FIXME(TS) view type\n this.view.contains(view)\n );\n }\n );\n // Cancel all of the gestures that passed the filter\n for (const gesture of gestures) {\n // TODO: Bacon: Send some cached event.\n gesture.forceInvalidate(ev);\n }\n }\n }\n }\n }\n}\n\nexport default NativeViewGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/NodeManager.js b/lib/commonjs/web/NodeManager.js
new file mode 100644
index 0000000000..546931e08a
--- /dev/null
+++ b/lib/commonjs/web/NodeManager.js
@@ -0,0 +1,43 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.getHandler = getHandler;
+exports.createGestureHandler = createGestureHandler;
+exports.dropGestureHandler = dropGestureHandler;
+exports.getNodes = getNodes;
+const gestures = {};
+
+function getHandler(tag) {
+ if (tag in gestures) return gestures[tag];
+ throw new Error(`No handler for tag ${tag}`);
+}
+
+function createGestureHandler(handlerTag, handler) {
+ if (handlerTag in gestures) {
+ throw new Error(`Handler with tag ${handlerTag} already exists`);
+ }
+
+ gestures[handlerTag] = handler; // @ts-ignore no types for web handlers yet
+
+ gestures[handlerTag].handlerTag = handlerTag;
+}
+
+function dropGestureHandler(handlerTag) {
+ // Since React 18, there are cases where componentWillUnmount gets called twice in a row
+ // so skip this if the tag was already removed.
+ if (!(handlerTag in gestures)) {
+ return;
+ }
+
+ getHandler(handlerTag).destroy(); // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
+
+ delete gestures[handlerTag];
+}
+
+function getNodes() {
+ return { ...gestures
+ };
+}
+//# sourceMappingURL=NodeManager.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/NodeManager.js.map b/lib/commonjs/web/NodeManager.js.map
new file mode 100644
index 0000000000..aa1e8ab0ba
--- /dev/null
+++ b/lib/commonjs/web/NodeManager.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["NodeManager.ts"],"names":["gestures","getHandler","tag","Error","createGestureHandler","handlerTag","handler","dropGestureHandler","destroy","getNodes"],"mappings":";;;;;;;;;AAGA,MAAMA,QAAgE,GAAG,EAAzE;;AAEO,SAASC,UAAT,CAAoBC,GAApB,EAAiC;AACtC,MAAIA,GAAG,IAAIF,QAAX,EAAqB,OAAOA,QAAQ,CAACE,GAAD,CAAf;AAErB,QAAM,IAAIC,KAAJ,CAAW,sBAAqBD,GAAI,EAApC,CAAN;AACD;;AAEM,SAASE,oBAAT,CACLC,UADK,EAELC,OAFK,EAGL;AACA,MAAID,UAAU,IAAIL,QAAlB,EAA4B;AAC1B,UAAM,IAAIG,KAAJ,CAAW,oBAAmBE,UAAW,iBAAzC,CAAN;AACD;;AACDL,EAAAA,QAAQ,CAACK,UAAD,CAAR,GAAuBC,OAAvB,CAJA,CAKA;;AACAN,EAAAA,QAAQ,CAACK,UAAD,CAAR,CAAqBA,UAArB,GAAkCA,UAAlC;AACD;;AAEM,SAASE,kBAAT,CAA4BF,UAA5B,EAAgD;AACrD;AACA;AACA,MAAI,EAAEA,UAAU,IAAIL,QAAhB,CAAJ,EAA+B;AAC7B;AACD;;AACDC,EAAAA,UAAU,CAACI,UAAD,CAAV,CAAuBG,OAAvB,GANqD,CAOrD;;AACA,SAAOR,QAAQ,CAACK,UAAD,CAAf;AACD;;AAEM,SAASI,QAAT,GAAoB;AACzB,SAAO,EAAE,GAAGT;AAAL,GAAP;AACD","sourcesContent":["import { ValueOf } from '../typeUtils';\nimport { Gestures } from '../RNGestureHandlerModule.web';\n\nconst gestures: Record>> = {};\n\nexport function getHandler(tag: number) {\n if (tag in gestures) return gestures[tag];\n\n throw new Error(`No handler for tag ${tag}`);\n}\n\nexport function createGestureHandler(\n handlerTag: number,\n handler: InstanceType>\n) {\n if (handlerTag in gestures) {\n throw new Error(`Handler with tag ${handlerTag} already exists`);\n }\n gestures[handlerTag] = handler;\n // @ts-ignore no types for web handlers yet\n gestures[handlerTag].handlerTag = handlerTag;\n}\n\nexport function dropGestureHandler(handlerTag: number) {\n // Since React 18, there are cases where componentWillUnmount gets called twice in a row\n // so skip this if the tag was already removed.\n if (!(handlerTag in gestures)) {\n return;\n }\n getHandler(handlerTag).destroy();\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete gestures[handlerTag];\n}\n\nexport function getNodes() {\n return { ...gestures };\n}\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/PanGestureHandler.js b/lib/commonjs/web/PanGestureHandler.js
new file mode 100644
index 0000000000..7d2f9291cc
--- /dev/null
+++ b/lib/commonjs/web/PanGestureHandler.js
@@ -0,0 +1,189 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _hammerjs = _interopRequireDefault(require("@egjs/hammerjs"));
+
+var _constants = require("./constants");
+
+var _DraggingGestureHandler = _interopRequireDefault(require("./DraggingGestureHandler"));
+
+var _utils = require("./utils");
+
+var _State = require("../State");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+class PanGestureHandler extends _DraggingGestureHandler.default {
+ get name() {
+ return 'pan';
+ }
+
+ get NativeGestureClass() {
+ return _hammerjs.default.Pan;
+ }
+
+ getHammerConfig() {
+ return { ...super.getHammerConfig(),
+ direction: this.getDirection()
+ };
+ }
+
+ getState(type) {
+ const nextState = super.getState(type); // Ensure that the first state sent is `BEGAN` and not `ACTIVE`
+
+ if (this.previousState === _State.State.UNDETERMINED && nextState === _State.State.ACTIVE) {
+ return _State.State.BEGAN;
+ }
+
+ return nextState;
+ }
+
+ getDirection() {
+ const config = this.getConfig();
+ const {
+ activeOffsetXStart,
+ activeOffsetXEnd,
+ activeOffsetYStart,
+ activeOffsetYEnd,
+ minDist
+ } = config;
+ let directions = [];
+ let horizontalDirections = [];
+
+ if (!(0, _utils.isnan)(minDist)) {
+ return _hammerjs.default.DIRECTION_ALL;
+ }
+
+ if (!(0, _utils.isnan)(activeOffsetXStart)) horizontalDirections.push(_hammerjs.default.DIRECTION_LEFT);
+ if (!(0, _utils.isnan)(activeOffsetXEnd)) horizontalDirections.push(_hammerjs.default.DIRECTION_RIGHT);
+ if (horizontalDirections.length === 2) horizontalDirections = [_hammerjs.default.DIRECTION_HORIZONTAL];
+ directions = directions.concat(horizontalDirections);
+ let verticalDirections = [];
+ if (!(0, _utils.isnan)(activeOffsetYStart)) verticalDirections.push(_hammerjs.default.DIRECTION_UP);
+ if (!(0, _utils.isnan)(activeOffsetYEnd)) verticalDirections.push(_hammerjs.default.DIRECTION_DOWN);
+ if (verticalDirections.length === 2) verticalDirections = [_hammerjs.default.DIRECTION_VERTICAL];
+ directions = directions.concat(verticalDirections);
+
+ if (!directions.length) {
+ return _hammerjs.default.DIRECTION_NONE;
+ }
+
+ if (directions[0] === _hammerjs.default.DIRECTION_HORIZONTAL && directions[1] === _hammerjs.default.DIRECTION_VERTICAL) {
+ return _hammerjs.default.DIRECTION_ALL;
+ }
+
+ if (horizontalDirections.length && verticalDirections.length) {
+ return _hammerjs.default.DIRECTION_ALL;
+ }
+
+ return directions[0];
+ }
+
+ getConfig() {
+ if (!this.hasCustomActivationCriteria) {
+ // Default config
+ // If no params have been defined then this config should emulate the native gesture as closely as possible.
+ return {
+ minDistSq: 10
+ };
+ }
+
+ return this.config;
+ }
+
+ shouldFailUnderCustomCriteria({
+ deltaX,
+ deltaY
+ }, criteria) {
+ return !(0, _utils.isnan)(criteria.failOffsetXStart) && deltaX < criteria.failOffsetXStart || !(0, _utils.isnan)(criteria.failOffsetXEnd) && deltaX > criteria.failOffsetXEnd || !(0, _utils.isnan)(criteria.failOffsetYStart) && deltaY < criteria.failOffsetYStart || !(0, _utils.isnan)(criteria.failOffsetYEnd) && deltaY > criteria.failOffsetYEnd;
+ }
+
+ shouldActivateUnderCustomCriteria({
+ deltaX,
+ deltaY,
+ velocity
+ }, criteria) {
+ return !(0, _utils.isnan)(criteria.activeOffsetXStart) && deltaX < criteria.activeOffsetXStart || !(0, _utils.isnan)(criteria.activeOffsetXEnd) && deltaX > criteria.activeOffsetXEnd || !(0, _utils.isnan)(criteria.activeOffsetYStart) && deltaY < criteria.activeOffsetYStart || !(0, _utils.isnan)(criteria.activeOffsetYEnd) && deltaY > criteria.activeOffsetYEnd || (0, _utils.TEST_MIN_IF_NOT_NAN)((0, _utils.VEC_LEN_SQ)({
+ x: deltaX,
+ y: deltaY
+ }), criteria.minDistSq) || (0, _utils.TEST_MIN_IF_NOT_NAN)(velocity.x, criteria.minVelocityX) || (0, _utils.TEST_MIN_IF_NOT_NAN)(velocity.y, criteria.minVelocityY) || (0, _utils.TEST_MIN_IF_NOT_NAN)((0, _utils.VEC_LEN_SQ)(velocity), criteria.minVelocitySq);
+ }
+
+ shouldMultiFingerPanFail({
+ pointerLength,
+ scale,
+ deltaRotation
+ }) {
+ if (pointerLength <= 1) {
+ return false;
+ } // Test if the pan had too much pinching or rotating.
+
+
+ const deltaScale = Math.abs(scale - 1);
+ const absDeltaRotation = Math.abs(deltaRotation);
+
+ if (deltaScale > _constants.MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD) {
+ // > If the threshold doesn't seem right.
+ // You can log the value which it failed at here:
+ return true;
+ }
+
+ if (absDeltaRotation > _constants.MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD) {
+ // > If the threshold doesn't seem right.
+ // You can log the value which it failed at here:
+ return true;
+ }
+
+ return false;
+ }
+
+ updateHasCustomActivationCriteria(criteria) {
+ return (0, _utils.isValidNumber)(criteria.minDistSq) || (0, _utils.isValidNumber)(criteria.minVelocityX) || (0, _utils.isValidNumber)(criteria.minVelocityY) || (0, _utils.isValidNumber)(criteria.minVelocitySq) || (0, _utils.isValidNumber)(criteria.activeOffsetXStart) || (0, _utils.isValidNumber)(criteria.activeOffsetXEnd) || (0, _utils.isValidNumber)(criteria.activeOffsetYStart) || (0, _utils.isValidNumber)(criteria.activeOffsetYEnd);
+ }
+
+ isGestureEnabledForEvent(props, _recognizer, inputData) {
+ if (this.shouldFailUnderCustomCriteria(inputData, props)) {
+ return {
+ failed: true
+ };
+ }
+
+ const velocity = {
+ x: inputData.velocityX,
+ y: inputData.velocityY
+ };
+
+ if (this.hasCustomActivationCriteria && this.shouldActivateUnderCustomCriteria({
+ deltaX: inputData.deltaX,
+ deltaY: inputData.deltaY,
+ velocity
+ }, props)) {
+ if (this.shouldMultiFingerPanFail({
+ pointerLength: inputData.maxPointers,
+ scale: inputData.scale,
+ deltaRotation: inputData.deltaRotation
+ })) {
+ return {
+ failed: true
+ };
+ }
+
+ return {
+ success: true
+ };
+ }
+
+ return {
+ success: false
+ };
+ }
+
+}
+
+var _default = PanGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=PanGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/PanGestureHandler.js.map b/lib/commonjs/web/PanGestureHandler.js.map
new file mode 100644
index 0000000000..2c21a8c3c7
--- /dev/null
+++ b/lib/commonjs/web/PanGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["PanGestureHandler.ts"],"names":["PanGestureHandler","DraggingGestureHandler","name","NativeGestureClass","Hammer","Pan","getHammerConfig","direction","getDirection","getState","type","nextState","previousState","State","UNDETERMINED","ACTIVE","BEGAN","config","getConfig","activeOffsetXStart","activeOffsetXEnd","activeOffsetYStart","activeOffsetYEnd","minDist","directions","horizontalDirections","DIRECTION_ALL","push","DIRECTION_LEFT","DIRECTION_RIGHT","length","DIRECTION_HORIZONTAL","concat","verticalDirections","DIRECTION_UP","DIRECTION_DOWN","DIRECTION_VERTICAL","DIRECTION_NONE","hasCustomActivationCriteria","minDistSq","shouldFailUnderCustomCriteria","deltaX","deltaY","criteria","failOffsetXStart","failOffsetXEnd","failOffsetYStart","failOffsetYEnd","shouldActivateUnderCustomCriteria","velocity","x","y","minVelocityX","minVelocityY","minVelocitySq","shouldMultiFingerPanFail","pointerLength","scale","deltaRotation","deltaScale","Math","abs","absDeltaRotation","MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD","MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD","updateHasCustomActivationCriteria","isGestureEnabledForEvent","props","_recognizer","inputData","failed","velocityX","velocityY","maxPointers","success"],"mappings":";;;;;;;AAAA;;AAEA;;AAKA;;AACA;;AACA;;;;AAGA,MAAMA,iBAAN,SAAgCC,+BAAhC,CAAuD;AAC7C,MAAJC,IAAI,GAAG;AACT,WAAO,KAAP;AACD;;AAEqB,MAAlBC,kBAAkB,GAAG;AACvB,WAAOC,kBAAOC,GAAd;AACD;;AAEDC,EAAAA,eAAe,GAAG;AAChB,WAAO,EACL,GAAG,MAAMA,eAAN,E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;AADH,SAAP;AAGD;;AACD,aAAO;AAAEI,QAAAA,OAAO,EAAE;AAAX,OAAP;AACD;;AACD,WAAO;AAAEA,MAAAA,OAAO,EAAE;AAAX,KAAP;AACD;;AA5MoD;;eA+MxC1E,iB","sourcesContent":["import Hammer from '@egjs/hammerjs';\n\nimport {\n EventMap,\n MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD,\n MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD,\n} from './constants';\nimport DraggingGestureHandler from './DraggingGestureHandler';\nimport { isValidNumber, isnan, TEST_MIN_IF_NOT_NAN, VEC_LEN_SQ } from './utils';\nimport { State } from '../State';\n\nimport { Config, HammerInputExt } from './GestureHandler';\nclass PanGestureHandler extends DraggingGestureHandler {\n get name() {\n return 'pan';\n }\n\n get NativeGestureClass() {\n return Hammer.Pan;\n }\n\n getHammerConfig() {\n return {\n ...super.getHammerConfig(),\n direction: this.getDirection(),\n };\n }\n\n getState(type: keyof typeof EventMap) {\n const nextState = super.getState(type);\n // Ensure that the first state sent is `BEGAN` and not `ACTIVE`\n if (\n this.previousState === State.UNDETERMINED &&\n nextState === State.ACTIVE\n ) {\n return State.BEGAN;\n }\n return nextState;\n }\n\n getDirection() {\n const config = this.getConfig();\n const {\n activeOffsetXStart,\n activeOffsetXEnd,\n activeOffsetYStart,\n activeOffsetYEnd,\n minDist,\n } = config;\n let directions: number[] = [];\n let horizontalDirections = [];\n\n if (!isnan(minDist)) {\n return Hammer.DIRECTION_ALL;\n }\n\n if (!isnan(activeOffsetXStart))\n horizontalDirections.push(Hammer.DIRECTION_LEFT);\n if (!isnan(activeOffsetXEnd))\n horizontalDirections.push(Hammer.DIRECTION_RIGHT);\n if (horizontalDirections.length === 2)\n horizontalDirections = [Hammer.DIRECTION_HORIZONTAL];\n\n directions = directions.concat(horizontalDirections);\n let verticalDirections = [];\n\n if (!isnan(activeOffsetYStart))\n verticalDirections.push(Hammer.DIRECTION_UP);\n if (!isnan(activeOffsetYEnd))\n verticalDirections.push(Hammer.DIRECTION_DOWN);\n\n if (verticalDirections.length === 2)\n verticalDirections = [Hammer.DIRECTION_VERTICAL];\n\n directions = directions.concat(verticalDirections);\n\n if (!directions.length) {\n return Hammer.DIRECTION_NONE;\n }\n if (\n directions[0] === Hammer.DIRECTION_HORIZONTAL &&\n directions[1] === Hammer.DIRECTION_VERTICAL\n ) {\n return Hammer.DIRECTION_ALL;\n }\n if (horizontalDirections.length && verticalDirections.length) {\n return Hammer.DIRECTION_ALL;\n }\n\n return directions[0];\n }\n\n getConfig() {\n if (!this.hasCustomActivationCriteria) {\n // Default config\n // If no params have been defined then this config should emulate the native gesture as closely as possible.\n return {\n minDistSq: 10,\n };\n }\n return this.config;\n }\n\n shouldFailUnderCustomCriteria(\n { deltaX, deltaY }: HammerInputExt,\n criteria: any\n ) {\n return (\n (!isnan(criteria.failOffsetXStart) &&\n deltaX < criteria.failOffsetXStart) ||\n (!isnan(criteria.failOffsetXEnd) && deltaX > criteria.failOffsetXEnd) ||\n (!isnan(criteria.failOffsetYStart) &&\n deltaY < criteria.failOffsetYStart) ||\n (!isnan(criteria.failOffsetYEnd) && deltaY > criteria.failOffsetYEnd)\n );\n }\n\n shouldActivateUnderCustomCriteria(\n { deltaX, deltaY, velocity }: any,\n criteria: any\n ) {\n return (\n (!isnan(criteria.activeOffsetXStart) &&\n deltaX < criteria.activeOffsetXStart) ||\n (!isnan(criteria.activeOffsetXEnd) &&\n deltaX > criteria.activeOffsetXEnd) ||\n (!isnan(criteria.activeOffsetYStart) &&\n deltaY < criteria.activeOffsetYStart) ||\n (!isnan(criteria.activeOffsetYEnd) &&\n deltaY > criteria.activeOffsetYEnd) ||\n TEST_MIN_IF_NOT_NAN(\n VEC_LEN_SQ({ x: deltaX, y: deltaY }),\n criteria.minDistSq\n ) ||\n TEST_MIN_IF_NOT_NAN(velocity.x, criteria.minVelocityX) ||\n TEST_MIN_IF_NOT_NAN(velocity.y, criteria.minVelocityY) ||\n TEST_MIN_IF_NOT_NAN(VEC_LEN_SQ(velocity), criteria.minVelocitySq)\n );\n }\n\n shouldMultiFingerPanFail({\n pointerLength,\n scale,\n deltaRotation,\n }: {\n deltaRotation: number;\n pointerLength: number;\n scale: number;\n }) {\n if (pointerLength <= 1) {\n return false;\n }\n\n // Test if the pan had too much pinching or rotating.\n const deltaScale = Math.abs(scale - 1);\n const absDeltaRotation = Math.abs(deltaRotation);\n if (deltaScale > MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD) {\n // > If the threshold doesn't seem right.\n // You can log the value which it failed at here:\n return true;\n }\n if (absDeltaRotation > MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD) {\n // > If the threshold doesn't seem right.\n // You can log the value which it failed at here:\n return true;\n }\n\n return false;\n }\n\n updateHasCustomActivationCriteria(\n criteria: Config & { minVelocityX?: number; minVelocityY?: number }\n ) {\n return (\n isValidNumber(criteria.minDistSq) ||\n isValidNumber(criteria.minVelocityX) ||\n isValidNumber(criteria.minVelocityY) ||\n isValidNumber(criteria.minVelocitySq) ||\n isValidNumber(criteria.activeOffsetXStart) ||\n isValidNumber(criteria.activeOffsetXEnd) ||\n isValidNumber(criteria.activeOffsetYStart) ||\n isValidNumber(criteria.activeOffsetYEnd)\n );\n }\n\n isGestureEnabledForEvent(\n props: any,\n _recognizer: any,\n inputData: HammerInputExt & { deltaRotation: number }\n ) {\n if (this.shouldFailUnderCustomCriteria(inputData, props)) {\n return { failed: true };\n }\n\n const velocity = { x: inputData.velocityX, y: inputData.velocityY };\n if (\n this.hasCustomActivationCriteria &&\n this.shouldActivateUnderCustomCriteria(\n { deltaX: inputData.deltaX, deltaY: inputData.deltaY, velocity },\n props\n )\n ) {\n if (\n this.shouldMultiFingerPanFail({\n pointerLength: inputData.maxPointers,\n scale: inputData.scale,\n deltaRotation: inputData.deltaRotation,\n })\n ) {\n return {\n failed: true,\n };\n }\n return { success: true };\n }\n return { success: false };\n }\n}\n\nexport default PanGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/PinchGestureHandler.js b/lib/commonjs/web/PinchGestureHandler.js
new file mode 100644
index 0000000000..915f9bd35d
--- /dev/null
+++ b/lib/commonjs/web/PinchGestureHandler.js
@@ -0,0 +1,40 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _hammerjs = _interopRequireDefault(require("@egjs/hammerjs"));
+
+var _IndiscreteGestureHandler = _interopRequireDefault(require("./IndiscreteGestureHandler"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+class PinchGestureHandler extends _IndiscreteGestureHandler.default {
+ get name() {
+ return 'pinch';
+ }
+
+ get NativeGestureClass() {
+ return _hammerjs.default.Pinch;
+ }
+
+ transformNativeEvent({
+ scale,
+ velocity,
+ center
+ }) {
+ return {
+ focalX: center.x,
+ focalY: center.y,
+ velocity,
+ scale
+ };
+ }
+
+}
+
+var _default = PinchGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=PinchGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/PinchGestureHandler.js.map b/lib/commonjs/web/PinchGestureHandler.js.map
new file mode 100644
index 0000000000..d4e5c35097
--- /dev/null
+++ b/lib/commonjs/web/PinchGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["PinchGestureHandler.ts"],"names":["PinchGestureHandler","IndiscreteGestureHandler","name","NativeGestureClass","Hammer","Pinch","transformNativeEvent","scale","velocity","center","focalX","x","focalY","y"],"mappings":";;;;;;;AAAA;;AAGA;;;;AAEA,MAAMA,mBAAN,SAAkCC,iCAAlC,CAA2D;AACjD,MAAJC,IAAI,GAAG;AACT,WAAO,OAAP;AACD;;AAEqB,MAAlBC,kBAAkB,GAAG;AACvB,WAAOC,kBAAOC,KAAd;AACD;;AAEDC,EAAAA,oBAAoB,CAAC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAD,EAA8C;AAChE,WAAO;AACLC,MAAAA,MAAM,EAAED,MAAM,CAACE,CADV;AAELC,MAAAA,MAAM,EAAEH,MAAM,CAACI,CAFV;AAGLL,MAAAA,QAHK;AAILD,MAAAA;AAJK,KAAP;AAMD;;AAhBwD;;eAmB5CP,mB","sourcesContent":["import Hammer from '@egjs/hammerjs';\nimport { HammerInputExt } from './GestureHandler';\n\nimport IndiscreteGestureHandler from './IndiscreteGestureHandler';\n\nclass PinchGestureHandler extends IndiscreteGestureHandler {\n get name() {\n return 'pinch';\n }\n\n get NativeGestureClass() {\n return Hammer.Pinch;\n }\n\n transformNativeEvent({ scale, velocity, center }: HammerInputExt) {\n return {\n focalX: center.x,\n focalY: center.y,\n velocity,\n scale,\n };\n }\n}\n\nexport default PinchGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/PressGestureHandler.js b/lib/commonjs/web/PressGestureHandler.js
new file mode 100644
index 0000000000..28a10074b7
--- /dev/null
+++ b/lib/commonjs/web/PressGestureHandler.js
@@ -0,0 +1,188 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _hammerjs = _interopRequireDefault(require("@egjs/hammerjs"));
+
+var _State = require("../State");
+
+var _constants = require("./constants");
+
+var _DiscreteGestureHandler = _interopRequireDefault(require("./DiscreteGestureHandler"));
+
+var _utils = require("./utils");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+class PressGestureHandler extends _DiscreteGestureHandler.default {
+ constructor(...args) {
+ super(...args);
+
+ _defineProperty(this, "visualFeedbackTimer", void 0);
+
+ _defineProperty(this, "initialEvent", null);
+
+ _defineProperty(this, "shouldDelayTouches", true);
+ }
+
+ get name() {
+ return 'press';
+ }
+
+ get minDurationMs() {
+ // @ts-ignore FIXME(TS)
+ return (0, _utils.isnan)(this.config.minDurationMs) ? 5 : this.config.minDurationMs;
+ }
+
+ get maxDist() {
+ return (0, _utils.isnan)(this.config.maxDist) ? 9 : this.config.maxDist;
+ }
+
+ get NativeGestureClass() {
+ return _hammerjs.default.Press;
+ }
+
+ simulateCancelEvent(inputData) {
+ // Long press never starts so we can't rely on the running event boolean.
+ this.hasGestureFailed = true;
+ this.cancelEvent(inputData);
+ }
+
+ updateHasCustomActivationCriteria({
+ shouldCancelWhenOutside,
+ maxDistSq
+ }) {
+ return shouldCancelWhenOutside || !(0, _utils.isValidNumber)(maxDistSq);
+ }
+
+ getState(type) {
+ return {
+ [_hammerjs.default.INPUT_START]: _State.State.BEGAN,
+ [_hammerjs.default.INPUT_MOVE]: _State.State.ACTIVE,
+ [_hammerjs.default.INPUT_END]: _State.State.END,
+ [_hammerjs.default.INPUT_CANCEL]: _State.State.CANCELLED
+ }[type];
+ }
+
+ getConfig() {
+ if (!this.hasCustomActivationCriteria) {
+ // Default config
+ // If no params have been defined then this config should emulate the native gesture as closely as possible.
+ return {
+ shouldCancelWhenOutside: true,
+ maxDistSq: 10
+ };
+ }
+
+ return this.config;
+ }
+
+ getHammerConfig() {
+ return { ...super.getHammerConfig(),
+ // threshold: this.maxDist,
+ time: this.minDurationMs
+ };
+ }
+
+ onGestureActivated(ev) {
+ this.onGestureStart(ev);
+ }
+
+ shouldDelayTouchForEvent({
+ pointerType
+ }) {
+ // Don't disable event for mouse input
+ return this.shouldDelayTouches && pointerType === 'touch';
+ }
+
+ onGestureStart(ev) {
+ this.isGestureRunning = true;
+ clearTimeout(this.visualFeedbackTimer);
+ this.initialEvent = ev;
+ this.visualFeedbackTimer = (0, _utils.fireAfterInterval)(() => {
+ this.sendGestureStartedEvent(this.initialEvent);
+ this.initialEvent = null;
+ }, this.shouldDelayTouchForEvent(ev) && _constants.CONTENT_TOUCHES_DELAY);
+ }
+
+ sendGestureStartedEvent(ev) {
+ clearTimeout(this.visualFeedbackTimer);
+ this.visualFeedbackTimer = null;
+ this.sendEvent({ ...ev,
+ eventType: _hammerjs.default.INPUT_MOVE,
+ isFirst: true
+ });
+ }
+
+ forceInvalidate(event) {
+ super.forceInvalidate(event);
+ clearTimeout(this.visualFeedbackTimer);
+ this.visualFeedbackTimer = null;
+ this.initialEvent = null;
+ }
+
+ onRawEvent(ev) {
+ super.onRawEvent(ev);
+
+ if (this.isGestureRunning) {
+ if (ev.isFinal) {
+ let timeout;
+
+ if (this.visualFeedbackTimer) {
+ // Aesthetic timing for a quick tap.
+ // We haven't activated the tap right away to emulate iOS `delaysContentTouches`
+ // Now we must send the initial activation event and wait a set amount of time before firing the end event.
+ timeout = _constants.CONTENT_TOUCHES_QUICK_TAP_END_DELAY;
+ this.sendGestureStartedEvent(this.initialEvent);
+ this.initialEvent = null;
+ }
+
+ (0, _utils.fireAfterInterval)(() => {
+ this.sendEvent({ ...ev,
+ eventType: _hammerjs.default.INPUT_END,
+ isFinal: true
+ }); // @ts-ignore -- this should explicitly support undefined
+
+ this.onGestureEnded();
+ }, timeout);
+ } else {
+ this.sendEvent({ ...ev,
+ eventType: _hammerjs.default.INPUT_MOVE,
+ isFinal: false
+ });
+ }
+ }
+ }
+
+ updateGestureConfig({
+ shouldActivateOnStart = false,
+ disallowInterruption = false,
+ shouldCancelWhenOutside = true,
+ minDurationMs = Number.NaN,
+ maxDist = Number.NaN,
+ minPointers = 1,
+ maxPointers = 1,
+ ...props
+ }) {
+ return super.updateGestureConfig({
+ shouldActivateOnStart,
+ disallowInterruption,
+ shouldCancelWhenOutside,
+ minDurationMs,
+ maxDist,
+ minPointers,
+ maxPointers,
+ ...props
+ });
+ }
+
+}
+
+var _default = PressGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=PressGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/PressGestureHandler.js.map b/lib/commonjs/web/PressGestureHandler.js.map
new file mode 100644
index 0000000000..0ff9f87b2e
--- /dev/null
+++ b/lib/commonjs/web/PressGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["PressGestureHandler.ts"],"names":["PressGestureHandler","DiscreteGestureHandler","name","minDurationMs","config","maxDist","NativeGestureClass","Hammer","Press","simulateCancelEvent","inputData","hasGestureFailed","cancelEvent","updateHasCustomActivationCriteria","shouldCancelWhenOutside","maxDistSq","getState","type","INPUT_START","State","BEGAN","INPUT_MOVE","ACTIVE","INPUT_END","END","INPUT_CANCEL","CANCELLED","getConfig","hasCustomActivationCriteria","getHammerConfig","time","onGestureActivated","ev","onGestureStart","shouldDelayTouchForEvent","pointerType","shouldDelayTouches","isGestureRunning","clearTimeout","visualFeedbackTimer","initialEvent","sendGestureStartedEvent","CONTENT_TOUCHES_DELAY","sendEvent","eventType","isFirst","forceInvalidate","event","onRawEvent","isFinal","timeout","CONTENT_TOUCHES_QUICK_TAP_END_DELAY","onGestureEnded","updateGestureConfig","shouldActivateOnStart","disallowInterruption","Number","NaN","minPointers","maxPointers","props"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAKA;;AAEA;;;;;;AAEA,MAAMA,mBAAN,SAAkCC,+BAAlC,CAAyD;AAAA;AAAA;;AAAA;;AAAA,0CAET,IAFS;;AAAA,gDAoBlC,IApBkC;AAAA;;AAG/C,MAAJC,IAAI,GAAG;AACT,WAAO,OAAP;AACD;;AAEgB,MAAbC,aAAa,GAAG;AAClB;AACA,WAAO,kBAAM,KAAKC,MAAL,CAAYD,aAAlB,IAAmC,CAAnC,GAAuC,KAAKC,MAAL,CAAYD,aAA1D;AACD;;AAEU,MAAPE,OAAO,GAAG;AACZ,WAAO,kBAAM,KAAKD,MAAL,CAAYC,OAAlB,IAA6B,CAA7B,GAAiC,KAAKD,MAAL,CAAYC,OAApD;AACD;;AAEqB,MAAlBC,kBAAkB,GAAG;AACvB,WAAOC,kBAAOC,KAAd;AACD;;AAIDC,EAAAA,mBAAmB,CAACC,SAAD,EAA4B;AAC7C;AACA,SAAKC,gBAAL,GAAwB,IAAxB;AACA,SAAKC,WAAL,CAAiBF,SAAj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AA,mBAAmB,CAAC;AAClBC,IAAAA,qBAAqB,GAAG,KADN;AAElBC,IAAAA,oBAAoB,GAAG,KAFL;AAGlBzC,IAAAA,uBAAuB,GAAG,IAHR;AAIlBX,IAAAA,aAAa,GAAGqD,MAAM,CAACC,GAJL;AAKlBpD,IAAAA,OAAO,GAAGmD,MAAM,CAACC,GALC;AAMlBC,IAAAA,WAAW,GAAG,CANI;AAOlBC,IAAAA,WAAW,GAAG,CAPI;AAQlB,OAAGC;AARe,GAAD,EAShB;AACD,WAAO,MAAMP,mBAAN,CAA0B;AAC/BC,MAAAA,qBAD+B;AAE/BC,MAAAA,oBAF+B;AAG/BzC,MAAAA,uBAH+B;AAI/BX,MAAAA,aAJ+B;AAK/BE,MAAAA,OAL+B;AAM/BqD,MAAAA,WAN+B;AAO/BC,MAAAA,WAP+B;AAQ/B,SAAGC;AAR4B,KAA1B,CAAP;AAUD;;AAxJsD;;eA0J1C5D,mB","sourcesContent":["import Hammer from '@egjs/hammerjs';\n\nimport { State } from '../State';\nimport {\n CONTENT_TOUCHES_DELAY,\n CONTENT_TOUCHES_QUICK_TAP_END_DELAY,\n HammerInputNames,\n} from './constants';\nimport DiscreteGestureHandler from './DiscreteGestureHandler';\nimport { Config, HammerInputExt } from './GestureHandler';\nimport { fireAfterInterval, isValidNumber, isnan } from './utils';\n\nclass PressGestureHandler extends DiscreteGestureHandler {\n private visualFeedbackTimer: any;\n private initialEvent: HammerInputExt | null = null;\n get name() {\n return 'press';\n }\n\n get minDurationMs() {\n // @ts-ignore FIXME(TS)\n return isnan(this.config.minDurationMs) ? 5 : this.config.minDurationMs;\n }\n\n get maxDist() {\n return isnan(this.config.maxDist) ? 9 : this.config.maxDist;\n }\n\n get NativeGestureClass() {\n return Hammer.Press;\n }\n\n shouldDelayTouches = true;\n\n simulateCancelEvent(inputData: HammerInputExt) {\n // Long press never starts so we can't rely on the running event boolean.\n this.hasGestureFailed = true;\n this.cancelEvent(inputData);\n }\n\n updateHasCustomActivationCriteria({\n shouldCancelWhenOutside,\n maxDistSq,\n }: Config & { shouldCancelWhenOutside: boolean }) {\n return shouldCancelWhenOutside || !isValidNumber(maxDistSq);\n }\n\n getState(type: keyof typeof HammerInputNames): State {\n return {\n [Hammer.INPUT_START]: State.BEGAN,\n [Hammer.INPUT_MOVE]: State.ACTIVE,\n [Hammer.INPUT_END]: State.END,\n [Hammer.INPUT_CANCEL]: State.CANCELLED,\n }[type];\n }\n\n getConfig() {\n if (!this.hasCustomActivationCriteria) {\n // Default config\n // If no params have been defined then this config should emulate the native gesture as closely as possible.\n return {\n shouldCancelWhenOutside: true,\n maxDistSq: 10,\n };\n }\n return this.config;\n }\n\n getHammerConfig() {\n return {\n ...super.getHammerConfig(),\n // threshold: this.maxDist,\n time: this.minDurationMs,\n };\n }\n\n onGestureActivated(ev: HammerInputExt) {\n this.onGestureStart(ev);\n }\n\n shouldDelayTouchForEvent({ pointerType }: HammerInputExt) {\n // Don't disable event for mouse input\n return this.shouldDelayTouches && pointerType === 'touch';\n }\n\n onGestureStart(ev: HammerInputExt) {\n this.isGestureRunning = true;\n clearTimeout(this.visualFeedbackTimer);\n this.initialEvent = ev;\n this.visualFeedbackTimer = fireAfterInterval(() => {\n this.sendGestureStartedEvent(this.initialEvent as HammerInputExt);\n this.initialEvent = null;\n }, this.shouldDelayTouchForEvent(ev) && CONTENT_TOUCHES_DELAY);\n }\n\n sendGestureStartedEvent(ev: HammerInputExt) {\n clearTimeout(this.visualFeedbackTimer);\n this.visualFeedbackTimer = null;\n this.sendEvent({\n ...ev,\n eventType: Hammer.INPUT_MOVE,\n isFirst: true,\n });\n }\n\n forceInvalidate(event: HammerInputExt) {\n super.forceInvalidate(event);\n clearTimeout(this.visualFeedbackTimer);\n this.visualFeedbackTimer = null;\n this.initialEvent = null;\n }\n\n onRawEvent(ev: HammerInputExt) {\n super.onRawEvent(ev);\n if (this.isGestureRunning) {\n if (ev.isFinal) {\n let timeout;\n if (this.visualFeedbackTimer) {\n // Aesthetic timing for a quick tap.\n // We haven't activated the tap right away to emulate iOS `delaysContentTouches`\n // Now we must send the initial activation event and wait a set amount of time before firing the end event.\n timeout = CONTENT_TOUCHES_QUICK_TAP_END_DELAY;\n this.sendGestureStartedEvent(this.initialEvent as HammerInputExt);\n this.initialEvent = null;\n }\n fireAfterInterval(() => {\n this.sendEvent({\n ...ev,\n eventType: Hammer.INPUT_END,\n isFinal: true,\n });\n // @ts-ignore -- this should explicitly support undefined\n this.onGestureEnded();\n }, timeout);\n } else {\n this.sendEvent({\n ...ev,\n eventType: Hammer.INPUT_MOVE,\n isFinal: false,\n });\n }\n }\n }\n\n updateGestureConfig({\n shouldActivateOnStart = false,\n disallowInterruption = false,\n shouldCancelWhenOutside = true,\n minDurationMs = Number.NaN,\n maxDist = Number.NaN,\n minPointers = 1,\n maxPointers = 1,\n ...props\n }) {\n return super.updateGestureConfig({\n shouldActivateOnStart,\n disallowInterruption,\n shouldCancelWhenOutside,\n minDurationMs,\n maxDist,\n minPointers,\n maxPointers,\n ...props,\n });\n }\n}\nexport default PressGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/RotationGestureHandler.js b/lib/commonjs/web/RotationGestureHandler.js
new file mode 100644
index 0000000000..4d2da4d9eb
--- /dev/null
+++ b/lib/commonjs/web/RotationGestureHandler.js
@@ -0,0 +1,44 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _hammerjs = _interopRequireDefault(require("@egjs/hammerjs"));
+
+var _constants = require("./constants");
+
+var _IndiscreteGestureHandler = _interopRequireDefault(require("./IndiscreteGestureHandler"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+class RotationGestureHandler extends _IndiscreteGestureHandler.default {
+ get name() {
+ return 'rotate';
+ }
+
+ get NativeGestureClass() {
+ return _hammerjs.default.Rotate;
+ }
+
+ transformNativeEvent({
+ rotation,
+ velocity,
+ center
+ }) {
+ var _this$initialRotation;
+
+ return {
+ rotation: (rotation - ((_this$initialRotation = this.initialRotation) !== null && _this$initialRotation !== void 0 ? _this$initialRotation : 0)) * _constants.DEG_RAD,
+ anchorX: center.x,
+ anchorY: center.y,
+ velocity
+ };
+ }
+
+}
+
+var _default = RotationGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=RotationGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/RotationGestureHandler.js.map b/lib/commonjs/web/RotationGestureHandler.js.map
new file mode 100644
index 0000000000..3b08030c89
--- /dev/null
+++ b/lib/commonjs/web/RotationGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["RotationGestureHandler.ts"],"names":["RotationGestureHandler","IndiscreteGestureHandler","name","NativeGestureClass","Hammer","Rotate","transformNativeEvent","rotation","velocity","center","initialRotation","DEG_RAD","anchorX","x","anchorY","y"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;;;AAEA,MAAMA,sBAAN,SAAqCC,iCAArC,CAA8D;AACpD,MAAJC,IAAI,GAAG;AACT,WAAO,QAAP;AACD;;AAEqB,MAAlBC,kBAAkB,GAAG;AACvB,WAAOC,kBAAOC,MAAd;AACD;;AAEDC,EAAAA,oBAAoB,CAAC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,GAAD,EAAiD;AAAA;;AACnE,WAAO;AACLF,MAAAA,QAAQ,EAAE,CAACA,QAAQ,6BAAI,KAAKG,eAAT,yEAA4B,CAA5B,CAAT,IAA2CC,kBADhD;AAELC,MAAAA,OAAO,EAAEH,MAAM,CAACI,CAFX;AAGLC,MAAAA,OAAO,EAAEL,MAAM,CAACM,CAHX;AAILP,MAAAA;AAJK,KAAP;AAMD;;AAhB2D;;eAkB/CR,sB","sourcesContent":["import Hammer from '@egjs/hammerjs';\n\nimport { DEG_RAD } from './constants';\nimport { HammerInputExt } from './GestureHandler';\nimport IndiscreteGestureHandler from './IndiscreteGestureHandler';\n\nclass RotationGestureHandler extends IndiscreteGestureHandler {\n get name() {\n return 'rotate';\n }\n\n get NativeGestureClass() {\n return Hammer.Rotate;\n }\n\n transformNativeEvent({ rotation, velocity, center }: HammerInputExt) {\n return {\n rotation: (rotation - (this.initialRotation ?? 0)) * DEG_RAD,\n anchorX: center.x,\n anchorY: center.y,\n velocity,\n };\n }\n}\nexport default RotationGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/TapGestureHandler.js b/lib/commonjs/web/TapGestureHandler.js
new file mode 100644
index 0000000000..d73a2012ba
--- /dev/null
+++ b/lib/commonjs/web/TapGestureHandler.js
@@ -0,0 +1,192 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _hammerjs = _interopRequireDefault(require("@egjs/hammerjs"));
+
+var _DiscreteGestureHandler = _interopRequireDefault(require("./DiscreteGestureHandler"));
+
+var _utils = require("./utils");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+class TapGestureHandler extends _DiscreteGestureHandler.default {
+ constructor(...args) {
+ super(...args);
+
+ _defineProperty(this, "_shouldFireEndEvent", null);
+
+ _defineProperty(this, "_timer", void 0);
+
+ _defineProperty(this, "_multiTapTimer", void 0);
+
+ _defineProperty(this, "onSuccessfulTap", ev => {
+ if (this._getPendingGestures().length) {
+ this._shouldFireEndEvent = ev;
+ return;
+ }
+
+ if (ev.eventType === _hammerjs.default.INPUT_END) {
+ this.sendEvent({ ...ev,
+ eventType: _hammerjs.default.INPUT_MOVE
+ });
+ } // When handler gets activated it will turn into State.END immediately.
+
+
+ this.sendEvent({ ...ev,
+ isFinal: true
+ });
+ this.onGestureEnded(ev);
+ });
+ }
+
+ // TODO unused?
+ get name() {
+ return 'tap';
+ }
+
+ get NativeGestureClass() {
+ return _hammerjs.default.Tap;
+ }
+
+ get maxDelayMs() {
+ // @ts-ignore TODO(TS) trace down config
+ return (0, _utils.isnan)(this.config.maxDelayMs) ? 300 : this.config.maxDelayMs;
+ }
+
+ simulateCancelEvent(inputData) {
+ if (this.isGestureRunning) {
+ this.cancelEvent(inputData);
+ }
+ }
+
+ onGestureActivated(ev) {
+ if (this.isGestureRunning) {
+ this.onSuccessfulTap(ev);
+ }
+ }
+
+ onRawEvent(ev) {
+ super.onRawEvent(ev); // Attempt to create a touch-down event by checking if a valid tap hasn't started yet, then validating the input.
+
+ if (!this.hasGestureFailed && !this.isGestureRunning && // Prevent multi-pointer events from misfiring.
+ !ev.isFinal) {
+ // Tap Gesture start event
+ const gesture = this.hammer.get(this.name); // @ts-ignore TODO(TS) trace down config
+
+ if (gesture.options.enable(gesture, ev)) {
+ clearTimeout(this._multiTapTimer);
+ this.onStart(ev);
+ this.sendEvent(ev);
+ }
+ }
+
+ if (ev.isFinal && ev.maxPointers > 1) {
+ setTimeout(() => {
+ // Handle case where one finger presses slightly
+ // after the first finger on a multi-tap event
+ if (this.isGestureRunning) {
+ this.cancelEvent(ev);
+ }
+ });
+ }
+
+ if (this.hasGestureFailed) {
+ return;
+ } // Hammer doesn't send a `cancel` event for taps.
+ // Manually fail the event.
+
+
+ if (ev.isFinal) {
+ // Handle case where one finger presses slightly
+ // after the first finger on a multi-tap event
+ if (ev.maxPointers > 1) {
+ setTimeout(() => {
+ if (this.isGestureRunning) {
+ this.cancelEvent(ev);
+ }
+ });
+ } // Clear last timer
+
+
+ clearTimeout(this._timer); // Create time out for multi-taps.
+
+ this._timer = setTimeout(() => {
+ this.hasGestureFailed = true;
+ this.cancelEvent(ev);
+ }, this.maxDelayMs);
+ } else if (!this.hasGestureFailed && !this.isGestureRunning) {
+ // Tap Gesture start event
+ const gesture = this.hammer.get(this.name); // @ts-ignore TODO(TS) trace down config
+
+ if (gesture.options.enable(gesture, ev)) {
+ clearTimeout(this._multiTapTimer);
+ this.onStart(ev);
+ this.sendEvent(ev);
+ }
+ }
+ }
+
+ getHammerConfig() {
+ return { ...super.getHammerConfig(),
+ event: this.name,
+ // @ts-ignore TODO(TS) trace down config
+ taps: (0, _utils.isnan)(this.config.numberOfTaps) ? 1 : this.config.numberOfTaps,
+ interval: this.maxDelayMs,
+ time: // @ts-ignore TODO(TS) trace down config
+ (0, _utils.isnan)(this.config.maxDurationMs) || this.config.maxDurationMs == null ? 250 : // @ts-ignore TODO(TS) trace down config
+ this.config.maxDurationMs
+ };
+ }
+
+ updateGestureConfig({
+ shouldCancelWhenOutside = true,
+ maxDeltaX = Number.NaN,
+ maxDeltaY = Number.NaN,
+ numberOfTaps = 1,
+ minDurationMs = 525,
+ maxDelayMs = Number.NaN,
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- TODO possibly forgotten to use in updateGestureConfig?
+ maxDurationMs = Number.NaN,
+ maxDist = 2,
+ minPointers = 1,
+ maxPointers = 1,
+ ...props
+ }) {
+ return super.updateGestureConfig({
+ shouldCancelWhenOutside,
+ numberOfTaps,
+ maxDeltaX,
+ maxDeltaY,
+ minDurationMs,
+ maxDelayMs,
+ maxDist,
+ minPointers,
+ maxPointers,
+ ...props
+ });
+ }
+
+ onGestureEnded(...props) {
+ clearTimeout(this._timer); // @ts-ignore TODO(TS) check how onGestureEnded works
+
+ super.onGestureEnded(...props);
+ }
+
+ onWaitingEnded(_gesture) {
+ if (this._shouldFireEndEvent) {
+ this.onSuccessfulTap(this._shouldFireEndEvent);
+ this._shouldFireEndEvent = null;
+ }
+ }
+
+}
+
+var _default = TapGestureHandler;
+exports.default = _default;
+//# sourceMappingURL=TapGestureHandler.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/TapGestureHandler.js.map b/lib/commonjs/web/TapGestureHandler.js.map
new file mode 100644
index 0000000000..9a87f34660
--- /dev/null
+++ b/lib/commonjs/web/TapGestureHandler.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["TapGestureHandler.ts"],"names":["TapGestureHandler","DiscreteGestureHandler","ev","_getPendingGestures","length","_shouldFireEndEvent","eventType","Hammer","INPUT_END","sendEvent","INPUT_MOVE","isFinal","onGestureEnded","name","NativeGestureClass","Tap","maxDelayMs","config","simulateCancelEvent","inputData","isGestureRunning","cancelEvent","onGestureActivated","onSuccessfulTap","onRawEvent","hasGestureFailed","gesture","hammer","get","options","enable","clearTimeout","_multiTapTimer","onStart","maxPointers","setTimeout","_timer","getHammerConfig","event","taps","numberOfTaps","interval","time","maxDurationMs","updateGestureConfig","shouldCancelWhenOutside","maxDeltaX","Number","NaN","maxDeltaY","minDurationMs","maxDist","minPointers","props","onWaitingEnded","_gesture"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;;;;;AAEA,MAAMA,iBAAN,SAAgCC,+BAAhC,CAAuD;AAAA;AAAA;;AAAA,iDACA,IADA;;AAAA;;AAAA;;AAAA,6CA6BlCC,EAAD,IAAwB;AACxC,UAAI,KAAKC,mBAAL,GAA2BC,MAA/B,EAAuC;AACrC,aAAKC,mBAAL,GAA2BH,EAA3B;AACA;AACD;;AACD,UAAIA,EAAE,CAACI,SAAH,KAAiBC,kBAAOC,SAA5B,EAAuC;AACrC,aAAKC,SAAL,CAAe,EAAE,GAAGP,EAAL;AAASI,UAAAA,SAAS,EAAEC,kBAAOG;AAA3B,SAAf;AACD,OAPuC,CAQxC;;;AACA,WAAKD,SAAL,CAAe,EAAE,GAAGP,EAAL;AAASS,QAAAA,OAAO,EAAE;AAAlB,OAAf;AACA,WAAKC,cAAL,CAAoBV,EAApB;AACD,KAxCoD;AAAA;;AAGxB;AACrB,MAAJW,IAAI,GAAG;AACT,WAAO,KAAP;AACD;;AAEqB,MAAlBC,kBAAkB,GAAG;AACvB,WAAOP,kBAAOQ,GAAd;AACD;;AAEa,MAAVC,UAAU,GAAG;AACf;AACA,WAAO,kBAAM,KAAKC,MAAL,CAAYD,UAAlB,IAAgC,GAAhC,GAAsC,KAAKC,MAAL,CAAYD,UAAzD;AACD;;AAEDE,EAAAA,mBAAmB,CA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AAGF,MAAM,CAACC,GAHD;AAIlBR,IAAAA,YAAY,GAAG,CAJG;AAKlBU,IAAAA,aAAa,GAAG,GALE;AAMlBlC,IAAAA,UAAU,GAAG+B,MAAM,CAACC,GANF;AAOlB;AACAL,IAAAA,aAAa,GAAGI,MAAM,CAACC,GARL;AASlBG,IAAAA,OAAO,GAAG,CATQ;AAUlBC,IAAAA,WAAW,GAAG,CAVI;AAWlBlB,IAAAA,WAAW,GAAG,CAXI;AAYlB,OAAGmB;AAZe,GAAD,EAahB;AACD,WAAO,MAAMT,mBAAN,CAA0B;AAC/BC,MAAAA,uBAD+B;AAE/BL,MAAAA,YAF+B;AAG/BM,MAAAA,SAH+B;AAI/BG,MAAAA,SAJ+B;AAK/BC,MAAAA,aAL+B;AAM/BlC,MAAAA,UAN+B;AAO/BmC,MAAAA,OAP+B;AAQ/BC,MAAAA,WAR+B;AAS/BlB,MAAAA,WAT+B;AAU/B,SAAGmB;AAV4B,KAA1B,CAAP;AAYD;;AAEDzC,EAAAA,cAAc,CAAC,GAAGyC,KAAJ,EAAgB;AAC5BtB,IAAAA,YAAY,CAAC,KAAKK,MAAN,CAAZ,CAD4B,CAE5B;;AACA,UAAMxB,cAAN,CAAqB,GAAGyC,KAAxB;AACD;;AAEDC,EAAAA,cAAc,CAACC,QAAD,EAAgB;AAC5B,QAAI,KAAKlD,mBAAT,EAA8B;AAC5B,WAAKkB,eAAL,CAAqB,KAAKlB,mBAA1B;AACA,WAAKA,mBAAL,GAA2B,IAA3B;AACD;AACF;;AAnKoD;;eAqKxCL,iB","sourcesContent":["import Hammer from '@egjs/hammerjs';\n\nimport DiscreteGestureHandler from './DiscreteGestureHandler';\nimport { HammerInputExt } from './GestureHandler';\nimport { isnan } from './utils';\n\nclass TapGestureHandler extends DiscreteGestureHandler {\n private _shouldFireEndEvent: HammerInputExt | null = null;\n private _timer: any;\n private _multiTapTimer: any; // TODO unused?\n get name() {\n return 'tap';\n }\n\n get NativeGestureClass() {\n return Hammer.Tap;\n }\n\n get maxDelayMs() {\n // @ts-ignore TODO(TS) trace down config\n return isnan(this.config.maxDelayMs) ? 300 : this.config.maxDelayMs;\n }\n\n simulateCancelEvent(inputData: HammerInputExt) {\n if (this.isGestureRunning) {\n this.cancelEvent(inputData);\n }\n }\n\n onGestureActivated(ev: HammerInputExt) {\n if (this.isGestureRunning) {\n this.onSuccessfulTap(ev);\n }\n }\n\n onSuccessfulTap = (ev: HammerInputExt) => {\n if (this._getPendingGestures().length) {\n this._shouldFireEndEvent = ev;\n return;\n }\n if (ev.eventType === Hammer.INPUT_END) {\n this.sendEvent({ ...ev, eventType: Hammer.INPUT_MOVE });\n }\n // When handler gets activated it will turn into State.END immediately.\n this.sendEvent({ ...ev, isFinal: true });\n this.onGestureEnded(ev);\n };\n\n onRawEvent(ev: HammerInput) {\n super.onRawEvent(ev);\n\n // Attempt to create a touch-down event by checking if a valid tap hasn't started yet, then validating the input.\n if (\n !this.hasGestureFailed &&\n !this.isGestureRunning &&\n // Prevent multi-pointer events from misfiring.\n !ev.isFinal\n ) {\n // Tap Gesture start event\n const gesture = this.hammer!.get(this.name);\n // @ts-ignore TODO(TS) trace down config\n if (gesture.options.enable(gesture, ev)) {\n clearTimeout(this._multiTapTimer);\n\n this.onStart(ev);\n this.sendEvent(ev);\n }\n }\n if (ev.isFinal && ev.maxPointers > 1) {\n setTimeout(() => {\n // Handle case where one finger presses slightly\n // after the first finger on a multi-tap event\n if (this.isGestureRunning) {\n this.cancelEvent(ev);\n }\n });\n }\n\n if (this.hasGestureFailed) {\n return;\n }\n // Hammer doesn't send a `cancel` event for taps.\n // Manually fail the event.\n if (ev.isFinal) {\n // Handle case where one finger presses slightly\n // after the first finger on a multi-tap event\n if (ev.maxPointers > 1) {\n setTimeout(() => {\n if (this.isGestureRunning) {\n this.cancelEvent(ev);\n }\n });\n }\n\n // Clear last timer\n clearTimeout(this._timer);\n // Create time out for multi-taps.\n this._timer = setTimeout(() => {\n this.hasGestureFailed = true;\n this.cancelEvent(ev);\n }, this.maxDelayMs);\n } else if (!this.hasGestureFailed && !this.isGestureRunning) {\n // Tap Gesture start event\n const gesture = this.hammer!.get(this.name);\n // @ts-ignore TODO(TS) trace down config\n if (gesture.options.enable(gesture, ev)) {\n clearTimeout(this._multiTapTimer);\n\n this.onStart(ev);\n this.sendEvent(ev);\n }\n }\n }\n\n getHammerConfig() {\n return {\n ...super.getHammerConfig(),\n event: this.name,\n // @ts-ignore TODO(TS) trace down config\n taps: isnan(this.config.numberOfTaps) ? 1 : this.config.numberOfTaps,\n interval: this.maxDelayMs,\n time:\n // @ts-ignore TODO(TS) trace down config\n isnan(this.config.maxDurationMs) || this.config.maxDurationMs == null\n ? 250\n : // @ts-ignore TODO(TS) trace down config\n this.config.maxDurationMs,\n };\n }\n\n updateGestureConfig({\n shouldCancelWhenOutside = true,\n maxDeltaX = Number.NaN,\n maxDeltaY = Number.NaN,\n numberOfTaps = 1,\n minDurationMs = 525,\n maxDelayMs = Number.NaN,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- TODO possibly forgotten to use in updateGestureConfig?\n maxDurationMs = Number.NaN,\n maxDist = 2,\n minPointers = 1,\n maxPointers = 1,\n ...props\n }) {\n return super.updateGestureConfig({\n shouldCancelWhenOutside,\n numberOfTaps,\n maxDeltaX,\n maxDeltaY,\n minDurationMs,\n maxDelayMs,\n maxDist,\n minPointers,\n maxPointers,\n ...props,\n });\n }\n\n onGestureEnded(...props: any) {\n clearTimeout(this._timer);\n // @ts-ignore TODO(TS) check how onGestureEnded works\n super.onGestureEnded(...props);\n }\n\n onWaitingEnded(_gesture: any) {\n if (this._shouldFireEndEvent) {\n this.onSuccessfulTap(this._shouldFireEndEvent);\n this._shouldFireEndEvent = null;\n }\n }\n}\nexport default TapGestureHandler;\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/constants.js b/lib/commonjs/web/constants.js
new file mode 100644
index 0000000000..f9ee37a5f0
--- /dev/null
+++ b/lib/commonjs/web/constants.js
@@ -0,0 +1,64 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.HammerDirectionNames = exports.HammerInputNames = exports.DirectionMap = exports.Direction = exports.EventMap = exports.DEG_RAD = exports.MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD = exports.MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD = exports.CONTENT_TOUCHES_QUICK_TAP_END_DELAY = exports.CONTENT_TOUCHES_DELAY = void 0;
+
+var _hammerjs = _interopRequireDefault(require("@egjs/hammerjs"));
+
+var _State = require("../State");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const CONTENT_TOUCHES_DELAY = 240;
+exports.CONTENT_TOUCHES_DELAY = CONTENT_TOUCHES_DELAY;
+const CONTENT_TOUCHES_QUICK_TAP_END_DELAY = 50;
+exports.CONTENT_TOUCHES_QUICK_TAP_END_DELAY = CONTENT_TOUCHES_QUICK_TAP_END_DELAY;
+const MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD = 0.1;
+exports.MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD = MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD;
+const MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD = 7;
+exports.MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD = MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD;
+const DEG_RAD = Math.PI / 180; // Map Hammer values to RNGH
+
+exports.DEG_RAD = DEG_RAD;
+const EventMap = {
+ [_hammerjs.default.INPUT_START]: _State.State.BEGAN,
+ [_hammerjs.default.INPUT_MOVE]: _State.State.ACTIVE,
+ [_hammerjs.default.INPUT_END]: _State.State.END,
+ [_hammerjs.default.INPUT_CANCEL]: _State.State.FAILED
+};
+exports.EventMap = EventMap;
+const Direction = {
+ RIGHT: 1,
+ LEFT: 2,
+ UP: 4,
+ DOWN: 8
+};
+exports.Direction = Direction;
+const DirectionMap = {
+ [_hammerjs.default.DIRECTION_RIGHT]: Direction.RIGHT,
+ [_hammerjs.default.DIRECTION_LEFT]: Direction.LEFT,
+ [_hammerjs.default.DIRECTION_UP]: Direction.UP,
+ [_hammerjs.default.DIRECTION_DOWN]: Direction.DOWN
+};
+exports.DirectionMap = DirectionMap;
+const HammerInputNames = {
+ [_hammerjs.default.INPUT_START]: 'START',
+ [_hammerjs.default.INPUT_MOVE]: 'MOVE',
+ [_hammerjs.default.INPUT_END]: 'END',
+ [_hammerjs.default.INPUT_CANCEL]: 'CANCEL'
+};
+exports.HammerInputNames = HammerInputNames;
+const HammerDirectionNames = {
+ [_hammerjs.default.DIRECTION_HORIZONTAL]: 'HORIZONTAL',
+ [_hammerjs.default.DIRECTION_UP]: 'UP',
+ [_hammerjs.default.DIRECTION_DOWN]: 'DOWN',
+ [_hammerjs.default.DIRECTION_VERTICAL]: 'VERTICAL',
+ [_hammerjs.default.DIRECTION_NONE]: 'NONE',
+ [_hammerjs.default.DIRECTION_ALL]: 'ALL',
+ [_hammerjs.default.DIRECTION_RIGHT]: 'RIGHT',
+ [_hammerjs.default.DIRECTION_LEFT]: 'LEFT'
+};
+exports.HammerDirectionNames = HammerDirectionNames;
+//# sourceMappingURL=constants.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/constants.js.map b/lib/commonjs/web/constants.js.map
new file mode 100644
index 0000000000..b2bd4f2ed2
--- /dev/null
+++ b/lib/commonjs/web/constants.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["constants.ts"],"names":["CONTENT_TOUCHES_DELAY","CONTENT_TOUCHES_QUICK_TAP_END_DELAY","MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD","MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD","DEG_RAD","Math","PI","EventMap","Hammer","INPUT_START","State","BEGAN","INPUT_MOVE","ACTIVE","INPUT_END","END","INPUT_CANCEL","FAILED","Direction","RIGHT","LEFT","UP","DOWN","DirectionMap","DIRECTION_RIGHT","DIRECTION_LEFT","DIRECTION_UP","DIRECTION_DOWN","Hammer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BAAR,GAA+B,YADG;AAElC,GAACtB,kBAAOkB,YAAR,GAAuB,IAFW;AAGlC,GAAClB,kBAAOmB,cAAR,GAAyB,MAHS;AAIlC,GAACnB,kBAAOuB,kBAAR,GAA6B,UAJK;AAKlC,GAACvB,kBAAOwB,cAAR,GAAyB,MALS;AAMlC,GAACxB,kBAAOyB,aAAR,GAAwB,KANU;AAOlC,GAACzB,kBAAOgB,eAAR,GAA0B,OAPQ;AAQlC,GAAChB,kBAAOiB,cAAR,GAAyB;AARS,CAA7B","sourcesContent":["import Hammer from '@egjs/hammerjs';\n\nimport { State } from '../State';\n\nexport const CONTENT_TOUCHES_DELAY = 240;\nexport const CONTENT_TOUCHES_QUICK_TAP_END_DELAY = 50;\nexport const MULTI_FINGER_PAN_MAX_PINCH_THRESHOLD = 0.1;\nexport const MULTI_FINGER_PAN_MAX_ROTATION_THRESHOLD = 7;\nexport const DEG_RAD = Math.PI / 180;\n\n// Map Hammer values to RNGH\nexport const EventMap = {\n [Hammer.INPUT_START]: State.BEGAN,\n [Hammer.INPUT_MOVE]: State.ACTIVE,\n [Hammer.INPUT_END]: State.END,\n [Hammer.INPUT_CANCEL]: State.FAILED,\n} as const;\n\nexport const Direction = {\n RIGHT: 1,\n LEFT: 2,\n UP: 4,\n DOWN: 8,\n};\n\nexport const DirectionMap = {\n [Hammer.DIRECTION_RIGHT]: Direction.RIGHT,\n [Hammer.DIRECTION_LEFT]: Direction.LEFT,\n [Hammer.DIRECTION_UP]: Direction.UP,\n [Hammer.DIRECTION_DOWN]: Direction.DOWN,\n};\n\nexport const HammerInputNames = {\n [Hammer.INPUT_START]: 'START',\n [Hammer.INPUT_MOVE]: 'MOVE',\n [Hammer.INPUT_END]: 'END',\n [Hammer.INPUT_CANCEL]: 'CANCEL',\n};\nexport const HammerDirectionNames = {\n [Hammer.DIRECTION_HORIZONTAL]: 'HORIZONTAL',\n [Hammer.DIRECTION_UP]: 'UP',\n [Hammer.DIRECTION_DOWN]: 'DOWN',\n [Hammer.DIRECTION_VERTICAL]: 'VERTICAL',\n [Hammer.DIRECTION_NONE]: 'NONE',\n [Hammer.DIRECTION_ALL]: 'ALL',\n [Hammer.DIRECTION_RIGHT]: 'RIGHT',\n [Hammer.DIRECTION_LEFT]: 'LEFT',\n};\n"]}
\ No newline at end of file
diff --git a/lib/commonjs/web/utils.js b/lib/commonjs/web/utils.js
new file mode 100644
index 0000000000..15f4a5c4ab
--- /dev/null
+++ b/lib/commonjs/web/utils.js
@@ -0,0 +1,42 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.fireAfterInterval = fireAfterInterval;
+exports.TEST_MAX_IF_NOT_NAN = exports.VEC_LEN_SQ = exports.TEST_MIN_IF_NOT_NAN = exports.isValidNumber = exports.isnan = void 0;
+
+// TODO(TS) remove if not necessary after rewrite
+const isnan = v => Number.isNaN(v); // TODO(TS) remove if not necessary after rewrite
+
+
+exports.isnan = isnan;
+
+const isValidNumber = v => typeof v === 'number' && !Number.isNaN(v);
+
+exports.isValidNumber = isValidNumber;
+
+const TEST_MIN_IF_NOT_NAN = (value, limit) => !isnan(limit) && (limit < 0 && value <= limit || limit >= 0 && value >= limit);
+
+exports.TEST_MIN_IF_NOT_NAN = TEST_MIN_IF_NOT_NAN;
+
+const VEC_LEN_SQ = ({
+ x = 0,
+ y = 0
+} = {}) => x * x + y * y;
+
+exports.VEC_LEN_SQ = VEC_LEN_SQ;
+
+const TEST_MAX_IF_NOT_NAN = (value, max) => !isnan(max) && (max < 0 && value < max || max >= 0 && value > max);
+
+exports.TEST_MAX_IF_NOT_NAN = TEST_MAX_IF_NOT_NAN;
+
+function fireAfterInterval(method, interval) {
+ if (!interval) {
+ method();
+ return null;
+ }
+
+ return setTimeout(() => method(), interval);
+}
+//# sourceMappingURL=utils.js.map
\ No newline at end of file
diff --git a/lib/commonjs/web/utils.js.map b/lib/commonjs/web/utils.js.map
new file mode 100644
index 0000000000..405560aae2
--- /dev/null
+++ b/lib/commonjs/web/utils.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["utils.ts"],"names":["isnan","v","Number","isNaN","isValidNumber","TEST_MIN_IF_NOT_NAN","value","limit","VEC_LEN_SQ","x","y","TEST_MAX_IF_NOT_NAN","max","fireAfterInterval","method","interval","setTimeout"],"mappings":";;;;;;;;AAAA;AACO,MAAMA,KAAK,GAAIC,CAAD,IAAgBC,MAAM,CAACC,KAAP,CAAaF,CAAb,CAA9B,C,CAEP;;;;;AACO,MAAMG,aAAa,GAAIH,CAAD,IAC3B,OAAOA,CAAP,KAAa,QAAb,IAAyB,CAACC,MAAM,CAACC,KAAP,CAAaF,CAAb,CADrB;;;;AAGA,MAAMI,mBAAmB,GAAG,CAACC,KAAD,EAAgBC,KAAhB,KACjC,CAACP,KAAK,CAACO,KAAD,CAAN,KACEA,KAAK,GAAG,CAAR,IAAaD,KAAK,IAAIC,KAAvB,IAAkCA,KAAK,IAAI,CAAT,IAAcD,KAAK,IAAIC,KAD1D,CADK;;;;AAGA,MAAMC,UAAU,GAAG,CAAC;AAAEC,EAAAA,CAAC,GAAG,CAAN;AAASC,EAAAA,CAAC,GAAG;AAAb,IAAmB,EAApB,KAA2BD,CAAC,GAAGA,CAAJ,GAAQC,CAAC,GAAGA,CAA1D;;;;AACA,MAAMC,mBAAmB,GAAG,CAACL,KAAD,EAAgBM,GAAhB,KACjC,CAACZ,KAAK,CAACY,GAAD,CAAN,KAAiBA,GAAG,GAAG,CAAN,IAAWN,KAAK,GAAGM,GAApB,IAA6BA,GAAG,IAAI,CAAP,IAAYN,KAAK,GAAGM,GAAjE,CADK;;;;AAGA,SAASC,iBAAT,CACLC,MADK,EAELC,QAFK,EAGL;AACA,MAAI,CAACA,QAAL,EAAe;AACbD,IAAAA,MAAM;AACN,WAAO,IAAP;AACD;;AACD,SAAOE,UAAU,CAAC,MAAMF,MAAM,EAAb,EAAiBC,QAAjB,CAAjB;AACD","sourcesContent":["// TODO(TS) remove if not necessary after rewrite\nexport const isnan = (v: unknown) => Number.isNaN(v);\n\n// TODO(TS) remove if not necessary after rewrite\nexport const isValidNumber = (v: unknown) =>\n typeof v === 'number' && !Number.isNaN(v);\n\nexport const TEST_MIN_IF_NOT_NAN = (value: number, limit: number): boolean =>\n !isnan(limit) &&\n ((limit < 0 && value <= limit) || (limit >= 0 && value >= limit));\nexport const VEC_LEN_SQ = ({ x = 0, y = 0 } = {}) => x * x + y * y;\nexport const TEST_MAX_IF_NOT_NAN = (value: number, max: number) =>\n !isnan(max) && ((max < 0 && value < max) || (max >= 0 && value > max));\n\nexport function fireAfterInterval(\n method: () => void,\n interval?: number | boolean\n) {\n if (!interval) {\n method();\n return null;\n }\n return setTimeout(() => method(), interval);\n}\n"]}
\ No newline at end of file
diff --git a/lib/module/Directions.js b/lib/module/Directions.js
new file mode 100644
index 0000000000..4856fd6e62
--- /dev/null
+++ b/lib/module/Directions.js
@@ -0,0 +1,7 @@
+export const Directions = {
+ RIGHT: 1,
+ LEFT: 2,
+ UP: 4,
+ DOWN: 8
+}; // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
+//# sourceMappingURL=Directions.js.map
\ No newline at end of file
diff --git a/lib/module/Directions.js.map b/lib/module/Directions.js.map
new file mode 100644
index 0000000000..0d1a3e05b1
--- /dev/null
+++ b/lib/module/Directions.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["Directions.ts"],"names":["Directions","RIGHT","LEFT","UP","DOWN"],"mappings":"AAAA,OAAO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,KAAK,EAAE,CADiB;AAExBC,EAAAA,IAAI,EAAE,CAFkB;AAGxBC,EAAAA,EAAE,EAAE,CAHoB;AAIxBC,EAAAA,IAAI,EAAE;AAJkB,CAAnB,C,CAOP","sourcesContent":["export const Directions = {\n RIGHT: 1,\n LEFT: 2,\n UP: 4,\n DOWN: 8,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type Directions = typeof Directions[keyof typeof Directions];\n"]}
\ No newline at end of file
diff --git a/lib/module/EventType.js b/lib/module/EventType.js
new file mode 100644
index 0000000000..6884d64b44
--- /dev/null
+++ b/lib/module/EventType.js
@@ -0,0 +1,8 @@
+export const EventType = {
+ UNDETERMINED: 0,
+ TOUCHES_DOWN: 1,
+ TOUCHES_MOVE: 2,
+ TOUCHES_UP: 3,
+ TOUCHES_CANCELLED: 4
+}; // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
+//# sourceMappingURL=EventType.js.map
\ No newline at end of file
diff --git a/lib/module/EventType.js.map b/lib/module/EventType.js.map
new file mode 100644
index 0000000000..88bb13d66b
--- /dev/null
+++ b/lib/module/EventType.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["EventType.ts"],"names":["EventType","UNDETERMINED","TOUCHES_DOWN","TOUCHES_MOVE","TOUCHES_UP","TOUCHES_CANCELLED"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAG;AACvBC,EAAAA,YAAY,EAAE,CADS;AAEvBC,EAAAA,YAAY,EAAE,CAFS;AAGvBC,EAAAA,YAAY,EAAE,CAHS;AAIvBC,EAAAA,UAAU,EAAE,CAJW;AAKvBC,EAAAA,iBAAiB,EAAE;AALI,CAAlB,C,CAQP","sourcesContent":["export const EventType = {\n UNDETERMINED: 0,\n TOUCHES_DOWN: 1,\n TOUCHES_MOVE: 2,\n TOUCHES_UP: 3,\n TOUCHES_CANCELLED: 4,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type EventType = typeof EventType[keyof typeof EventType];\n"]}
\ No newline at end of file
diff --git a/lib/module/GestureHandlerRootView.android.js b/lib/module/GestureHandlerRootView.android.js
new file mode 100644
index 0000000000..d4c4dd98b6
--- /dev/null
+++ b/lib/module/GestureHandlerRootView.android.js
@@ -0,0 +1,10 @@
+import * as React from 'react';
+import { requireNativeComponent } from 'react-native';
+const GestureHandlerRootViewNative = requireNativeComponent('GestureHandlerRootView');
+export default function GestureHandlerRootView({
+ children,
+ ...rest
+}) {
+ return /*#__PURE__*/React.createElement(GestureHandlerRootViewNative, rest, children);
+}
+//# sourceMappingURL=GestureHandlerRootView.android.js.map
\ No newline at end of file
diff --git a/lib/module/GestureHandlerRootView.android.js.map b/lib/module/GestureHandlerRootView.android.js.map
new file mode 100644
index 0000000000..8f1075c585
--- /dev/null
+++ b/lib/module/GestureHandlerRootView.android.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["GestureHandlerRootView.android.tsx"],"names":["React","requireNativeComponent","GestureHandlerRootViewNative","GestureHandlerRootView","children","rest"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,sBAAT,QAAuC,cAAvC;AAGA,MAAMC,4BAA4B,GAAGD,sBAAsB,CACzD,wBADyD,CAA3D;AAIA,eAAe,SAASE,sBAAT,CAAgC;AAC7CC,EAAAA,QAD6C;AAE7C,KAAGC;AAF0C,CAAhC,EAGiB;AAC9B,sBACE,oBAAC,4BAAD,EAAkCA,IAAlC,EACGD,QADH,CADF;AAKD","sourcesContent":["import * as React from 'react';\nimport { requireNativeComponent } from 'react-native';\nimport { GestureHandlerRootViewProps } from './GestureHandlerRootView';\n\nconst GestureHandlerRootViewNative = requireNativeComponent(\n 'GestureHandlerRootView'\n);\n\nexport default function GestureHandlerRootView({\n children,\n ...rest\n}: GestureHandlerRootViewProps) {\n return (\n \n {children}\n \n );\n}\n"]}
\ No newline at end of file
diff --git a/lib/module/GestureHandlerRootView.js b/lib/module/GestureHandlerRootView.js
new file mode 100644
index 0000000000..f6522df474
--- /dev/null
+++ b/lib/module/GestureHandlerRootView.js
@@ -0,0 +1,7 @@
+import * as React from 'react';
+import { View } from 'react-native';
+export default function GestureHandlerRootView({ ...rest
+}) {
+ return /*#__PURE__*/React.createElement(View, rest);
+}
+//# sourceMappingURL=GestureHandlerRootView.js.map
\ No newline at end of file
diff --git a/lib/module/GestureHandlerRootView.js.map b/lib/module/GestureHandlerRootView.js.map
new file mode 100644
index 0000000000..a27fa70b4c
--- /dev/null
+++ b/lib/module/GestureHandlerRootView.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["GestureHandlerRootView.tsx"],"names":["React","View","GestureHandlerRootView","rest"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,SAASC,IAAT,QAAgC,cAAhC;AAKA,eAAe,SAASC,sBAAT,CAAgC,EAC7C,GAAGC;AAD0C,CAAhC,EAEiB;AAC9B,sBAAO,oBAAC,IAAD,EAAUA,IAAV,CAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { PropsWithChildren } from 'react';\nimport { View, ViewProps } from 'react-native';\n\nexport interface GestureHandlerRootViewProps\n extends PropsWithChildren {}\n\nexport default function GestureHandlerRootView({\n ...rest\n}: GestureHandlerRootViewProps) {\n return ;\n}\n"]}
\ No newline at end of file
diff --git a/lib/module/PlatformConstants.js b/lib/module/PlatformConstants.js
new file mode 100644
index 0000000000..9fc64f26b0
--- /dev/null
+++ b/lib/module/PlatformConstants.js
@@ -0,0 +1,5 @@
+var _NativeModules$Platfo;
+
+import { NativeModules, Platform } from 'react-native';
+export default (_NativeModules$Platfo = NativeModules === null || NativeModules === void 0 ? void 0 : NativeModules.PlatformConstants) !== null && _NativeModules$Platfo !== void 0 ? _NativeModules$Platfo : Platform.constants;
+//# sourceMappingURL=PlatformConstants.js.map
\ No newline at end of file
diff --git a/lib/module/PlatformConstants.js.map b/lib/module/PlatformConstants.js.map
new file mode 100644
index 0000000000..dab8e80704
--- /dev/null
+++ b/lib/module/PlatformConstants.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["PlatformConstants.ts"],"names":["NativeModules","Platform","PlatformConstants","constants"],"mappings":";;AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAMA,wCAAgBD,aAAhB,aAAgBA,aAAhB,uBAAgBA,aAAa,CAAEE,iBAA/B,yEACED,QAAQ,CAACE,SADX","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\ntype PlatformConstants = {\n forceTouchAvailable: boolean;\n};\n\nexport default (NativeModules?.PlatformConstants ??\n Platform.constants) as PlatformConstants;\n"]}
\ No newline at end of file
diff --git a/lib/module/PlatformConstants.web.js b/lib/module/PlatformConstants.web.js
new file mode 100644
index 0000000000..d48b0dade9
--- /dev/null
+++ b/lib/module/PlatformConstants.web.js
@@ -0,0 +1,7 @@
+export default {
+ get forceTouchAvailable() {
+ return false;
+ }
+
+};
+//# sourceMappingURL=PlatformConstants.web.js.map
\ No newline at end of file
diff --git a/lib/module/PlatformConstants.web.js.map b/lib/module/PlatformConstants.web.js.map
new file mode 100644
index 0000000000..dd00b47d57
--- /dev/null
+++ b/lib/module/PlatformConstants.web.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["PlatformConstants.web.ts"],"names":["forceTouchAvailable"],"mappings":"AAAA,eAAe;AACb,MAAIA,mBAAJ,GAA0B;AACxB,WAAO,KAAP;AACD;;AAHY,CAAf","sourcesContent":["export default {\n get forceTouchAvailable() {\n return false;\n },\n};\n"]}
\ No newline at end of file
diff --git a/lib/module/RNGestureHandlerModule.js b/lib/module/RNGestureHandlerModule.js
new file mode 100644
index 0000000000..7a78bdf574
--- /dev/null
+++ b/lib/module/RNGestureHandlerModule.js
@@ -0,0 +1,13 @@
+import { NativeModules } from 'react-native';
+const {
+ RNGestureHandlerModule
+} = NativeModules;
+
+if (RNGestureHandlerModule == null) {
+ console.error(`react-native-gesture-handler module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..).
+
+ For installation instructions, please refer to https://docs.swmansion.com/react-native-gesture-handler/docs/#installation`.split('\n').map(line => line.trim()).join('\n'));
+}
+
+export default RNGestureHandlerModule;
+//# sourceMappingURL=RNGestureHandlerModule.js.map
\ No newline at end of file
diff --git a/lib/module/RNGestureHandlerModule.js.map b/lib/module/RNGestureHandlerModule.js.map
new file mode 100644
index 0000000000..8c9d1da13c
--- /dev/null
+++ b/lib/module/RNGestureHandlerModule.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["RNGestureHandlerModule.ts"],"names":["NativeModules","RNGestureHandlerModule","console","error","split","map","line","trim","join"],"mappings":"AAAA,SAASA,aAAT,QAA8B,cAA9B;AACA,MAAM;AAAEC,EAAAA;AAAF,IAA6BD,aAAnC;;AAEA,IAAIC,sBAAsB,IAAI,IAA9B,EAAoC;AAClCC,EAAAA,OAAO,CAACC,KAAR,CACG;AACL;AACA,8HAFI,CAGGC,KAHH,CAGS,IAHT,EAIGC,GAJH,CAIQC,IAAD,IAAUA,IAAI,CAACC,IAAL,EAJjB,EAKGC,IALH,CAKQ,IALR,CADF;AAQD;;AAsBD,eAAeP,sBAAf","sourcesContent":["import { NativeModules } from 'react-native';\nconst { RNGestureHandlerModule } = NativeModules;\n\nif (RNGestureHandlerModule == null) {\n console.error(\n `react-native-gesture-handler module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..).\n\n For installation instructions, please refer to https://docs.swmansion.com/react-native-gesture-handler/docs/#installation`\n .split('\\n')\n .map((line) => line.trim())\n .join('\\n')\n );\n}\n\nexport type RNGestureHandlerModuleProps = {\n handleSetJSResponder: (tag: number, blockNativeResponder: boolean) => void;\n handleClearJSResponder: () => void;\n createGestureHandler: (\n handlerName: string,\n handlerTag: number,\n config: Readonly>\n ) => void;\n attachGestureHandler: (\n handlerTag: number,\n newView: number,\n usingDeviceEvents: boolean\n ) => void;\n updateGestureHandler: (\n handlerTag: number,\n newConfig: Readonly>\n ) => void;\n dropGestureHandler: (handlerTag: number) => void;\n};\n\nexport default RNGestureHandlerModule as RNGestureHandlerModuleProps;\n"]}
\ No newline at end of file
diff --git a/lib/module/RNGestureHandlerModule.web.js b/lib/module/RNGestureHandlerModule.web.js
new file mode 100644
index 0000000000..b47f69c2f2
--- /dev/null
+++ b/lib/module/RNGestureHandlerModule.web.js
@@ -0,0 +1,56 @@
+import { Direction } from './web/constants';
+import FlingGestureHandler from './web/FlingGestureHandler';
+import LongPressGestureHandler from './web/LongPressGestureHandler';
+import NativeViewGestureHandler from './web/NativeViewGestureHandler';
+import * as NodeManager from './web/NodeManager';
+import PanGestureHandler from './web/PanGestureHandler';
+import PinchGestureHandler from './web/PinchGestureHandler';
+import RotationGestureHandler from './web/RotationGestureHandler';
+import TapGestureHandler from './web/TapGestureHandler';
+export const Gestures = {
+ PanGestureHandler,
+ RotationGestureHandler,
+ PinchGestureHandler,
+ TapGestureHandler,
+ NativeViewGestureHandler,
+ LongPressGestureHandler,
+ FlingGestureHandler // ForceTouchGestureHandler,
+
+};
+export default {
+ Direction,
+
+ handleSetJSResponder(tag, blockNativeResponder) {
+ console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
+ },
+
+ handleClearJSResponder() {
+ console.warn('handleClearJSResponder: ');
+ },
+
+ createGestureHandler(handlerName, handlerTag, config) {
+ //TODO(TS) extends config
+ if (!(handlerName in Gestures)) throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
+ const GestureClass = Gestures[handlerName];
+ NodeManager.createGestureHandler(handlerTag, new GestureClass());
+ this.updateGestureHandler(handlerTag, config);
+ },
+
+ attachGestureHandler(handlerTag, newView, _usingDeviceEvents, propsRef) {
+ NodeManager.getHandler(handlerTag).setView(newView, propsRef);
+ },
+
+ updateGestureHandler(handlerTag, newConfig) {
+ NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
+ },
+
+ getGestureHandlerNode(handlerTag) {
+ return NodeManager.getHandler(handlerTag);
+ },
+
+ dropGestureHandler(handlerTag) {
+ NodeManager.dropGestureHandler(handlerTag);
+ }
+
+};
+//# sourceMappingURL=RNGestureHandlerModule.web.js.map
\ No newline at end of file
diff --git a/lib/module/RNGestureHandlerModule.web.js.map b/lib/module/RNGestureHandlerModule.web.js.map
new file mode 100644
index 0000000000..4a43b87aae
--- /dev/null
+++ b/lib/module/RNGestureHandlerModule.web.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["RNGestureHandlerModule.web.ts"],"names":["Direction","FlingGestureHandler","LongPressGestureHandler","NativeViewGestureHandler","NodeManager","PanGestureHandler","PinchGestureHandler","RotationGestureHandler","TapGestureHandler","Gestures","handleSetJSResponder","tag","blockNativeResponder","console","warn","handleClearJSResponder","createGestureHandler","handlerName","handlerTag","config","Error","GestureClass","updateGestureHandler","attachGestureHandler","newView","_usingDeviceEvents","propsRef","getHandler","setView","newConfig","updateGestureConfig","getGestureHandlerNode","dropGestureHandler"],"mappings":"AAAA,SAASA,SAAT,QAA0B,iBAA1B;AACA,OAAOC,mBAAP,MAAgC,2BAAhC;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AACA,OAAOC,wBAAP,MAAqC,gCAArC;AACA,OAAO,KAAKC,WAAZ,MAA6B,mBAA7B;AACA,OAAOC,iBAAP,MAA8B,yBAA9B;AACA,OAAOC,mBAAP,MAAgC,2BAAhC;AACA,OAAOC,sBAAP,MAAmC,8BAAnC;AACA,OAAOC,iBAAP,MAA8B,yBAA9B;AAEA,OAAO,MAAMC,QAAQ,GAAG;AACtBJ,EAAAA,iBADsB;AAEtBE,EAAAA,sBAFsB;AAGtBD,EAAAA,mBAHsB;AAItBE,EAAAA,iBAJsB;AAKtBL,EAAAA,wBALsB;AAMtBD,EAAAA,uBANsB;AAOtBD,EAAAA,mBAPsB,CAQtB;;AARsB,CAAjB;AAWP,eAAe;AACbD,EAAAA,SADa;;AAEbU,EAAAA,oBAAoB,CAACC,GAAD,EAAcC,oBAAd,EAA6C;AAC/DC,IAAAA,OAAO,CAACC,IAAR,CAAa,wBAAb,EAAuCH,GAAvC,EAA4CC,oBAA5C;AACD,GAJY;;AAKbG,EAAAA,sBAAsB,GAAG;AACvBF,IAAAA,OAAO,CAACC,IAAR,CAAa,0BAAb;AACD,GAPY;;AAQbE,EAAAA,oBAAoB,CAClBC,WADkB,EAElBC,UAFkB,EAGlBC,MAHkB,EAIlB;AACA;AACA,QAAI,EAAEF,WAAW,IAAIR,QAAjB,CAAJ,EACE,MAAM,IAAIW,KAAJ,CACH,iCAAgCH,WAAY,2BADzC,CAAN;AAGF,UAAMI,YAAY,GAAGZ,QAAQ,CAACQ,WAAD,CAA7B;AACAb,IAAAA,WAAW,CAACY,oBAAZ,CAAiCE,UAAjC,EAA6C,IAAIG,YAAJ,EAA7C;AACA,SAAKC,oBAAL,CAA0BJ,UAA1B,EAAsCC,MAAtC;AACD,GArBY;;AAsBbI,EAAAA,oBAAoB,CAClBL,UADkB,EAElBM,OAFkB,EAGlBC,kBAHkB,EAIlBC,QAJkB,EAKlB;AACAtB,IAAAA,WAAW,CAACuB,UAAZ,CAAuBT,UAAvB,EAAmCU,OAAnC,CAA2CJ,OAA3C,EAAoDE,QAApD;AACD,GA7BY;;AA8BbJ,EAAAA,oBAAoB,CAACJ,UAAD,EAAqBW,SAArB,EAAqC;AACvDzB,IAAAA,WAAW,CAACuB,UAAZ,CAAuBT,UAAvB,EAAmCY,mBAAnC,CAAuDD,SAAvD;AACD,GAhCY;;AAiCbE,EAAAA,qBAAqB,CAACb,UAAD,EAAqB;AACxC,WAAOd,WAAW,CAACuB,UAAZ,CAAuBT,UAAvB,CAAP;AACD,GAnCY;;AAoCbc,EAAAA,kBAAkB,CAACd,UAAD,EAAqB;AACrCd,IAAAA,WAAW,CAAC4B,kBAAZ,CAA+Bd,UAA/B;AACD;;AAtCY,CAAf","sourcesContent":["import { Direction } from './web/constants';\nimport FlingGestureHandler from './web/FlingGestureHandler';\nimport LongPressGestureHandler from './web/LongPressGestureHandler';\nimport NativeViewGestureHandler from './web/NativeViewGestureHandler';\nimport * as NodeManager from './web/NodeManager';\nimport PanGestureHandler from './web/PanGestureHandler';\nimport PinchGestureHandler from './web/PinchGestureHandler';\nimport RotationGestureHandler from './web/RotationGestureHandler';\nimport TapGestureHandler from './web/TapGestureHandler';\n\nexport const Gestures = {\n PanGestureHandler,\n RotationGestureHandler,\n PinchGestureHandler,\n TapGestureHandler,\n NativeViewGestureHandler,\n LongPressGestureHandler,\n FlingGestureHandler,\n // ForceTouchGestureHandler,\n};\n\nexport default {\n Direction,\n handleSetJSResponder(tag: number, blockNativeResponder: boolean) {\n console.warn('handleSetJSResponder: ', tag, blockNativeResponder);\n },\n handleClearJSResponder() {\n console.warn('handleClearJSResponder: ');\n },\n createGestureHandler(\n handlerName: keyof typeof Gestures,\n handlerTag: number,\n config: T\n ) {\n //TODO(TS) extends config\n if (!(handlerName in Gestures))\n throw new Error(\n `react-native-gesture-handler: ${handlerName} is not supported on web.`\n );\n const GestureClass = Gestures[handlerName];\n NodeManager.createGestureHandler(handlerTag, new GestureClass());\n this.updateGestureHandler(handlerTag, config);\n },\n attachGestureHandler(\n handlerTag: number,\n newView: number,\n _usingDeviceEvents: boolean,\n propsRef: React.RefObject\n ) {\n NodeManager.getHandler(handlerTag).setView(newView, propsRef);\n },\n updateGestureHandler(handlerTag: number, newConfig: any) {\n NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);\n },\n getGestureHandlerNode(handlerTag: number) {\n return NodeManager.getHandler(handlerTag);\n },\n dropGestureHandler(handlerTag: number) {\n NodeManager.dropGestureHandler(handlerTag);\n },\n};\n"]}
\ No newline at end of file
diff --git a/lib/module/State.js b/lib/module/State.js
new file mode 100644
index 0000000000..3b1605de25
--- /dev/null
+++ b/lib/module/State.js
@@ -0,0 +1,10 @@
+// TODO use State from RNModule
+export const State = {
+ UNDETERMINED: 0,
+ FAILED: 1,
+ BEGAN: 2,
+ CANCELLED: 3,
+ ACTIVE: 4,
+ END: 5
+}; // eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value
+//# sourceMappingURL=State.js.map
\ No newline at end of file
diff --git a/lib/module/State.js.map b/lib/module/State.js.map
new file mode 100644
index 0000000000..26d79d35a4
--- /dev/null
+++ b/lib/module/State.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["State.ts"],"names":["State","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END"],"mappings":"AAAA;AAEA,OAAO,MAAMA,KAAK,GAAG;AACnBC,EAAAA,YAAY,EAAE,CADK;AAEnBC,EAAAA,MAAM,EAAE,CAFW;AAGnBC,EAAAA,KAAK,EAAE,CAHY;AAInBC,EAAAA,SAAS,EAAE,CAJQ;AAKnBC,EAAAA,MAAM,EAAE,CALW;AAMnBC,EAAAA,GAAG,EAAE;AANc,CAAd,C,CASP","sourcesContent":["// TODO use State from RNModule\n\nexport const State = {\n UNDETERMINED: 0,\n FAILED: 1,\n BEGAN: 2,\n CANCELLED: 3,\n ACTIVE: 4,\n END: 5,\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- backward compatibility; it can be used as a type and as a value\nexport type State = typeof State[keyof typeof State];\n"]}
\ No newline at end of file
diff --git a/lib/module/components/DrawerLayout.js b/lib/module/components/DrawerLayout.js
new file mode 100644
index 0000000000..167a8ed5e7
--- /dev/null
+++ b/lib/module/components/DrawerLayout.js
@@ -0,0 +1,520 @@
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+// This component is based on RN's DrawerLayoutAndroid API
+//
+// It perhaps deserves to be put in a separate repo, but since it relies on
+// react-native-gesture-handler library which isn't very popular at the moment I
+// decided to keep it here for the time being. It will allow us to move faster
+// and fix issues that may arise in gesture handler library that could be found
+// when using the drawer component
+import * as React from 'react';
+import { Component } from 'react';
+import invariant from 'invariant';
+import { Animated, StyleSheet, View, Keyboard, StatusBar, I18nManager } from 'react-native';
+import { PanGestureHandler } from '../handlers/PanGestureHandler';
+import { TapGestureHandler } from '../handlers/TapGestureHandler';
+import { State } from '../State';
+const DRAG_TOSS = 0.05;
+const IDLE = 'Idle';
+const DRAGGING = 'Dragging';
+const SETTLING = 'Settling';
+export default class DrawerLayout extends Component {
+ constructor(_props) {
+ super(_props);
+
+ _defineProperty(this, "openValue", void 0);
+
+ _defineProperty(this, "onGestureEvent", void 0);
+
+ _defineProperty(this, "accessibilityIsModalView", /*#__PURE__*/React.createRef());
+
+ _defineProperty(this, "pointerEventsView", /*#__PURE__*/React.createRef());
+
+ _defineProperty(this, "panGestureHandler", /*#__PURE__*/React.createRef());
+
+ _defineProperty(this, "drawerShown", false);
+
+ _defineProperty(this, "updateAnimatedEvent", (props, state) => {
+ // Event definition is based on
+ const {
+ drawerPosition,
+ drawerWidth,
+ drawerType
+ } = props;
+ const {
+ dragX: dragXValue,
+ touchX: touchXValue,
+ drawerTranslation,
+ containerWidth
+ } = state;
+ let dragX = dragXValue;
+ let touchX = touchXValue;
+
+ if (drawerPosition !== 'left') {
+ // Most of the code is written in a way to handle left-side drawer. In
+ // order to handle right-side drawer the only thing we need to do is to
+ // reverse events coming from gesture handler in a way they emulate
+ // left-side drawer gestures. E.g. dragX is simply -dragX, and touchX is
+ // calulcated by subtracing real touchX from the width of the container
+ // (such that when touch happens at the right edge the value is simply 0)
+ dragX = Animated.multiply(new Animated.Value(-1), dragXValue); // TODO(TS): (for all "as" in this file) make sure we can map this
+
+ touchX = Animated.add(new Animated.Value(containerWidth), Animated.multiply(new Animated.Value(-1), touchXValue)); // TODO(TS): make sure we can map this;
+
+ touchXValue.setValue(containerWidth);
+ } else {
+ touchXValue.setValue(0);
+ } // While closing the drawer when user starts gesture outside of its area (in greyed
+ // out part of the window), we want the drawer to follow only once finger reaches the
+ // edge of the drawer.
+ // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by
+ // dots. The touch gesture starts at '*' and moves left, touch path is indicated by
+ // an arrow pointing left
+ // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
+ // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
+ // +---------------+ +---------------+ +---------------+ +---------------+
+ //
+ // For the above to work properly we define animated value that will keep
+ // start position of the gesture. Then we use that value to calculate how
+ // much we need to subtract from the dragX. If the gesture started on the
+ // greyed out area we take the distance from the edge of the drawer to the
+ // start position. Otherwise we don't subtract at all and the drawer be
+ // pulled back as soon as you start the pan.
+ //
+ // This is used only when drawerType is "front"
+ //
+
+
+ let translationX = dragX;
+
+ if (drawerType === 'front') {
+ const startPositionX = Animated.add(touchX, Animated.multiply(new Animated.Value(-1), dragX));
+ const dragOffsetFromOnStartPosition = startPositionX.interpolate({
+ inputRange: [drawerWidth - 1, drawerWidth, drawerWidth + 1],
+ outputRange: [0, 0, 1]
+ });
+ translationX = Animated.add(dragX, dragOffsetFromOnStartPosition); // TODO: as above
+ }
+
+ this.openValue = Animated.add(translationX, drawerTranslation).interpolate({
+ inputRange: [0, drawerWidth],
+ outputRange: [0, 1],
+ extrapolate: 'clamp'
+ });
+ const gestureOptions = {
+ useNativeDriver: props.useNativeAnimations
+ };
+
+ if (this.props.onDrawerSlide) {
+ gestureOptions.listener = ev => {
+ var _this$props$onDrawerS, _this$props;
+
+ const translationX = Math.floor(Math.abs(ev.nativeEvent.translationX));
+ const position = translationX / this.state.containerWidth;
+ (_this$props$onDrawerS = (_this$props = this.props).onDrawerSlide) === null || _this$props$onDrawerS === void 0 ? void 0 : _this$props$onDrawerS.call(_this$props, position);
+ };
+ }
+
+ this.onGestureEvent = Animated.event([{
+ nativeEvent: {
+ translationX: dragXValue,
+ x: touchXValue
+ }
+ }], gestureOptions);
+ });
+
+ _defineProperty(this, "handleContainerLayout", ({
+ nativeEvent
+ }) => {
+ this.setState({
+ containerWidth: nativeEvent.layout.width
+ });
+ });
+
+ _defineProperty(this, "emitStateChanged", (newState, drawerWillShow) => {
+ var _this$props$onDrawerS2, _this$props2;
+
+ (_this$props$onDrawerS2 = (_this$props2 = this.props).onDrawerStateChanged) === null || _this$props$onDrawerS2 === void 0 ? void 0 : _this$props$onDrawerS2.call(_this$props2, newState, drawerWillShow);
+ });
+
+ _defineProperty(this, "openingHandlerStateChange", ({
+ nativeEvent
+ }) => {
+ if (nativeEvent.oldState === State.ACTIVE) {
+ this.handleRelease({
+ nativeEvent
+ });
+ } else if (nativeEvent.state === State.ACTIVE) {
+ this.emitStateChanged(DRAGGING, false);
+
+ if (this.props.keyboardDismissMode === 'on-drag') {
+ Keyboard.dismiss();
+ }
+
+ if (this.props.hideStatusBar) {
+ StatusBar.setHidden(true, this.props.statusBarAnimation || 'slide');
+ }
+ }
+ });
+
+ _defineProperty(this, "onTapHandlerStateChange", ({
+ nativeEvent
+ }) => {
+ if (this.drawerShown && nativeEvent.oldState === State.ACTIVE && this.props.drawerLockMode !== 'locked-open') {
+ this.closeDrawer();
+ }
+ });
+
+ _defineProperty(this, "handleRelease", ({
+ nativeEvent
+ }) => {
+ const {
+ drawerWidth,
+ drawerPosition,
+ drawerType
+ } = this.props;
+ const {
+ containerWidth
+ } = this.state;
+ let {
+ translationX: dragX,
+ velocityX,
+ x: touchX
+ } = nativeEvent;
+
+ if (drawerPosition !== 'left') {
+ // See description in _updateAnimatedEvent about why events are flipped
+ // for right-side drawer
+ dragX = -dragX;
+ touchX = containerWidth - touchX;
+ velocityX = -velocityX;
+ }
+
+ const gestureStartX = touchX - dragX;
+ let dragOffsetBasedOnStart = 0;
+
+ if (drawerType === 'front') {
+ dragOffsetBasedOnStart = gestureStartX > drawerWidth ? gestureStartX - drawerWidth : 0;
+ }
+
+ const startOffsetX = dragX + dragOffsetBasedOnStart + (this.drawerShown ? drawerWidth : 0);
+ const projOffsetX = startOffsetX + DRAG_TOSS * velocityX;
+ const shouldOpen = projOffsetX > drawerWidth / 2;
+
+ if (shouldOpen) {
+ this.animateDrawer(startOffsetX, drawerWidth, velocityX);
+ } else {
+ this.animateDrawer(startOffsetX, 0, velocityX);
+ }
+ });
+
+ _defineProperty(this, "updateShowing", showing => {
+ var _this$accessibilityIs, _this$pointerEventsVi, _this$panGestureHandl;
+
+ this.drawerShown = showing;
+ (_this$accessibilityIs = this.accessibilityIsModalView.current) === null || _this$accessibilityIs === void 0 ? void 0 : _this$accessibilityIs.setNativeProps({
+ accessibilityViewIsModal: showing
+ });
+ (_this$pointerEventsVi = this.pointerEventsView.current) === null || _this$pointerEventsVi === void 0 ? void 0 : _this$pointerEventsVi.setNativeProps({
+ pointerEvents: showing ? 'auto' : 'none'
+ });
+ const {
+ drawerPosition,
+ minSwipeDistance,
+ edgeWidth
+ } = this.props;
+ const fromLeft = drawerPosition === 'left'; // gestureOrientation is 1 if the expected gesture is from left to right and
+ // -1 otherwise e.g. when drawer is on the left and is closed we expect left
+ // to right gesture, thus orientation will be 1.
+
+ const gestureOrientation = (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1); // When drawer is closed we want the hitSlop to be horizontally shorter than
+ // the container size by the value of SLOP. This will make it only activate
+ // when gesture happens not further than SLOP away from the edge
+
+ const hitSlop = fromLeft ? {
+ left: 0,
+ width: showing ? undefined : edgeWidth
+ } : {
+ right: 0,
+ width: showing ? undefined : edgeWidth
+ }; // @ts-ignore internal API, maybe could be fixed in handler types
+
+ (_this$panGestureHandl = this.panGestureHandler.current) === null || _this$panGestureHandl === void 0 ? void 0 : _this$panGestureHandl.setNativeProps({
+ hitSlop,
+ activeOffsetX: gestureOrientation * minSwipeDistance
+ });
+ });
+
+ _defineProperty(this, "animateDrawer", (fromValue, toValue, velocity, speed) => {
+ this.state.dragX.setValue(0);
+ this.state.touchX.setValue(this.props.drawerPosition === 'left' ? 0 : this.state.containerWidth);
+
+ if (fromValue != null) {
+ let nextFramePosition = fromValue;
+
+ if (this.props.useNativeAnimations) {
+ // When using native driver, we predict the next position of the
+ // animation because it takes one frame of a roundtrip to pass RELEASE
+ // event from native driver to JS before we can start animating. Without
+ // it, it is more noticable that the frame is dropped.
+ if (fromValue < toValue && velocity > 0) {
+ nextFramePosition = Math.min(fromValue + velocity / 60.0, toValue);
+ } else if (fromValue > toValue && velocity < 0) {
+ nextFramePosition = Math.max(fromValue + velocity / 60.0, toValue);
+ }
+ }
+
+ this.state.drawerTranslation.setValue(nextFramePosition);
+ }
+
+ const willShow = toValue !== 0;
+ this.updateShowing(willShow);
+ this.emitStateChanged(SETTLING, willShow);
+
+ if (this.props.hideStatusBar) {
+ StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');
+ }
+
+ Animated.spring(this.state.drawerTranslation, {
+ velocity,
+ bounciness: 0,
+ toValue,
+ useNativeDriver: this.props.useNativeAnimations,
+ speed: speed !== null && speed !== void 0 ? speed : undefined
+ }).start(({
+ finished
+ }) => {
+ if (finished) {
+ this.emitStateChanged(IDLE, willShow);
+
+ if (willShow) {
+ var _this$props$onDrawerO, _this$props3;
+
+ (_this$props$onDrawerO = (_this$props3 = this.props).onDrawerOpen) === null || _this$props$onDrawerO === void 0 ? void 0 : _this$props$onDrawerO.call(_this$props3);
+ } else {
+ var _this$props$onDrawerC, _this$props4;
+
+ (_this$props$onDrawerC = (_this$props4 = this.props).onDrawerClose) === null || _this$props$onDrawerC === void 0 ? void 0 : _this$props$onDrawerC.call(_this$props4);
+ }
+ }
+ });
+ });
+
+ _defineProperty(this, "openDrawer", (options = {}) => {
+ this.animateDrawer( // TODO: decide if it should be null or undefined is the proper value
+ undefined, this.props.drawerWidth, options.velocity ? options.velocity : 0); // We need to force the update, otherwise the overlay is not rerendered and
+ // it would not be clickable
+
+ this.forceUpdate();
+ });
+
+ _defineProperty(this, "closeDrawer", (options = {}) => {
+ // TODO: decide if it should be null or undefined is the proper value
+ this.animateDrawer(undefined, 0, options.velocity ? options.velocity : 0); // We need to force the update, otherwise the overlay is not rerendered and
+ // it would be still clickable
+
+ this.forceUpdate();
+ });
+
+ _defineProperty(this, "renderOverlay", () => {
+ /* Overlay styles */
+ invariant(this.openValue, 'should be set');
+ const overlayOpacity = this.openValue.interpolate({
+ inputRange: [0, 1],
+ outputRange: [0, 1],
+ extrapolate: 'clamp'
+ });
+ const dynamicOverlayStyles = {
+ opacity: overlayOpacity,
+ backgroundColor: this.props.overlayColor
+ };
+ return /*#__PURE__*/React.createElement(TapGestureHandler, {
+ onHandlerStateChange: this.onTapHandlerStateChange
+ }, /*#__PURE__*/React.createElement(Animated.View, {
+ pointerEvents: this.drawerShown ? 'auto' : 'none',
+ ref: this.pointerEventsView,
+ style: [styles.overlay, dynamicOverlayStyles]
+ }));
+ });
+
+ _defineProperty(this, "renderDrawer", () => {
+ const {
+ drawerBackgroundColor,
+ drawerWidth,
+ drawerPosition,
+ drawerType,
+ drawerContainerStyle,
+ contentContainerStyle
+ } = this.props;
+ const fromLeft = drawerPosition === 'left';
+ const drawerSlide = drawerType !== 'back';
+ const containerSlide = drawerType !== 'front'; // we rely on row and row-reverse flex directions to position the drawer
+ // properly. Apparently for RTL these are flipped which requires us to use
+ // the opposite setting for the drawer to appear from left or right
+ // according to the drawerPosition prop
+
+ const reverseContentDirection = I18nManager.isRTL ? fromLeft : !fromLeft;
+ const dynamicDrawerStyles = {
+ backgroundColor: drawerBackgroundColor,
+ width: drawerWidth
+ };
+ const openValue = this.openValue;
+ invariant(openValue, 'should be set');
+ let containerStyles;
+
+ if (containerSlide) {
+ const containerTranslateX = openValue.interpolate({
+ inputRange: [0, 1],
+ outputRange: fromLeft ? [0, drawerWidth] : [0, -drawerWidth],
+ extrapolate: 'clamp'
+ });
+ containerStyles = {
+ transform: [{
+ translateX: containerTranslateX
+ }]
+ };
+ }
+
+ let drawerTranslateX = 0;
+
+ if (drawerSlide) {
+ const closedDrawerOffset = fromLeft ? -drawerWidth : drawerWidth;
+ drawerTranslateX = openValue.interpolate({
+ inputRange: [0, 1],
+ outputRange: [closedDrawerOffset, 0],
+ extrapolate: 'clamp'
+ });
+ }
+
+ const drawerStyles = {
+ transform: [{
+ translateX: drawerTranslateX
+ }],
+ flexDirection: reverseContentDirection ? 'row-reverse' : 'row'
+ };
+ return /*#__PURE__*/React.createElement(Animated.View, {
+ style: styles.main,
+ onLayout: this.handleContainerLayout
+ }, /*#__PURE__*/React.createElement(Animated.View, {
+ style: [drawerType === 'front' ? styles.containerOnBack : styles.containerInFront, containerStyles, contentContainerStyle],
+ importantForAccessibility: this.drawerShown ? 'no-hide-descendants' : 'yes'
+ }, typeof this.props.children === 'function' ? this.props.children(this.openValue) : this.props.children, this.renderOverlay()), /*#__PURE__*/React.createElement(Animated.View, {
+ pointerEvents: "box-none",
+ ref: this.accessibilityIsModalView,
+ accessibilityViewIsModal: this.drawerShown,
+ style: [styles.drawerContainer, drawerStyles, drawerContainerStyle]
+ }, /*#__PURE__*/React.createElement(View, {
+ style: dynamicDrawerStyles
+ }, this.props.renderNavigationView(this.openValue))));
+ });
+
+ _defineProperty(this, "setPanGestureRef", ref => {
+ var _this$props$onGesture, _this$props5;
+
+ // TODO(TS): make sure it is OK taken from
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-596081842
+ this.panGestureHandler.current = ref;
+ (_this$props$onGesture = (_this$props5 = this.props).onGestureRef) === null || _this$props$onGesture === void 0 ? void 0 : _this$props$onGesture.call(_this$props5, ref);
+ });
+
+ const _dragX = new Animated.Value(0);
+
+ const _touchX = new Animated.Value(0);
+
+ const _drawerTranslation = new Animated.Value(0);
+
+ this.state = {
+ dragX: _dragX,
+ touchX: _touchX,
+ drawerTranslation: _drawerTranslation,
+ containerWidth: 0
+ };
+ this.updateAnimatedEvent(_props, this.state);
+ }
+
+ UNSAFE_componentWillUpdate(props, state) {
+ if (this.props.drawerPosition !== props.drawerPosition || this.props.drawerWidth !== props.drawerWidth || this.props.drawerType !== props.drawerType || this.state.containerWidth !== state.containerWidth) {
+ this.updateAnimatedEvent(props, state);
+ }
+ }
+
+ render() {
+ const {
+ drawerPosition,
+ drawerLockMode,
+ edgeWidth,
+ minSwipeDistance
+ } = this.props;
+ const fromLeft = drawerPosition === 'left'; // gestureOrientation is 1 if the expected gesture is from left to right and
+ // -1 otherwise e.g. when drawer is on the left and is closed we expect left
+ // to right gesture, thus orientation will be 1.
+
+ const gestureOrientation = (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1); // When drawer is closed we want the hitSlop to be horizontally shorter than
+ // the container size by the value of SLOP. This will make it only activate
+ // when gesture happens not further than SLOP away from the edge
+
+ const hitSlop = fromLeft ? {
+ left: 0,
+ width: this.drawerShown ? undefined : edgeWidth
+ } : {
+ right: 0,
+ width: this.drawerShown ? undefined : edgeWidth
+ };
+ return /*#__PURE__*/React.createElement(PanGestureHandler // @ts-ignore could be fixed in handler types
+ , {
+ ref: this.setPanGestureRef,
+ hitSlop: hitSlop,
+ activeOffsetX: gestureOrientation * minSwipeDistance,
+ failOffsetY: [-15, 15],
+ onGestureEvent: this.onGestureEvent,
+ onHandlerStateChange: this.openingHandlerStateChange,
+ enableTrackpadTwoFingerGesture: this.props.enableTrackpadTwoFingerGesture,
+ enabled: drawerLockMode !== 'locked-closed' && drawerLockMode !== 'locked-open'
+ }, this.renderDrawer());
+ }
+
+}
+
+_defineProperty(DrawerLayout, "defaultProps", {
+ drawerWidth: 200,
+ drawerPosition: 'left',
+ useNativeAnimations: true,
+ drawerType: 'front',
+ edgeWidth: 20,
+ minSwipeDistance: 3,
+ overlayColor: 'rgba(0, 0, 0, 0.7)',
+ drawerLockMode: 'unlocked',
+ enableTrackpadTwoFingerGesture: false
+});
+
+_defineProperty(DrawerLayout, "positions", {
+ Left: 'left',
+ Right: 'right'
+});
+
+const styles = StyleSheet.create({
+ drawerContainer: { ...StyleSheet.absoluteFillObject,
+ zIndex: 1001,
+ flexDirection: 'row'
+ },
+ containerInFront: { ...StyleSheet.absoluteFillObject,
+ zIndex: 1002
+ },
+ containerOnBack: { ...StyleSheet.absoluteFillObject
+ },
+ main: {
+ flex: 1,
+ zIndex: 0,
+ overflow: 'hidden'
+ },
+ overlay: { ...StyleSheet.absoluteFillObject,
+ zIndex: 1000
+ }
+});
+//# sourceMappingURL=DrawerLayout.js.map
\ No newline at end of file
diff --git a/lib/module/components/DrawerLayout.js.map b/lib/module/components/DrawerLayout.js.map
new file mode 100644
index 0000000000..15a41391e5
--- /dev/null
+++ b/lib/module/components/DrawerLayout.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["DrawerLayout.tsx"],"names":["React","Component","invariant","Animated","StyleSheet","View","Keyboard","StatusBar","I18nManager","PanGestureHandler","TapGestureHandler","State","DRAG_TOSS","IDLE","DRAGGING","SETTLING","DrawerLayout","constructor","props","createRef","state","drawerPosition","drawerWidth","drawerType","dragX","dragXValue","touchX","touchXValue","drawerTranslation","containerWidth","multiply","Value","add","setValue","translationX","startPositionX","dragOffsetFromOnStartPosition","interpolate","inputRange","outputRange","openValue","extrapolate","gestureOptions","useNativeDriver","useNativeAnimations","onDrawerSlide","listener","ev","Math","floor","abs","nativeEvent","position","onGestureEvent","event","x","setState","layout","width","newState","drawerWillShow","onDrawerStateChanged","oldState","ACTIVE","handleRelease","emitStateChanged","keyboardDismissMode","dismiss","hideStatusBar","setHidden","statusBarAnimation","drawerShown","drawerLockMode","closeDrawer","velocityX","gestureStartX","dragOffsetBasedOnStart","startOffsetX","projOffsetX","shouldOpen","animateDrawer","showing","accessibilityIsModalView","current","setNativeProps","accessibilityViewIsModal","pointerEventsView","pointerEvents","minSwipeDistance","edgeWidth","fromLeft","gestureOrientation","hitSlop","left","undefined","right","panGestureHandler","activeOffsetX","fromValue","toValue","velocity","speed","nextFramePosition","min","max","willShow","updateShowing","spring","bounciness","start","finished","onDrawerOpen","onDrawerClose","options","forceUpdate","overlayOpacity","dynamicOverlayStyles","opacity","backgroundColor","overlayColor","onTapHandlerStateChange","styles","overlay","drawerBackgroundColor","drawerContainerStyle","contentContainerStyle","drawerSlide","containerSlide","reverseContentDirection","isRTL","dynamicDrawerStyles","containerStyles","containerTranslateX","transform","translateX","drawerTranslateX","closedDrawerOffset","drawerStyles","flexDirection","main","handleContainerLayout","containerOnBack","containerInFront","children","renderOverlay","drawerContainer","renderNavigationView","ref","onGestureRef","updateAnimatedEvent","UNSAFE_componentWillUpdate","render","setPanGestureRef","openingHandlerStateChange","enableTrackpadTwoFingerGesture","renderDrawer","Left","Right","create","absoluteFillObject","zIndex","flex","overflow"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SACEC,QADF,EAEEC,UAFF,EAGEC,IAHF,EAIEC,QAJF,EAKEC,SALF,EAMEC,WANF,QAYO,cAZP;AAkBA,SACEC,iBADF,QAGO,+BAHP;AAIA,SACEC,iBADF,QAGO,+BAHP;AAIA,SAASC,KAAT,QAAsB,UAAtB;AAEA,MAAMC,SAAS,GAAG,IAAlB;AAEA,MAAMC,IAAiB,GAAG,MAA1B;AACA,MAAMC,QAAqB,GAAG,UAA9B;AACA,MAAMC,QAAqB,GAAG,UAA9B;AAwHA,eAAe,MAAMC,YAAN,SAA2Bf,SAA3B,CAGb;AAaAgB,EAAAA,WAAW,CAACC,MAAD,EAA2B;AACpC,UAAMA,MAAN;;AADoC;;AAAA;;AAAA,mEAmCHlB,KAAK,CAACmB,SAAN,EAnCG;;AAAA,4DAoCVnB,KAAK,CAACmB,SAAN,EApCU;;AAAA,4DAqCVnB,KAAK,CAACmB,SAAN,EArCU;;AAAA,yCAsChB,KAtCgB;;AAAA,iDA6CR,CAC5BD,KAD4B,EAE5BE,KAF4B,KAGzB;AACH;AACA,YAAM;AAAEC,QAAAA,cAAF;AAAkBC,QAAAA,WAAlB;AAA+BC,QAAAA;AAA/B,UAA8CL,KAApD;AACA,YAAM;AACJM,QAAAA,KAAK,EAAEC,UADH;AAEJC,QAAAA,MA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AAE,IAHD;AAIpBrB,EAAAA,UAAU,EAAE,OAJQ;AAKpBkE,EAAAA,SAAS,EAAE,EALS;AAMpBD,EAAAA,gBAAgB,EAAE,CANE;AAOpB+B,EAAAA,YAAY,EAAE,oBAPM;AAQpB/C,EAAAA,cAAc,EAAE,UARI;AASpBkF,EAAAA,8BAA8B,EAAE;AATZ,C;;gBAJH1I,Y,eAwDA;AACjB4I,EAAAA,IAAI,EAAE,MADW;AAEjBC,EAAAA,KAAK,EAAE;AAFU,C;;AAqcrB,MAAMpC,MAAM,GAAGrH,UAAU,CAAC0J,MAAX,CAAkB;AAC/Bb,EAAAA,eAAe,EAAE,EACf,GAAG7I,UAAU,CAAC2J,kBADC;AAEfC,IAAAA,MAAM,EAAE,IAFO;AAGftB,IAAAA,aAAa,EAAE;AAHA,GADc;AAM/BI,EAAAA,gBAAgB,EAAE,EAChB,GAAG1I,UAAU,CAAC2J,kBADE;AAEhBC,IAAAA,MAAM,EAAE;AAFQ,GANa;AAU/BnB,EAAAA,eAAe,EAAE,EACf,GAAGzI,UAAU,CAAC2J;AADC,GAVc;AAa/BpB,EAAAA,IAAI,EAAE;AACJsB,IAAAA,IAAI,EAAE,CADF;AAEJD,IAAAA,MAAM,EAAE,CAFJ;AAGJE,IAAAA,QAAQ,EAAE;AAHN,GAbyB;AAkB/BxC,EAAAA,OAAO,EAAE,EACP,GAAGtH,UAAU,CAAC2J,kBADP;AAEPC,IAAAA,MAAM,EAAE;AAFD;AAlBsB,CAAlB,CAAf","sourcesContent":["// This component is based on RN's DrawerLayoutAndroid API\n//\n// It perhaps deserves to be put in a separate repo, but since it relies on\n// react-native-gesture-handler library which isn't very popular at the moment I\n// decided to keep it here for the time being. It will allow us to move faster\n// and fix issues that may arise in gesture handler library that could be found\n// when using the drawer component\n\nimport * as React from 'react';\nimport { Component } from 'react';\nimport invariant from 'invariant';\nimport {\n Animated,\n StyleSheet,\n View,\n Keyboard,\n StatusBar,\n I18nManager,\n StatusBarAnimation,\n StyleProp,\n ViewStyle,\n LayoutChangeEvent,\n NativeSyntheticEvent,\n} from 'react-native';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport {\n PanGestureHandler,\n PanGestureHandlerEventPayload,\n} from '../handlers/PanGestureHandler';\nimport {\n TapGestureHandler,\n TapGestureHandlerEventPayload,\n} from '../handlers/TapGestureHandler';\nimport { State } from '../State';\n\nconst DRAG_TOSS = 0.05;\n\nconst IDLE: DrawerState = 'Idle';\nconst DRAGGING: DrawerState = 'Dragging';\nconst SETTLING: DrawerState = 'Settling';\n\nexport type DrawerPosition = 'left' | 'right';\n\nexport type DrawerState = 'Idle' | 'Dragging' | 'Settling';\n\nexport type DrawerType = 'front' | 'back' | 'slide';\n\nexport type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';\n\nexport type DrawerKeyboardDismissMode = 'none' | 'on-drag';\n\nexport interface DrawerLayoutProps {\n /**\n * This attribute is present in the standard implementation already and is one\n * of the required params. Gesture handler version of DrawerLayout make it\n * possible for the function passed as `renderNavigationView` to take an\n * Animated value as a parameter that indicates the progress of drawer\n * opening/closing animation (progress value is 0 when closed and 1 when\n * opened). This can be used by the drawer component to animated its children\n * while the drawer is opening or closing.\n */\n renderNavigationView: (\n progressAnimatedValue: Animated.Value\n ) => React.ReactNode;\n\n drawerPosition?: DrawerPosition;\n\n drawerWidth?: number;\n\n drawerBackgroundColor?: string;\n\n drawerLockMode?: DrawerLockMode;\n\n keyboardDismissMode?: DrawerKeyboardDismissMode;\n\n /**\n * Called when the drawer is closed.\n */\n onDrawerClose?: () => void;\n\n /**\n * Called when the drawer is opened.\n */\n onDrawerOpen?: () => void;\n\n /**\n * Called when the status of the drawer changes.\n */\n onDrawerStateChanged?: (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => void;\n useNativeAnimations?: boolean;\n\n drawerType?: DrawerType;\n\n /**\n * Defines how far from the edge of the content view the gesture should\n * activate.\n */\n edgeWidth?: number;\n\n minSwipeDistance?: number;\n\n /**\n * When set to true Drawer component will use\n * {@link https://reactnative.dev/docs/statusbar StatusBar} API to hide the OS\n * status bar whenever the drawer is pulled or when its in an \"open\" state.\n */\n hideStatusBar?: boolean;\n\n /**\n * @default 'slide'\n *\n * Can be used when hideStatusBar is set to true and will select the animation\n * used for hiding/showing the status bar. See\n * {@link https://reactnative.dev/docs/statusbar StatusBar} documentation for\n * more details\n */\n statusBarAnimation?: StatusBarAnimation;\n\n /**\n * @default black\n *\n * Color of a semi-transparent overlay to be displayed on top of the content\n * view when drawer gets open. A solid color should be used as the opacity is\n * added by the Drawer itself and the opacity of the overlay is animated (from\n * 0% to 70%).\n */\n overlayColor?: string;\n\n contentContainerStyle?: StyleProp;\n\n drawerContainerStyle?: StyleProp;\n\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n onDrawerSlide?: (position: number) => void;\n\n onGestureRef?: (ref: PanGestureHandler) => void;\n}\n\nexport type DrawerLayoutState = {\n dragX: Animated.Value;\n touchX: Animated.Value;\n drawerTranslation: Animated.Value;\n containerWidth: number;\n};\n\nexport type DrawerMovementOption = {\n velocity?: number;\n speed?: number;\n};\nexport default class DrawerLayout extends Component<\n DrawerLayoutProps,\n DrawerLayoutState\n> {\n static defaultProps = {\n drawerWidth: 200,\n drawerPosition: 'left',\n useNativeAnimations: true,\n drawerType: 'front',\n edgeWidth: 20,\n minSwipeDistance: 3,\n overlayColor: 'rgba(0, 0, 0, 0.7)',\n drawerLockMode: 'unlocked',\n enableTrackpadTwoFingerGesture: false,\n };\n\n constructor(props: DrawerLayoutProps) {\n super(props);\n\n const dragX = new Animated.Value(0);\n const touchX = new Animated.Value(0);\n const drawerTranslation = new Animated.Value(0);\n\n this.state = {\n dragX,\n touchX,\n drawerTranslation,\n containerWidth: 0,\n };\n\n this.updateAnimatedEvent(props, this.state);\n }\n\n UNSAFE_componentWillUpdate(\n props: DrawerLayoutProps,\n state: DrawerLayoutState\n ) {\n if (\n this.props.drawerPosition !== props.drawerPosition ||\n this.props.drawerWidth !== props.drawerWidth ||\n this.props.drawerType !== props.drawerType ||\n this.state.containerWidth !== state.containerWidth\n ) {\n this.updateAnimatedEvent(props, state);\n }\n }\n\n private openValue?: Animated.AnimatedInterpolation;\n private onGestureEvent?: (\n event: GestureEvent\n ) => void;\n private accessibilityIsModalView = React.createRef();\n private pointerEventsView = React.createRef();\n private panGestureHandler = React.createRef();\n private drawerShown = false;\n\n static positions = {\n Left: 'left',\n Right: 'right',\n };\n\n private updateAnimatedEvent = (\n props: DrawerLayoutProps,\n state: DrawerLayoutState\n ) => {\n // Event definition is based on\n const { drawerPosition, drawerWidth, drawerType } = props;\n const {\n dragX: dragXValue,\n touchX: touchXValue,\n drawerTranslation,\n containerWidth,\n } = state;\n\n let dragX = dragXValue;\n let touchX = touchXValue;\n\n if (drawerPosition !== 'left') {\n // Most of the code is written in a way to handle left-side drawer. In\n // order to handle right-side drawer the only thing we need to do is to\n // reverse events coming from gesture handler in a way they emulate\n // left-side drawer gestures. E.g. dragX is simply -dragX, and touchX is\n // calulcated by subtracing real touchX from the width of the container\n // (such that when touch happens at the right edge the value is simply 0)\n dragX = Animated.multiply(\n new Animated.Value(-1),\n dragXValue\n ) as Animated.Value; // TODO(TS): (for all \"as\" in this file) make sure we can map this\n touchX = Animated.add(\n new Animated.Value(containerWidth),\n Animated.multiply(new Animated.Value(-1), touchXValue)\n ) as Animated.Value; // TODO(TS): make sure we can map this;\n touchXValue.setValue(containerWidth);\n } else {\n touchXValue.setValue(0);\n }\n\n // While closing the drawer when user starts gesture outside of its area (in greyed\n // out part of the window), we want the drawer to follow only once finger reaches the\n // edge of the drawer.\n // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by\n // dots. The touch gesture starts at '*' and moves left, touch path is indicated by\n // an arrow pointing left\n // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // +---------------+ +---------------+ +---------------+ +---------------+\n //\n // For the above to work properly we define animated value that will keep\n // start position of the gesture. Then we use that value to calculate how\n // much we need to subtract from the dragX. If the gesture started on the\n // greyed out area we take the distance from the edge of the drawer to the\n // start position. Otherwise we don't subtract at all and the drawer be\n // pulled back as soon as you start the pan.\n //\n // This is used only when drawerType is \"front\"\n //\n let translationX = dragX;\n if (drawerType === 'front') {\n const startPositionX = Animated.add(\n touchX,\n Animated.multiply(new Animated.Value(-1), dragX)\n );\n\n const dragOffsetFromOnStartPosition = startPositionX.interpolate({\n inputRange: [drawerWidth! - 1, drawerWidth!, drawerWidth! + 1],\n outputRange: [0, 0, 1],\n });\n translationX = Animated.add(\n dragX,\n dragOffsetFromOnStartPosition\n ) as Animated.Value; // TODO: as above\n }\n\n this.openValue = Animated.add(translationX, drawerTranslation).interpolate({\n inputRange: [0, drawerWidth!],\n outputRange: [0, 1],\n extrapolate: 'clamp',\n });\n\n const gestureOptions: {\n useNativeDriver: boolean;\n // TODO: make sure it is correct\n listener?: (\n ev: NativeSyntheticEvent\n ) => void;\n } = {\n useNativeDriver: props.useNativeAnimations!,\n };\n\n if (this.props.onDrawerSlide) {\n gestureOptions.listener = (ev) => {\n const translationX = Math.floor(Math.abs(ev.nativeEvent.translationX));\n const position = translationX / this.state.containerWidth;\n\n this.props.onDrawerSlide?.(position);\n };\n }\n\n this.onGestureEvent = Animated.event(\n [{ nativeEvent: { translationX: dragXValue, x: touchXValue } }],\n gestureOptions\n );\n };\n\n private handleContainerLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n this.setState({ containerWidth: nativeEvent.layout.width });\n };\n\n private emitStateChanged = (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => {\n this.props.onDrawerStateChanged?.(newState, drawerWillShow);\n };\n\n private openingHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent) => {\n if (nativeEvent.oldState === State.ACTIVE) {\n this.handleRelease({ nativeEvent });\n } else if (nativeEvent.state === State.ACTIVE) {\n this.emitStateChanged(DRAGGING, false);\n if (this.props.keyboardDismissMode === 'on-drag') {\n Keyboard.dismiss();\n }\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(true, this.props.statusBarAnimation || 'slide');\n }\n }\n };\n\n private onTapHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent) => {\n if (\n this.drawerShown &&\n nativeEvent.oldState === State.ACTIVE &&\n this.props.drawerLockMode !== 'locked-open'\n ) {\n this.closeDrawer();\n }\n };\n\n private handleRelease = ({\n nativeEvent,\n }: HandlerStateChangeEvent) => {\n const { drawerWidth, drawerPosition, drawerType } = this.props;\n const { containerWidth } = this.state;\n let { translationX: dragX, velocityX, x: touchX } = nativeEvent;\n\n if (drawerPosition !== 'left') {\n // See description in _updateAnimatedEvent about why events are flipped\n // for right-side drawer\n dragX = -dragX;\n touchX = containerWidth - touchX;\n velocityX = -velocityX;\n }\n\n const gestureStartX = touchX - dragX;\n let dragOffsetBasedOnStart = 0;\n\n if (drawerType === 'front') {\n dragOffsetBasedOnStart =\n gestureStartX > drawerWidth! ? gestureStartX - drawerWidth! : 0;\n }\n\n const startOffsetX =\n dragX + dragOffsetBasedOnStart + (this.drawerShown ? drawerWidth! : 0);\n const projOffsetX = startOffsetX + DRAG_TOSS * velocityX;\n\n const shouldOpen = projOffsetX > drawerWidth! / 2;\n\n if (shouldOpen) {\n this.animateDrawer(startOffsetX, drawerWidth!, velocityX);\n } else {\n this.animateDrawer(startOffsetX, 0, velocityX);\n }\n };\n\n private updateShowing = (showing: boolean) => {\n this.drawerShown = showing;\n this.accessibilityIsModalView.current?.setNativeProps({\n accessibilityViewIsModal: showing,\n });\n this.pointerEventsView.current?.setNativeProps({\n pointerEvents: showing ? 'auto' : 'none',\n });\n const { drawerPosition, minSwipeDistance, edgeWidth } = this.props;\n const fromLeft = drawerPosition === 'left';\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: showing ? undefined : edgeWidth }\n : { right: 0, width: showing ? undefined : edgeWidth };\n // @ts-ignore internal API, maybe could be fixed in handler types\n this.panGestureHandler.current?.setNativeProps({\n hitSlop,\n activeOffsetX: gestureOrientation * minSwipeDistance!,\n });\n };\n\n private animateDrawer = (\n fromValue: number | null | undefined,\n toValue: number,\n velocity: number,\n speed?: number\n ) => {\n this.state.dragX.setValue(0);\n this.state.touchX.setValue(\n this.props.drawerPosition === 'left' ? 0 : this.state.containerWidth\n );\n\n if (fromValue != null) {\n let nextFramePosition = fromValue;\n if (this.props.useNativeAnimations) {\n // When using native driver, we predict the next position of the\n // animation because it takes one frame of a roundtrip to pass RELEASE\n // event from native driver to JS before we can start animating. Without\n // it, it is more noticable that the frame is dropped.\n if (fromValue < toValue && velocity > 0) {\n nextFramePosition = Math.min(fromValue + velocity / 60.0, toValue);\n } else if (fromValue > toValue && velocity < 0) {\n nextFramePosition = Math.max(fromValue + velocity / 60.0, toValue);\n }\n }\n this.state.drawerTranslation.setValue(nextFramePosition);\n }\n\n const willShow = toValue !== 0;\n this.updateShowing(willShow);\n this.emitStateChanged(SETTLING, willShow);\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');\n }\n Animated.spring(this.state.drawerTranslation, {\n velocity,\n bounciness: 0,\n toValue,\n useNativeDriver: this.props.useNativeAnimations!,\n speed: speed ?? undefined,\n }).start(({ finished }) => {\n if (finished) {\n this.emitStateChanged(IDLE, willShow);\n if (willShow) {\n this.props.onDrawerOpen?.();\n } else {\n this.props.onDrawerClose?.();\n }\n }\n });\n };\n\n openDrawer = (options: DrawerMovementOption = {}) => {\n this.animateDrawer(\n // TODO: decide if it should be null or undefined is the proper value\n undefined,\n this.props.drawerWidth!,\n options.velocity ? options.velocity : 0\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would not be clickable\n this.forceUpdate();\n };\n\n closeDrawer = (options: DrawerMovementOption = {}) => {\n // TODO: decide if it should be null or undefined is the proper value\n this.animateDrawer(undefined, 0, options.velocity ? options.velocity : 0);\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would be still clickable\n this.forceUpdate();\n };\n\n private renderOverlay = () => {\n /* Overlay styles */\n invariant(this.openValue, 'should be set');\n const overlayOpacity = this.openValue.interpolate({\n inputRange: [0, 1],\n outputRange: [0, 1],\n extrapolate: 'clamp',\n });\n const dynamicOverlayStyles = {\n opacity: overlayOpacity,\n backgroundColor: this.props.overlayColor,\n };\n\n return (\n \n \n \n );\n };\n\n private renderDrawer = () => {\n const {\n drawerBackgroundColor,\n drawerWidth,\n drawerPosition,\n drawerType,\n drawerContainerStyle,\n contentContainerStyle,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n const drawerSlide = drawerType !== 'back';\n const containerSlide = drawerType !== 'front';\n\n // we rely on row and row-reverse flex directions to position the drawer\n // properly. Apparently for RTL these are flipped which requires us to use\n // the opposite setting for the drawer to appear from left or right\n // according to the drawerPosition prop\n const reverseContentDirection = I18nManager.isRTL ? fromLeft : !fromLeft;\n\n const dynamicDrawerStyles = {\n backgroundColor: drawerBackgroundColor,\n width: drawerWidth,\n };\n const openValue = this.openValue;\n invariant(openValue, 'should be set');\n\n let containerStyles;\n if (containerSlide) {\n const containerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: fromLeft ? [0, drawerWidth!] : [0, -drawerWidth!],\n extrapolate: 'clamp',\n });\n containerStyles = {\n transform: [{ translateX: containerTranslateX }],\n };\n }\n\n let drawerTranslateX: number | Animated.AnimatedInterpolation = 0;\n if (drawerSlide) {\n const closedDrawerOffset = fromLeft ? -drawerWidth! : drawerWidth!;\n drawerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: [closedDrawerOffset, 0],\n extrapolate: 'clamp',\n });\n }\n const drawerStyles: {\n transform: { translateX: number | Animated.AnimatedInterpolation }[];\n flexDirection: 'row-reverse' | 'row';\n } = {\n transform: [{ translateX: drawerTranslateX }],\n flexDirection: reverseContentDirection ? 'row-reverse' : 'row',\n };\n\n return (\n \n \n {typeof this.props.children === 'function'\n ? this.props.children(this.openValue)\n : this.props.children}\n {this.renderOverlay()}\n \n \n \n {this.props.renderNavigationView(this.openValue as Animated.Value)}\n \n \n \n );\n };\n\n private setPanGestureRef = (ref: PanGestureHandler) => {\n // TODO(TS): make sure it is OK taken from\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-596081842\n (this\n .panGestureHandler as React.MutableRefObject).current = ref;\n this.props.onGestureRef?.(ref);\n };\n\n render() {\n const {\n drawerPosition,\n drawerLockMode,\n edgeWidth,\n minSwipeDistance,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: this.drawerShown ? undefined : edgeWidth }\n : { right: 0, width: this.drawerShown ? undefined : edgeWidth };\n\n return (\n \n {this.renderDrawer()}\n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n drawerContainer: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1001,\n flexDirection: 'row',\n },\n containerInFront: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1002,\n },\n containerOnBack: {\n ...StyleSheet.absoluteFillObject,\n },\n main: {\n flex: 1,\n zIndex: 0,\n overflow: 'hidden',\n },\n overlay: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1000,\n },\n});\n"]}
\ No newline at end of file
diff --git a/lib/module/components/GestureButtons.js b/lib/module/components/GestureButtons.js
new file mode 100644
index 0000000000..a806bcd466
--- /dev/null
+++ b/lib/module/components/GestureButtons.js
@@ -0,0 +1,172 @@
+function _extends() { _extends = Object.assign || 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); }
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+import * as React from 'react';
+import { Animated, Platform, processColor, StyleSheet } from 'react-native';
+import createNativeWrapper from '../handlers/createNativeWrapper';
+import GestureHandlerButton from './GestureHandlerButton';
+import { State } from '../State';
+export const RawButton = createNativeWrapper(GestureHandlerButton, {
+ shouldCancelWhenOutside: false,
+ shouldActivateOnStart: false
+});
+export class BaseButton extends React.Component {
+ constructor(props) {
+ super(props);
+
+ _defineProperty(this, "lastActive", void 0);
+
+ _defineProperty(this, "handleEvent", ({
+ nativeEvent
+ }) => {
+ const {
+ state,
+ oldState,
+ pointerInside
+ } = nativeEvent;
+ const active = pointerInside && state === State.ACTIVE;
+
+ if (active !== this.lastActive && this.props.onActiveStateChange) {
+ this.props.onActiveStateChange(active);
+ }
+
+ if (oldState === State.ACTIVE && state !== State.CANCELLED && this.lastActive && this.props.onPress) {
+ this.props.onPress(active);
+ }
+
+ this.lastActive = active;
+ });
+
+ _defineProperty(this, "onHandlerStateChange", e => {
+ var _this$props$onHandler, _this$props;
+
+ (_this$props$onHandler = (_this$props = this.props).onHandlerStateChange) === null || _this$props$onHandler === void 0 ? void 0 : _this$props$onHandler.call(_this$props, e);
+ this.handleEvent(e);
+ });
+
+ _defineProperty(this, "onGestureEvent", e => {
+ var _this$props$onGesture, _this$props2;
+
+ (_this$props$onGesture = (_this$props2 = this.props).onGestureEvent) === null || _this$props$onGesture === void 0 ? void 0 : _this$props$onGesture.call(_this$props2, e);
+ this.handleEvent(e); // TODO: maybe it is not correct
+ });
+
+ this.lastActive = false;
+ }
+
+ render() {
+ const {
+ rippleColor,
+ ...rest
+ } = this.props;
+ return /*#__PURE__*/React.createElement(RawButton, _extends({
+ rippleColor: processColor(rippleColor)
+ }, rest, {
+ onGestureEvent: this.onGestureEvent,
+ onHandlerStateChange: this.onHandlerStateChange
+ }));
+ }
+
+}
+const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
+const btnStyles = StyleSheet.create({
+ underlay: {
+ position: 'absolute',
+ left: 0,
+ right: 0,
+ bottom: 0,
+ top: 0
+ }
+});
+export class RectButton extends React.Component {
+ constructor(props) {
+ super(props);
+
+ _defineProperty(this, "opacity", void 0);
+
+ _defineProperty(this, "onActiveStateChange", active => {
+ var _this$props$onActiveS, _this$props3;
+
+ if (Platform.OS !== 'android') {
+ this.opacity.setValue(active ? this.props.activeOpacity : 0);
+ }
+
+ (_this$props$onActiveS = (_this$props3 = this.props).onActiveStateChange) === null || _this$props$onActiveS === void 0 ? void 0 : _this$props$onActiveS.call(_this$props3, active);
+ });
+
+ this.opacity = new Animated.Value(0);
+ }
+
+ render() {
+ const {
+ children,
+ style,
+ ...rest
+ } = this.props;
+ const resolvedStyle = StyleSheet.flatten(style !== null && style !== void 0 ? style : {});
+ return /*#__PURE__*/React.createElement(BaseButton, _extends({}, rest, {
+ style: resolvedStyle,
+ onActiveStateChange: this.onActiveStateChange
+ }), /*#__PURE__*/React.createElement(Animated.View, {
+ style: [btnStyles.underlay, {
+ opacity: this.opacity,
+ backgroundColor: this.props.underlayColor,
+ borderRadius: resolvedStyle.borderRadius,
+ borderTopLeftRadius: resolvedStyle.borderTopLeftRadius,
+ borderTopRightRadius: resolvedStyle.borderTopRightRadius,
+ borderBottomLeftRadius: resolvedStyle.borderBottomLeftRadius,
+ borderBottomRightRadius: resolvedStyle.borderBottomRightRadius
+ }]
+ }), children);
+ }
+
+}
+
+_defineProperty(RectButton, "defaultProps", {
+ activeOpacity: 0.105,
+ underlayColor: 'black'
+});
+
+export class BorderlessButton extends React.Component {
+ constructor(props) {
+ super(props);
+
+ _defineProperty(this, "opacity", void 0);
+
+ _defineProperty(this, "onActiveStateChange", active => {
+ var _this$props$onActiveS2, _this$props4;
+
+ if (Platform.OS !== 'android') {
+ this.opacity.setValue(active ? this.props.activeOpacity : 1);
+ }
+
+ (_this$props$onActiveS2 = (_this$props4 = this.props).onActiveStateChange) === null || _this$props$onActiveS2 === void 0 ? void 0 : _this$props$onActiveS2.call(_this$props4, active);
+ });
+
+ this.opacity = new Animated.Value(1);
+ }
+
+ render() {
+ const {
+ children,
+ style,
+ ...rest
+ } = this.props;
+ return /*#__PURE__*/React.createElement(AnimatedBaseButton, _extends({}, rest, {
+ onActiveStateChange: this.onActiveStateChange,
+ style: [style, Platform.OS === 'ios' && {
+ opacity: this.opacity
+ }]
+ }), children);
+ }
+
+}
+
+_defineProperty(BorderlessButton, "defaultProps", {
+ activeOpacity: 0.3,
+ borderless: true
+});
+
+export { default as PureNativeButton } from './GestureHandlerButton';
+//# sourceMappingURL=GestureButtons.js.map
\ No newline at end of file
diff --git a/lib/module/components/GestureButtons.js.map b/lib/module/components/GestureButtons.js.map
new file mode 100644
index 0000000000..5b9832f524
--- /dev/null
+++ b/lib/module/components/GestureButtons.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["GestureButtons.tsx"],"names":["React","Animated","Platform","processColor","StyleSheet","createNativeWrapper","GestureHandlerButton","State","RawButton","shouldCancelWhenOutside","shouldActivateOnStart","BaseButton","Component","constructor","props","nativeEvent","state","oldState","pointerInside","active","ACTIVE","lastActive","onActiveStateChange","CANCELLED","onPress","e","onHandlerStateChange","handleEvent","onGestureEvent","render","rippleColor","rest","AnimatedBaseButton","createAnimatedComponent","btnStyles","create","underlay","position","left","right","bottom","top","RectButton","OS","opacity","setValue","activeOpacity","Value","children","style","resolvedStyle","flatten","backgroundColor","underlayColor","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","BorderlessButton","borderless","default","PureNativeButton"],"mappings":";;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,QADF,EAEEC,QAFF,EAGEC,YAHF,EAIEC,UAJF,QAOO,cAPP;AASA,OAAOC,mBAAP,MAAgC,iCAAhC;AACA,OAAOC,oBAAP,MAAiC,wBAAjC;AACA,SAASC,KAAT,QAAsB,UAAtB;AA0EA,OAAO,MAAMC,SAAS,GAAGH,mBAAmB,CAACC,oBAAD,EAAuB;AACjEG,EAAAA,uBAAuB,EAAE,KADwC;AAEjEC,EAAAA,qBAAqB,EAAE;AAF0C,CAAvB,CAArC;AAKP,OAAO,MAAMC,UAAN,SAAyBX,KAAK,CAACY,SAA/B,CAA0D;AAG/DC,EAAAA,WAAW,CAACC,KAAD,EAAyB;AAClC,UAAMA,KAAN;;AADkC;;AAAA,yCAKd,CAAC;AACrBC,MAAAA;AADqB,KAAD,KAE0C;AAC9D,YAAM;AAAEC,QAAAA,KAAF;AAASC,QAAAA,QAAT;AAAmBC,QAAAA;AAAnB,UAAqCH,WAA3C;AACA,YAAMI,MAAM,GAAGD,aAAa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EpBc,EAAAA,UAAU,EAAE;AAFQ,C;;AAkCxB,SAASC,OAAO,IAAIC,gBAApB,QAA4C,wBAA5C","sourcesContent":["import * as React from 'react';\nimport {\n Animated,\n Platform,\n processColor,\n StyleSheet,\n StyleProp,\n ViewStyle,\n} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\nimport GestureHandlerButton from './GestureHandlerButton';\nimport { State } from '../State';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport {\n NativeViewGestureHandlerPayload,\n NativeViewGestureHandlerProps,\n} from '../handlers/NativeViewGestureHandler';\n\nexport interface RawButtonProps extends NativeViewGestureHandlerProps {\n /**\n * Defines if more than one button could be pressed simultaneously. By default\n * set true.\n */\n exclusive?: boolean;\n // TODO: we should transform props in `createNativeWrapper`\n\n /**\n * Android only.\n *\n * Defines color of native ripple animation used since API level 21.\n */\n rippleColor?: any; // it was present in BaseButtonProps before but is used here in code\n}\n\nexport interface BaseButtonProps extends RawButtonProps {\n /**\n * Called when the button gets pressed (analogous to `onPress` in\n * `TouchableHighlight` from RN core).\n */\n onPress?: (pointerInside: boolean) => void;\n\n /**\n * Called when button changes from inactive to active and vice versa. It\n * passes active state as a boolean variable as a first parameter for that\n * method.\n */\n onActiveStateChange?: (active: boolean) => void;\n style?: StyleProp;\n testID?: string;\n}\n\nexport interface RectButtonProps extends BaseButtonProps {\n /**\n * Background color that will be dimmed when button is in active state.\n */\n underlayColor?: string;\n\n /**\n * iOS only.\n *\n * Opacity applied to the underlay when button is in active state.\n */\n activeOpacity?: number;\n}\n\nexport interface BorderlessButtonProps extends BaseButtonProps {\n /**\n * Android only.\n *\n * Set this to false if you want the ripple animation to render only within view bounds.\n */\n borderless?: boolean;\n\n /**\n * iOS only.\n *\n * Opacity applied to the button when it is in an active state.\n */\n activeOpacity?: number;\n}\n\nexport const RawButton = createNativeWrapper(GestureHandlerButton, {\n shouldCancelWhenOutside: false,\n shouldActivateOnStart: false,\n});\n\nexport class BaseButton extends React.Component {\n private lastActive: boolean;\n\n constructor(props: BaseButtonProps) {\n super(props);\n this.lastActive = false;\n }\n\n private handleEvent = ({\n nativeEvent,\n }: HandlerStateChangeEvent) => {\n const { state, oldState, pointerInside } = nativeEvent;\n const active = pointerInside && state === State.ACTIVE;\n\n if (active !== this.lastActive && this.props.onActiveStateChange) {\n this.props.onActiveStateChange(active);\n }\n\n if (\n oldState === State.ACTIVE &&\n state !== State.CANCELLED &&\n this.lastActive &&\n this.props.onPress\n ) {\n this.props.onPress(active);\n }\n\n this.lastActive = active;\n };\n\n // Normally, the parent would execute it's handler first, then forward the\n // event to listeners. However, here our handler is virtually only forwarding\n // events to listeners, so we reverse the order to keep the proper order of\n // the callbacks (from \"raw\" ones to \"processed\").\n private onHandlerStateChange = (\n e: HandlerStateChangeEvent\n ) => {\n this.props.onHandlerStateChange?.(e);\n this.handleEvent(e);\n };\n\n private onGestureEvent = (\n e: GestureEvent\n ) => {\n this.props.onGestureEvent?.(e);\n this.handleEvent(\n e as HandlerStateChangeEvent\n ); // TODO: maybe it is not correct\n };\n\n render() {\n const { rippleColor, ...rest } = this.props;\n\n return (\n \n );\n }\n}\n\nconst AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);\n\nconst btnStyles = StyleSheet.create({\n underlay: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n top: 0,\n },\n});\n\nexport class RectButton extends React.Component {\n static defaultProps = {\n activeOpacity: 0.105,\n underlayColor: 'black',\n };\n\n private opacity: Animated.Value;\n\n constructor(props: RectButtonProps) {\n super(props);\n this.opacity = new Animated.Value(0);\n }\n\n private onActiveStateChange = (active: boolean) => {\n if (Platform.OS !== 'android') {\n this.opacity.setValue(active ? this.props.activeOpacity! : 0);\n }\n\n this.props.onActiveStateChange?.(active);\n };\n\n render() {\n const { children, style, ...rest } = this.props;\n\n const resolvedStyle = StyleSheet.flatten(style ?? {});\n\n return (\n \n \n {children}\n \n );\n }\n}\n\nexport class BorderlessButton extends React.Component {\n static defaultProps = {\n activeOpacity: 0.3,\n borderless: true,\n };\n\n private opacity: Animated.Value;\n\n constructor(props: BorderlessButtonProps) {\n super(props);\n this.opacity = new Animated.Value(1);\n }\n\n private onActiveStateChange = (active: boolean) => {\n if (Platform.OS !== 'android') {\n this.opacity.setValue(active ? this.props.activeOpacity! : 1);\n }\n\n this.props.onActiveStateChange?.(active);\n };\n\n render() {\n const { children, style, ...rest } = this.props;\n\n return (\n \n {children}\n \n );\n }\n}\n\nexport { default as PureNativeButton } from './GestureHandlerButton';\n"]}
\ No newline at end of file
diff --git a/lib/module/components/GestureComponents.js b/lib/module/components/GestureComponents.js
new file mode 100644
index 0000000000..fa887c2b33
--- /dev/null
+++ b/lib/module/components/GestureComponents.js
@@ -0,0 +1,53 @@
+function _extends() { _extends = Object.assign || 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); }
+
+import * as React from 'react';
+import { ScrollView as RNScrollView, Switch as RNSwitch, TextInput as RNTextInput, DrawerLayoutAndroid as RNDrawerLayoutAndroid, FlatList as RNFlatList } from 'react-native';
+import createNativeWrapper from '../handlers/createNativeWrapper';
+import { nativeViewProps } from '../handlers/NativeViewGestureHandler';
+export const ScrollView = createNativeWrapper(RNScrollView, {
+ disallowInterruption: true,
+ shouldCancelWhenOutside: false
+}); // backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
+// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+
+export const Switch = createNativeWrapper(RNSwitch, {
+ shouldCancelWhenOutside: false,
+ shouldActivateOnStart: true,
+ disallowInterruption: true
+}); // eslint-disable-next-line @typescript-eslint/no-redeclare
+
+export const TextInput = createNativeWrapper(RNTextInput); // eslint-disable-next-line @typescript-eslint/no-redeclare
+
+export const DrawerLayoutAndroid = createNativeWrapper(RNDrawerLayoutAndroid, {
+ disallowInterruption: true
+}); // eslint-disable-next-line @typescript-eslint/no-redeclare
+
+export const FlatList = /*#__PURE__*/React.forwardRef((props, ref) => {
+ const flatListProps = {};
+ const scrollViewProps = {};
+
+ for (const [propName, value] of Object.entries(props)) {
+ // https://github.com/microsoft/TypeScript/issues/26255
+ if (nativeViewProps.includes(propName)) {
+ // @ts-ignore - this function cannot have generic type so we have to ignore this error
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ scrollViewProps[propName] = value;
+ } else {
+ // @ts-ignore - this function cannot have generic type so we have to ignore this error
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ flatListProps[propName] = value;
+ }
+ }
+
+ return (
+ /*#__PURE__*/
+ // @ts-ignore - this function cannot have generic type so we have to ignore this error
+ React.createElement(RNFlatList, _extends({
+ ref: ref
+ }, flatListProps, {
+ renderScrollComponent: scrollProps => /*#__PURE__*/React.createElement(ScrollView, _extends({}, scrollProps, scrollViewProps))
+ }))
+ );
+}); // eslint-disable-next-line @typescript-eslint/no-redeclare
+//# sourceMappingURL=GestureComponents.js.map
\ No newline at end of file
diff --git a/lib/module/components/GestureComponents.js.map b/lib/module/components/GestureComponents.js.map
new file mode 100644
index 0000000000..ccd5bf3e05
--- /dev/null
+++ b/lib/module/components/GestureComponents.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["GestureComponents.tsx"],"names":["React","ScrollView","RNScrollView","Switch","RNSwitch","TextInput","RNTextInput","DrawerLayoutAndroid","RNDrawerLayoutAndroid","FlatList","RNFlatList","createNativeWrapper","nativeViewProps","disallowInterruption","shouldCancelWhenOutside","shouldActivateOnStart","forwardRef","props","ref","flatListProps","scrollViewProps","propName","value","Object","entries","includes","scrollProps"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAOA,SACEC,UAAU,IAAI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AA1B;AACD;AACF;;AACD;AAAA;AACE;AACA,wBAAC,UAAD;AACE,MAAA,GAAG,EAAEJ;AADP,OAEMC,aAFN;AAGE,MAAA,qBAAqB,EAAGO,WAAD,iBACrB,oBAAC,UAAD,eAAqBA,WAArB,EAAqCN,eAArC;AAJJ;AAFF;AAUD,CAzBuB,CAAjB,C,CAiCP","sourcesContent":["import * as React from 'react';\nimport {\n PropsWithChildren,\n ForwardedRef,\n RefAttributes,\n ReactElement,\n} from 'react';\nimport {\n ScrollView as RNScrollView,\n ScrollViewProps as RNScrollViewProps,\n Switch as RNSwitch,\n SwitchProps as RNSwitchProps,\n TextInput as RNTextInput,\n TextInputProps as RNTextInputProps,\n DrawerLayoutAndroid as RNDrawerLayoutAndroid,\n DrawerLayoutAndroidProps as RNDrawerLayoutAndroidProps,\n FlatList as RNFlatList,\n FlatListProps as RNFlatListProps,\n} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\n\nimport {\n NativeViewGestureHandlerProps,\n nativeViewProps,\n} from '../handlers/NativeViewGestureHandler';\n\nexport const ScrollView = createNativeWrapper<\n PropsWithChildren\n>(RNScrollView, {\n disallowInterruption: true,\n shouldCancelWhenOutside: false,\n});\n// backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457\n// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type ScrollView = typeof ScrollView & RNScrollView;\n\nexport const Switch = createNativeWrapper(RNSwitch, {\n shouldCancelWhenOutside: false,\n shouldActivateOnStart: true,\n disallowInterruption: true,\n});\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type Switch = typeof Switch & RNSwitch;\n\nexport const TextInput = createNativeWrapper(RNTextInput);\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type TextInput = typeof TextInput & RNTextInput;\n\nexport const DrawerLayoutAndroid = createNativeWrapper<\n PropsWithChildren\n>(RNDrawerLayoutAndroid, { disallowInterruption: true });\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DrawerLayoutAndroid = typeof DrawerLayoutAndroid &\n RNDrawerLayoutAndroid;\n\nexport const FlatList = React.forwardRef((props, ref) => {\n const flatListProps = {};\n const scrollViewProps = {};\n for (const [propName, value] of Object.entries(props)) {\n // https://github.com/microsoft/TypeScript/issues/26255\n if ((nativeViewProps as readonly string[]).includes(propName)) {\n // @ts-ignore - this function cannot have generic type so we have to ignore this error\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n scrollViewProps[propName] = value;\n } else {\n // @ts-ignore - this function cannot have generic type so we have to ignore this error\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n flatListProps[propName] = value;\n }\n }\n return (\n // @ts-ignore - this function cannot have generic type so we have to ignore this error\n (\n \n )}\n />\n );\n}) as (\n props: PropsWithChildren<\n RNFlatListProps &\n RefAttributes> &\n NativeViewGestureHandlerProps\n >,\n ref: ForwardedRef>\n) => ReactElement | null;\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type FlatList = typeof FlatList & RNFlatList;\n"]}
\ No newline at end of file
diff --git a/lib/module/components/GestureComponents.web.js b/lib/module/components/GestureComponents.web.js
new file mode 100644
index 0000000000..1d1b06afc8
--- /dev/null
+++ b/lib/module/components/GestureComponents.web.js
@@ -0,0 +1,25 @@
+function _extends() { _extends = Object.assign || 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); }
+
+import * as React from 'react';
+import { DrawerLayoutAndroid as RNDrawerLayoutAndroid, FlatList as RNFlatList, Switch as RNSwitch, TextInput as RNTextInput, ScrollView as RNScrollView } from 'react-native';
+import createNativeWrapper from '../handlers/createNativeWrapper';
+export const ScrollView = createNativeWrapper(RNScrollView, {
+ disallowInterruption: true
+});
+export const Switch = createNativeWrapper(RNSwitch, {
+ shouldCancelWhenOutside: false,
+ shouldActivateOnStart: true,
+ disallowInterruption: true
+});
+export const TextInput = createNativeWrapper(RNTextInput);
+export const DrawerLayoutAndroid = createNativeWrapper(RNDrawerLayoutAndroid, {
+ disallowInterruption: true
+}); // @ts-ignore -- TODO(TS) to investigate if it's needed
+
+DrawerLayoutAndroid.positions = RNDrawerLayoutAndroid.positions;
+export const FlatList = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(RNFlatList, _extends({
+ ref: ref
+}, props, {
+ renderScrollComponent: scrollProps => /*#__PURE__*/React.createElement(ScrollView, scrollProps)
+})));
+//# sourceMappingURL=GestureComponents.web.js.map
\ No newline at end of file
diff --git a/lib/module/components/GestureComponents.web.js.map b/lib/module/components/GestureComponents.web.js.map
new file mode 100644
index 0000000000..535b691ac1
--- /dev/null
+++ b/lib/module/components/GestureComponents.web.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["GestureComponents.web.tsx"],"names":["React","DrawerLayoutAndroid","RNDrawerLayoutAndroid","FlatList","RNFlatList","Switch","RNSwitch","TextInput","RNTextInput","ScrollView","RNScrollView","createNativeWrapper","disallowInterruption","shouldCancelWhenOutside","shouldActivateOnStart","positions","forwardRef","props","ref","scrollProps"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,mBAAmB,IAAIC,qBADzB,EAEEC,QAAQ,IAAIC,UAFd,EAGEC,MAAM,IAAIC,QAHZ,EAIEC,SAAS,IAAIC,WAJf,EAKEC,UAAU,IAAIC,YALhB,QAOO,cAPP;AASA,OAAOC,mBAAP,MAAgC,iCAAhC;AAEA,OAAO,MAAMF,UAAU,GAAGE,mBAAmB,CAACD,YAAD,EAAe;AAC1DE,EAAAA,oBAAoB,EAAE;AADoC,CAAf,CAAtC;AAIP,OAAO,MAAMP,MAAM,GAAGM,mBAAmB,CAACL,QAAD,EAAW;AAClDO,EAAAA,uBAAuB,EAAE,KADyB;AAElDC,EAAAA,qBAAqB,EAAE,IAF2B;AAGlDF,EAAAA,oBAAoB,EAAE;AAH4B,CAAX,CAAlC;AAKP,OAAO,MAAML,SAAS,GAAGI,mBAAmB,CAACH,WAAD,CAArC;AACP,OAAO,MAAMP,mBAAmB,GAAGU,mBAAmB,CAACT,qBAAD,EAAwB;AAC5EU,EAAAA,oBAAoB,EAAE;AADsD,CAAxB,CAA/C,C,CAGP;;AACAX,mBAAmB,CAACc,SAApB,GAAgCb,qBAAqB,CAACa,SAAtD;AAEA,OAAO,MAAMZ,QAAQ,gBAAGH,KAAK,CAACgB,UAAN,CACtB,CAAoBC,KAApB,EAAiDC,GAAjD,kBACE,oBAAC,UAAD;AACE,EAAA,GAAG,EAAEA;AADP,GAEMD,KAFN;AAGE,EAAA,qBAAqB,EAAGE,WAAD,iBAAiB,oBAAC,UAAD,EAAgBA,WAAhB;AAH1C,GAFoB,CAAjB","sourcesContent":["import * as React from 'react';\nimport {\n DrawerLayoutAndroid as RNDrawerLayoutAndroid,\n FlatList as RNFlatList,\n Switch as RNSwitch,\n TextInput as RNTextInput,\n ScrollView as RNScrollView,\n FlatListProps,\n} from 'react-native';\n\nimport createNativeWrapper from '../handlers/createNativeWrapper';\n\nexport const ScrollView = createNativeWrapper(RNScrollView, {\n disallowInterruption: true,\n});\n\nexport const Switch = createNativeWrapper(RNSwitch, {\n shouldCancelWhenOutside: false,\n shouldActivateOnStart: true,\n disallowInterruption: true,\n});\nexport const TextInput = createNativeWrapper(RNTextInput);\nexport const DrawerLayoutAndroid = createNativeWrapper(RNDrawerLayoutAndroid, {\n disallowInterruption: true,\n});\n// @ts-ignore -- TODO(TS) to investigate if it's needed\nDrawerLayoutAndroid.positions = RNDrawerLayoutAndroid.positions;\n\nexport const FlatList = React.forwardRef(\n (props: FlatListProps