@tamagui/web 3.0.0-beta.1420.1 → 3.0.0-beta.1432.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.cjs +8 -0
- package/dist/cjs/createComponent.native.cjs +12 -0
- package/dist/cjs/createComponent.native.js +12 -0
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/eventHandling.native.cjs +26 -14
- package/dist/cjs/eventHandling.native.js +26 -14
- package/dist/cjs/eventHandling.native.js.map +1 -1
- package/dist/cjs/helpers/mainThreadPressEvents.native.cjs +47 -26
- package/dist/cjs/helpers/mainThreadPressEvents.native.js +47 -26
- package/dist/cjs/helpers/mainThreadPressEvents.native.js.map +1 -1
- package/dist/esm/createComponent.mjs +8 -0
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +12 -0
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/eventHandling.native.js +26 -14
- package/dist/esm/eventHandling.native.js.map +1 -1
- package/dist/esm/helpers/mainThreadPressEvents.native.js +48 -27
- package/dist/esm/helpers/mainThreadPressEvents.native.js.map +1 -1
- package/package.json +16 -16
- package/src/createComponent.tsx +17 -0
- package/src/eventHandling.native.ts +37 -8
- package/src/helpers/mainThreadPressEvents.native.ts +70 -25
- package/src/types.tsx +3 -0
- package/types/createComponent.d.ts.map +1 -1
- package/types/eventHandling.native.d.ts.map +1 -1
- package/types/helpers/mainThreadPressEvents.native.d.ts.map +1 -1
- package/types/types.d.ts +1 -0
- package/types/types.d.ts.map +1 -1
|
@@ -118,6 +118,21 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
118
118
|
if (isUsingRNGH) {
|
|
119
119
|
var callbacksRef = (0, import_react.useRef)(isUsingRNGH ? {} : null);
|
|
120
120
|
var gestureRef = (0, import_react.useRef)(null);
|
|
121
|
+
var pressActiveRef = (0, import_react.useRef)(false);
|
|
122
|
+
var beginPress = function(e) {
|
|
123
|
+
var _callbacksRef_current_onPressIn, _callbacksRef_current;
|
|
124
|
+
if (pressActiveRef.current) return;
|
|
125
|
+
pressActiveRef.current = true;
|
|
126
|
+
(_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});
|
|
127
|
+
};
|
|
128
|
+
var endPress = function(e) {
|
|
129
|
+
var firePress = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
130
|
+
var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;
|
|
131
|
+
if (!pressActiveRef.current) return;
|
|
132
|
+
pressActiveRef.current = false;
|
|
133
|
+
if (firePress) (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});
|
|
134
|
+
(_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e !== null && e !== void 0 ? e : {});
|
|
135
|
+
};
|
|
121
136
|
var useResponderFallback = !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents);
|
|
122
137
|
(0, import_mainThreadPressEvents.useMainThreadPressEvents)(events, viewProps, useResponderFallback, debugName);
|
|
123
138
|
if (everEnabled) {
|
|
@@ -128,6 +143,7 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
128
143
|
onLongPress: events.onLongPress
|
|
129
144
|
} : {};
|
|
130
145
|
if (hasRealPressEvents && !isInsideNativeMenu) {
|
|
146
|
+
endPress();
|
|
131
147
|
gestureRef.current = null;
|
|
132
148
|
return null;
|
|
133
149
|
}
|
|
@@ -135,28 +151,24 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
135
151
|
var { Gesture } = gh.state;
|
|
136
152
|
if (isInsideNativeMenu) {
|
|
137
153
|
var manual = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
|
|
138
|
-
|
|
139
|
-
(_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, {});
|
|
154
|
+
beginPress();
|
|
140
155
|
}).onTouchesUp(function() {
|
|
141
|
-
|
|
142
|
-
(_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, {});
|
|
143
|
-
(_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current1, {});
|
|
156
|
+
endPress(void 0, true);
|
|
144
157
|
}).onTouchesCancelled(function() {
|
|
145
|
-
|
|
146
|
-
|
|
158
|
+
endPress();
|
|
159
|
+
}).onFinalize(function() {
|
|
160
|
+
endPress();
|
|
147
161
|
});
|
|
148
162
|
gestureRef.current = manual;
|
|
149
163
|
} else if (!getIsAndroid()) {
|
|
150
164
|
gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
|
|
151
|
-
|
|
152
|
-
return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
|
|
165
|
+
return beginPress(e);
|
|
153
166
|
}).onTouchesUp(function(e) {
|
|
154
|
-
|
|
155
|
-
(_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, e);
|
|
156
|
-
(_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e);
|
|
167
|
+
endPress(e, true);
|
|
157
168
|
}).onTouchesCancelled(function(e) {
|
|
158
|
-
|
|
159
|
-
|
|
169
|
+
return endPress(e);
|
|
170
|
+
}).onFinalize(function() {
|
|
171
|
+
return endPress();
|
|
160
172
|
});
|
|
161
173
|
}
|
|
162
174
|
}
|
|
@@ -118,6 +118,21 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
118
118
|
if (isUsingRNGH) {
|
|
119
119
|
var callbacksRef = (0, import_react.useRef)(isUsingRNGH ? {} : null);
|
|
120
120
|
var gestureRef = (0, import_react.useRef)(null);
|
|
121
|
+
var pressActiveRef = (0, import_react.useRef)(false);
|
|
122
|
+
var beginPress = function(e) {
|
|
123
|
+
var _callbacksRef_current_onPressIn, _callbacksRef_current;
|
|
124
|
+
if (pressActiveRef.current) return;
|
|
125
|
+
pressActiveRef.current = true;
|
|
126
|
+
(_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});
|
|
127
|
+
};
|
|
128
|
+
var endPress = function(e) {
|
|
129
|
+
var firePress = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
130
|
+
var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;
|
|
131
|
+
if (!pressActiveRef.current) return;
|
|
132
|
+
pressActiveRef.current = false;
|
|
133
|
+
if (firePress) (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});
|
|
134
|
+
(_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e !== null && e !== void 0 ? e : {});
|
|
135
|
+
};
|
|
121
136
|
var useResponderFallback = !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents);
|
|
122
137
|
(0, import_mainThreadPressEvents.useMainThreadPressEvents)(events, viewProps, useResponderFallback, debugName);
|
|
123
138
|
if (everEnabled) {
|
|
@@ -128,6 +143,7 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
128
143
|
onLongPress: events.onLongPress
|
|
129
144
|
} : {};
|
|
130
145
|
if (hasRealPressEvents && !isInsideNativeMenu) {
|
|
146
|
+
endPress();
|
|
131
147
|
gestureRef.current = null;
|
|
132
148
|
return null;
|
|
133
149
|
}
|
|
@@ -135,28 +151,24 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
135
151
|
var { Gesture } = gh.state;
|
|
136
152
|
if (isInsideNativeMenu) {
|
|
137
153
|
var manual = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
|
|
138
|
-
|
|
139
|
-
(_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, {});
|
|
154
|
+
beginPress();
|
|
140
155
|
}).onTouchesUp(function() {
|
|
141
|
-
|
|
142
|
-
(_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, {});
|
|
143
|
-
(_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current1, {});
|
|
156
|
+
endPress(void 0, true);
|
|
144
157
|
}).onTouchesCancelled(function() {
|
|
145
|
-
|
|
146
|
-
|
|
158
|
+
endPress();
|
|
159
|
+
}).onFinalize(function() {
|
|
160
|
+
endPress();
|
|
147
161
|
});
|
|
148
162
|
gestureRef.current = manual;
|
|
149
163
|
} else if (!getIsAndroid()) {
|
|
150
164
|
gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
|
|
151
|
-
|
|
152
|
-
return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
|
|
165
|
+
return beginPress(e);
|
|
153
166
|
}).onTouchesUp(function(e) {
|
|
154
|
-
|
|
155
|
-
(_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, e);
|
|
156
|
-
(_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e);
|
|
167
|
+
endPress(e, true);
|
|
157
168
|
}).onTouchesCancelled(function(e) {
|
|
158
|
-
|
|
159
|
-
|
|
169
|
+
return endPress(e);
|
|
170
|
+
}).onFinalize(function() {
|
|
171
|
+
return endPress();
|
|
160
172
|
});
|
|
161
173
|
}
|
|
162
174
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventHandling.native.js","names":[],"sources":["cjs/eventHandling.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar eventHandling_native_exports = {};\n__export(eventHandling_native_exports, {\n getWebEvents: () => getWebEvents,\n useEvents: () => useEvents,\n wrapWithGestureDetector: () => wrapWithGestureDetector\n});\nmodule.exports = __toCommonJS(eventHandling_native_exports);\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_native = require(\"@tamagui/native\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_react_native = require(\"react-native\");\nvar import_mainThreadPressEvents = require(\"./helpers/mainThreadPressEvents\");\nvar isFabric = !!globalThis.nativeFabricUIManager;\nvar isAndroidCache;\nvar getIsAndroid = function() {\n if (isAndroidCache === void 0) {\n isAndroidCache = (import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) === \"android\";\n }\n return isAndroidCache;\n};\nvar isNativeDesktopCache;\nvar getIsNativeDesktop = function() {\n if (isNativeDesktopCache === void 0) {\n isNativeDesktopCache = (import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) === \"macos\" || (import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) === \"windows\";\n }\n return isNativeDesktopCache;\n};\nvar responderClaim = function() {\n return true;\n};\nvar responderWrapperStyle = {\n display: \"contents\"\n};\nfunction getWebEvents() {\n return {};\n}\nfunction useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, debugName, hasRealPressEvents) {\n if (events) {\n if (events.onFocus) {\n viewProps[\"onFocus\"] = events.onFocus;\n }\n if (events.onBlur) {\n viewProps[\"onBlur\"] = events.onBlur;\n }\n if (getIsNativeDesktop()) {\n if (events.onMouseEnter) {\n viewProps[\"onMouseEnter\"] = events.onMouseEnter;\n }\n if (events.onMouseLeave) {\n viewProps[\"onMouseLeave\"] = events.onMouseLeave;\n }\n }\n }\n var hasPressEvents = events === null || events === void 0 ? void 0 : events.onPress;\n var gh = (0, import_native.getGestureHandler)();\n if (hasPressEvents) {\n stateRef.current.hasHadEvents = true;\n }\n if (hasRealPressEvents) {\n stateRef.current.hasRealPressEvents = true;\n }\n var everEnabled = Boolean(hasPressEvents || stateRef.current.hasHadEvents);\n var isUsingRNGH = gh.isEnabled;\n if (staticConfig.isInput) {\n if (events) {\n var { onPressIn, onPressOut, onPress } = events;\n var inputEvents = {\n onPressIn,\n onPressOut: onPressOut || onPress\n };\n if (onPressOut && onPress) {\n inputEvents.onPressOut = (0, import_helpers.composeEventHandlers)(onPress, onPressOut);\n }\n Object.assign(viewProps, inputEvents);\n }\n return null;\n }\n var isCompositeComponent = !isHOC && staticConfig.Component && typeof staticConfig.Component !== \"string\";\n if (isHOC || isCompositeComponent) {\n if (events) {\n var { onPressIn: onPressIn1, onPressOut: onPressOut1, onPress: onPress1, onLongPress, delayLongPress } = events;\n Object.assign(viewProps, {\n onPressIn: onPressIn1,\n onPressOut: onPressOut1,\n onPress: onPress1,\n onLongPress,\n delayLongPress\n });\n }\n return null;\n }\n if (isUsingRNGH) {\n var callbacksRef = (0, import_react.useRef)(isUsingRNGH ? {} : null);\n var gestureRef = (0, import_react.useRef)(null);\n var useResponderFallback = !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents);\n (0, import_mainThreadPressEvents.useMainThreadPressEvents)(events, viewProps, useResponderFallback, debugName);\n if (everEnabled) {\n callbacksRef.current = hasPressEvents ? {\n onPressIn: events.onPressIn,\n onPressOut: events.onPressOut,\n onPress: events.onPress,\n onLongPress: events.onLongPress\n } : {};\n if (hasRealPressEvents && !isInsideNativeMenu) {\n gestureRef.current = null;\n return null;\n }\n if (!gestureRef.current) {\n var { Gesture } = gh.state;\n if (isInsideNativeMenu) {\n var manual = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {\n var _callbacksRef_current_onPressIn, _callbacksRef_current;\n (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, {});\n }).onTouchesUp(function() {\n var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;\n (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, {});\n (_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current1, {});\n }).onTouchesCancelled(function() {\n var _callbacksRef_current_onPressOut, _callbacksRef_current;\n (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current, {});\n });\n gestureRef.current = manual;\n } else if (!getIsAndroid()) {\n gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {\n var _callbacksRef_current_onPressIn, _callbacksRef_current;\n return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);\n }).onTouchesUp(function(e) {\n var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;\n (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, e);\n (_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e);\n }).onTouchesCancelled(function(e) {\n var _callbacksRef_current_onPressOut, _callbacksRef_current;\n return (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current, e);\n });\n }\n }\n return gestureRef.current;\n }\n return null;\n }\n (0, import_mainThreadPressEvents.useMainThreadPressEvents)(events, viewProps, hasPressEvents, debugName);\n return null;\n}\nfunction wrapWithGestureDetector(content, gesture, _stateRef, isHOC, isCompositeComponent, hasRealPressEvents) {\n if (isHOC || isCompositeComponent) {\n return content;\n }\n var gh = (0, import_native.getGestureHandler)();\n var { GestureDetector } = gh.state;\n if (!GestureDetector || !gesture) {\n return content;\n }\n if (!hasRealPressEvents) {\n return import_react.default.createElement(GestureDetector, {\n gesture\n }, content);\n }\n if (isFabric) {\n var claimed = import_react.default.cloneElement(content, {\n onStartShouldSetResponder: responderClaim\n });\n return import_react.default.createElement(GestureDetector, {\n gesture\n }, claimed);\n }\n return import_react.default.createElement(import_react_native.View, {\n collapsable: false,\n style: responderWrapperStyle,\n onStartShouldSetResponder: responderClaim\n }, import_react.default.createElement(GestureDetector, {\n gesture\n }, content));\n}\n//# sourceMappingURL=eventHandling.native.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,+BAA+B,CAAC;AACpC,SAAS,8BAA8B;CACrC,oBAAoB;CACpB,iBAAiB;CACjB,+BAA+B;AACjC,CAAC;AACD,OAAO,UAAU,aAAa,4BAA4B;AAC1D,IAAI,iBAAiB,QAAQ,kBAAkB;AAC/C,IAAI,gBAAgB,QAA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ling.native.js","names":[],"sources":["cjs/eventHandling.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar eventHandling_native_exports = {};\n__export(eventHandling_native_exports, {\n getWebEvents: () => getWebEvents,\n useEvents: () => useEvents,\n wrapWithGestureDetector: () => wrapWithGestureDetector\n});\nmodule.exports = __toCommonJS(eventHandling_native_exports);\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_native = require(\"@tamagui/native\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_react_native = require(\"react-native\");\nvar import_mainThreadPressEvents = require(\"./helpers/mainThreadPressEvents\");\nvar isFabric = !!globalThis.nativeFabricUIManager;\nvar isAndroidCache;\nvar getIsAndroid = function() {\n if (isAndroidCache === void 0) {\n isAndroidCache = (import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) === \"android\";\n }\n return isAndroidCache;\n};\nvar isNativeDesktopCache;\nvar getIsNativeDesktop = function() {\n if (isNativeDesktopCache === void 0) {\n isNativeDesktopCache = (import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) === \"macos\" || (import_react_native.Platform === null || import_react_native.Platform === void 0 ? void 0 : import_react_native.Platform.OS) === \"windows\";\n }\n return isNativeDesktopCache;\n};\nvar responderClaim = function() {\n return true;\n};\nvar responderWrapperStyle = {\n display: \"contents\"\n};\nfunction getWebEvents() {\n return {};\n}\nfunction useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, debugName, hasRealPressEvents) {\n if (events) {\n if (events.onFocus) {\n viewProps[\"onFocus\"] = events.onFocus;\n }\n if (events.onBlur) {\n viewProps[\"onBlur\"] = events.onBlur;\n }\n if (getIsNativeDesktop()) {\n if (events.onMouseEnter) {\n viewProps[\"onMouseEnter\"] = events.onMouseEnter;\n }\n if (events.onMouseLeave) {\n viewProps[\"onMouseLeave\"] = events.onMouseLeave;\n }\n }\n }\n var hasPressEvents = events === null || events === void 0 ? void 0 : events.onPress;\n var gh = (0, import_native.getGestureHandler)();\n if (hasPressEvents) {\n stateRef.current.hasHadEvents = true;\n }\n if (hasRealPressEvents) {\n stateRef.current.hasRealPressEvents = true;\n }\n var everEnabled = Boolean(hasPressEvents || stateRef.current.hasHadEvents);\n var isUsingRNGH = gh.isEnabled;\n if (staticConfig.isInput) {\n if (events) {\n var { onPressIn, onPressOut, onPress } = events;\n var inputEvents = {\n onPressIn,\n onPressOut: onPressOut || onPress\n };\n if (onPressOut && onPress) {\n inputEvents.onPressOut = (0, import_helpers.composeEventHandlers)(onPress, onPressOut);\n }\n Object.assign(viewProps, inputEvents);\n }\n return null;\n }\n var isCompositeComponent = !isHOC && staticConfig.Component && typeof staticConfig.Component !== \"string\";\n if (isHOC || isCompositeComponent) {\n if (events) {\n var { onPressIn: onPressIn1, onPressOut: onPressOut1, onPress: onPress1, onLongPress, delayLongPress } = events;\n Object.assign(viewProps, {\n onPressIn: onPressIn1,\n onPressOut: onPressOut1,\n onPress: onPress1,\n onLongPress,\n delayLongPress\n });\n }\n return null;\n }\n if (isUsingRNGH) {\n var callbacksRef = (0, import_react.useRef)(isUsingRNGH ? {} : null);\n var gestureRef = (0, import_react.useRef)(null);\n var pressActiveRef = (0, import_react.useRef)(false);\n var beginPress = function(e) {\n var _callbacksRef_current_onPressIn, _callbacksRef_current;\n if (pressActiveRef.current) return;\n pressActiveRef.current = true;\n (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});\n };\n var endPress = function(e) {\n var firePress = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;\n var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;\n if (!pressActiveRef.current) return;\n pressActiveRef.current = false;\n if (firePress) (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});\n (_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e !== null && e !== void 0 ? e : {});\n };\n var useResponderFallback = !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents);\n (0, import_mainThreadPressEvents.useMainThreadPressEvents)(events, viewProps, useResponderFallback, debugName);\n if (everEnabled) {\n callbacksRef.current = hasPressEvents ? {\n onPressIn: events.onPressIn,\n onPressOut: events.onPressOut,\n onPress: events.onPress,\n onLongPress: events.onLongPress\n } : {};\n if (hasRealPressEvents && !isInsideNativeMenu) {\n endPress();\n gestureRef.current = null;\n return null;\n }\n if (!gestureRef.current) {\n var { Gesture } = gh.state;\n if (isInsideNativeMenu) {\n var manual = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {\n beginPress();\n }).onTouchesUp(function() {\n endPress(void 0, true);\n }).onTouchesCancelled(function() {\n endPress();\n }).onFinalize(function() {\n endPress();\n });\n gestureRef.current = manual;\n } else if (!getIsAndroid()) {\n gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {\n return beginPress(e);\n }).onTouchesUp(function(e) {\n endPress(e, true);\n }).onTouchesCancelled(function(e) {\n return endPress(e);\n }).onFinalize(function() {\n return endPress();\n });\n }\n }\n return gestureRef.current;\n }\n return null;\n }\n (0, import_mainThreadPressEvents.useMainThreadPressEvents)(events, viewProps, hasPressEvents, debugName);\n return null;\n}\nfunction wrapWithGestureDetector(content, gesture, _stateRef, isHOC, isCompositeComponent, hasRealPressEvents) {\n if (isHOC || isCompositeComponent) {\n return content;\n }\n var gh = (0, import_native.getGestureHandler)();\n var { GestureDetector } = gh.state;\n if (!GestureDetector || !gesture) {\n return content;\n }\n if (!hasRealPressEvents) {\n return import_react.default.createElement(GestureDetector, {\n gesture\n }, content);\n }\n if (isFabric) {\n var claimed = import_react.default.cloneElement(content, {\n onStartShouldSetResponder: responderClaim\n });\n return import_react.default.createElement(GestureDetector, {\n gesture\n }, claimed);\n }\n return import_react.default.createElement(import_react_native.View, {\n collapsable: false,\n style: responderWrapperStyle,\n onStartShouldSetResponder: responderClaim\n }, import_react.default.createElement(GestureDetector, {\n gesture\n }, content));\n}\n//# sourceMappingURL=eventHandling.native.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAA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AAC,CAAC,WAAW,WAAW;MACvB,OAAO,SAAS;KAClB,CAAC;IACH;GACF;GACA,OAAO,WAAW;EACpB;EACA,OAAO;CACT;CACA,CAAC,GAAG,6BAA6B,yBAAwB,CAAE,QAAQ,WAAW,gBAAgB,SAAS;CACvG,OAAO;AACT;AACA,SAAS,wBAAwB,SAAS,SAAS,WAAW,OAAO,sBAAsB,oBAAoB;CAC7G,IAAI,SAAS,sBAAsB;EACjC,OAAO;CACT;CACA,IAAI,MAAM,GAAG,cAAc,kBAAiB,CAAE;CAC9C,IAAI,EAAE,oBAAoB,GAAG;CAC7B,IAAI,CAAC,mBAAmB,CAAC,SAAS;EAChC,OAAO;CACT;CACA,IAAI,CAAC,oBAAoB;EACvB,OAAO,aAAa,QAAQ,cAAc,iBAAiB,EACzD,QACF,GAAG,OAAO;CACZ;CACA,IAAI,UAAU;EACZ,IAAI,UAAU,aAAa,QAAQ,aAAa,SAAS,EACvD,2BAA2B,eAC7B,CAAC;EACD,OAAO,aAAa,QAAQ,cAAc,iBAAiB,EACzD,QACF,GAAG,OAAO;CACZ;CACA,OAAO,aAAa,QAAQ,cAAc,oBAAoB,MAAM;EAClE,aAAa;EACb,OAAO;EACP,2BAA2B;CAC7B,GAAG,aAAa,QAAQ,cAAc,iBAAiB,EACrD,QACF,GAAG,OAAO,CAAC;AACb"}
|
|
@@ -37,9 +37,19 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
37
37
|
pressOutTimer: null,
|
|
38
38
|
longPressTimer: null,
|
|
39
39
|
activateTime: 0,
|
|
40
|
-
blockedByExternalOwnership: false
|
|
40
|
+
blockedByExternalOwnership: false,
|
|
41
|
+
pressInOutstanding: false
|
|
41
42
|
};
|
|
42
43
|
}
|
|
44
|
+
(0, import_react.useEffect)(function() {
|
|
45
|
+
return function() {
|
|
46
|
+
clearStartTimers();
|
|
47
|
+
if (ref.current.pressOutTimer) {
|
|
48
|
+
clearTimeout(ref.current.pressOutTimer);
|
|
49
|
+
ref.current.pressOutTimer = null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
43
53
|
if (!enabled || !events) return;
|
|
44
54
|
var _events_delayPressIn;
|
|
45
55
|
var delayPressIn = Math.max(0, (_events_delayPressIn = events.delayPressIn) !== null && _events_delayPressIn !== void 0 ? _events_delayPressIn : 0);
|
|
@@ -51,30 +61,48 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
51
61
|
var minPressDuration = Math.max(0, (_events_minPressDuration = events.minPressDuration) !== null && _events_minPressDuration !== void 0 ? _events_minPressDuration : DEFAULT_MIN_PRESS_DURATION);
|
|
52
62
|
function activate(e) {
|
|
53
63
|
var _events_onPressIn;
|
|
64
|
+
if (ref.current.pressInOutstanding) return;
|
|
65
|
+
ref.current.pressInOutstanding = true;
|
|
54
66
|
ref.current.state = "active";
|
|
55
67
|
ref.current.activateTime = Date.now();
|
|
56
68
|
(_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 ? void 0 : _events_onPressIn.call(events, e);
|
|
57
69
|
}
|
|
70
|
+
function clearStartTimers() {
|
|
71
|
+
if (ref.current.pressInTimer) clearTimeout(ref.current.pressInTimer);
|
|
72
|
+
if (ref.current.longPressTimer) clearTimeout(ref.current.longPressTimer);
|
|
73
|
+
ref.current.pressInTimer = null;
|
|
74
|
+
ref.current.longPressTimer = null;
|
|
75
|
+
}
|
|
76
|
+
function releasePressOut(e) {
|
|
77
|
+
var _events_onPressOut;
|
|
78
|
+
if (ref.current.pressOutTimer) {
|
|
79
|
+
clearTimeout(ref.current.pressOutTimer);
|
|
80
|
+
ref.current.pressOutTimer = null;
|
|
81
|
+
}
|
|
82
|
+
if (!ref.current.pressInOutstanding) return;
|
|
83
|
+
ref.current.pressInOutstanding = false;
|
|
84
|
+
ref.current.state = "idle";
|
|
85
|
+
(_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);
|
|
86
|
+
}
|
|
58
87
|
function deactivate(e) {
|
|
88
|
+
if (!ref.current.pressInOutstanding) return;
|
|
59
89
|
var pressDuration = Date.now() - ref.current.activateTime;
|
|
60
90
|
var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);
|
|
61
91
|
if (remaining > 0) {
|
|
62
|
-
ref.current.pressOutTimer
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
92
|
+
if (!ref.current.pressOutTimer) {
|
|
93
|
+
ref.current.pressOutTimer = setTimeout(function() {
|
|
94
|
+
ref.current.pressOutTimer = null;
|
|
95
|
+
releasePressOut(e);
|
|
96
|
+
}, remaining);
|
|
97
|
+
}
|
|
66
98
|
} else {
|
|
67
|
-
|
|
68
|
-
(_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);
|
|
99
|
+
releasePressOut(e);
|
|
69
100
|
}
|
|
70
101
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
ref.current.pressInTimer = null;
|
|
76
|
-
ref.current.pressOutTimer = null;
|
|
77
|
-
ref.current.longPressTimer = null;
|
|
102
|
+
function resetPress(e) {
|
|
103
|
+
releasePressOut(e);
|
|
104
|
+
clearStartTimers();
|
|
105
|
+
ref.current.blockedByExternalOwnership = false;
|
|
78
106
|
}
|
|
79
107
|
var userStartShouldSet = viewProps.onStartShouldSetResponder;
|
|
80
108
|
var userGrant = viewProps.onResponderGrant;
|
|
@@ -87,7 +115,8 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
87
115
|
return !events.disabled && !(0, import_native.unstable_hasExternalPressOwnership)();
|
|
88
116
|
};
|
|
89
117
|
viewProps.onResponderGrant = function(e) {
|
|
90
|
-
|
|
118
|
+
releasePressOut(e);
|
|
119
|
+
clearStartTimers();
|
|
91
120
|
if ((0, import_native.unstable_hasExternalPressOwnership)()) {
|
|
92
121
|
ref.current.state = "idle";
|
|
93
122
|
ref.current.blockedByExternalOwnership = true;
|
|
@@ -115,14 +144,12 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
115
144
|
};
|
|
116
145
|
viewProps.onResponderRelease = function(e) {
|
|
117
146
|
if (ref.current.blockedByExternalOwnership || (0, import_native.unstable_hasExternalPressOwnership)()) {
|
|
118
|
-
|
|
119
|
-
ref.current.blockedByExternalOwnership = false;
|
|
120
|
-
ref.current.state = "idle";
|
|
147
|
+
resetPress(e);
|
|
121
148
|
return;
|
|
122
149
|
}
|
|
123
150
|
userRelease === null || userRelease === void 0 ? void 0 : userRelease(e);
|
|
124
151
|
var wasLongPressed = ref.current.state === "longPressed";
|
|
125
|
-
|
|
152
|
+
clearStartTimers();
|
|
126
153
|
if (ref.current.state === "pressing") {
|
|
127
154
|
activate(e);
|
|
128
155
|
}
|
|
@@ -131,17 +158,11 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
131
158
|
(_events_onPress = events.onPress) === null || _events_onPress === void 0 ? void 0 : _events_onPress.call(events, e);
|
|
132
159
|
}
|
|
133
160
|
deactivate(e);
|
|
134
|
-
ref.current.state = "idle";
|
|
135
161
|
ref.current.blockedByExternalOwnership = false;
|
|
136
162
|
};
|
|
137
163
|
viewProps.onResponderTerminate = function(e) {
|
|
138
164
|
userTerminate === null || userTerminate === void 0 ? void 0 : userTerminate(e);
|
|
139
|
-
|
|
140
|
-
if (ref.current.state === "active" || ref.current.state === "longPressed") {
|
|
141
|
-
deactivate(e);
|
|
142
|
-
}
|
|
143
|
-
ref.current.state = "idle";
|
|
144
|
-
ref.current.blockedByExternalOwnership = false;
|
|
165
|
+
resetPress(e);
|
|
145
166
|
};
|
|
146
167
|
viewProps.onResponderTerminationRequest = function(e) {
|
|
147
168
|
if (userTerminationRequest) return userTerminationRequest(e);
|
|
@@ -37,9 +37,19 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
37
37
|
pressOutTimer: null,
|
|
38
38
|
longPressTimer: null,
|
|
39
39
|
activateTime: 0,
|
|
40
|
-
blockedByExternalOwnership: false
|
|
40
|
+
blockedByExternalOwnership: false,
|
|
41
|
+
pressInOutstanding: false
|
|
41
42
|
};
|
|
42
43
|
}
|
|
44
|
+
(0, import_react.useEffect)(function() {
|
|
45
|
+
return function() {
|
|
46
|
+
clearStartTimers();
|
|
47
|
+
if (ref.current.pressOutTimer) {
|
|
48
|
+
clearTimeout(ref.current.pressOutTimer);
|
|
49
|
+
ref.current.pressOutTimer = null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
43
53
|
if (!enabled || !events) return;
|
|
44
54
|
var _events_delayPressIn;
|
|
45
55
|
var delayPressIn = Math.max(0, (_events_delayPressIn = events.delayPressIn) !== null && _events_delayPressIn !== void 0 ? _events_delayPressIn : 0);
|
|
@@ -51,30 +61,48 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
51
61
|
var minPressDuration = Math.max(0, (_events_minPressDuration = events.minPressDuration) !== null && _events_minPressDuration !== void 0 ? _events_minPressDuration : DEFAULT_MIN_PRESS_DURATION);
|
|
52
62
|
function activate(e) {
|
|
53
63
|
var _events_onPressIn;
|
|
64
|
+
if (ref.current.pressInOutstanding) return;
|
|
65
|
+
ref.current.pressInOutstanding = true;
|
|
54
66
|
ref.current.state = "active";
|
|
55
67
|
ref.current.activateTime = Date.now();
|
|
56
68
|
(_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 ? void 0 : _events_onPressIn.call(events, e);
|
|
57
69
|
}
|
|
70
|
+
function clearStartTimers() {
|
|
71
|
+
if (ref.current.pressInTimer) clearTimeout(ref.current.pressInTimer);
|
|
72
|
+
if (ref.current.longPressTimer) clearTimeout(ref.current.longPressTimer);
|
|
73
|
+
ref.current.pressInTimer = null;
|
|
74
|
+
ref.current.longPressTimer = null;
|
|
75
|
+
}
|
|
76
|
+
function releasePressOut(e) {
|
|
77
|
+
var _events_onPressOut;
|
|
78
|
+
if (ref.current.pressOutTimer) {
|
|
79
|
+
clearTimeout(ref.current.pressOutTimer);
|
|
80
|
+
ref.current.pressOutTimer = null;
|
|
81
|
+
}
|
|
82
|
+
if (!ref.current.pressInOutstanding) return;
|
|
83
|
+
ref.current.pressInOutstanding = false;
|
|
84
|
+
ref.current.state = "idle";
|
|
85
|
+
(_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);
|
|
86
|
+
}
|
|
58
87
|
function deactivate(e) {
|
|
88
|
+
if (!ref.current.pressInOutstanding) return;
|
|
59
89
|
var pressDuration = Date.now() - ref.current.activateTime;
|
|
60
90
|
var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);
|
|
61
91
|
if (remaining > 0) {
|
|
62
|
-
ref.current.pressOutTimer
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
92
|
+
if (!ref.current.pressOutTimer) {
|
|
93
|
+
ref.current.pressOutTimer = setTimeout(function() {
|
|
94
|
+
ref.current.pressOutTimer = null;
|
|
95
|
+
releasePressOut(e);
|
|
96
|
+
}, remaining);
|
|
97
|
+
}
|
|
66
98
|
} else {
|
|
67
|
-
|
|
68
|
-
(_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);
|
|
99
|
+
releasePressOut(e);
|
|
69
100
|
}
|
|
70
101
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
ref.current.pressInTimer = null;
|
|
76
|
-
ref.current.pressOutTimer = null;
|
|
77
|
-
ref.current.longPressTimer = null;
|
|
102
|
+
function resetPress(e) {
|
|
103
|
+
releasePressOut(e);
|
|
104
|
+
clearStartTimers();
|
|
105
|
+
ref.current.blockedByExternalOwnership = false;
|
|
78
106
|
}
|
|
79
107
|
var userStartShouldSet = viewProps.onStartShouldSetResponder;
|
|
80
108
|
var userGrant = viewProps.onResponderGrant;
|
|
@@ -87,7 +115,8 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
87
115
|
return !events.disabled && !(0, import_native.unstable_hasExternalPressOwnership)();
|
|
88
116
|
};
|
|
89
117
|
viewProps.onResponderGrant = function(e) {
|
|
90
|
-
|
|
118
|
+
releasePressOut(e);
|
|
119
|
+
clearStartTimers();
|
|
91
120
|
if ((0, import_native.unstable_hasExternalPressOwnership)()) {
|
|
92
121
|
ref.current.state = "idle";
|
|
93
122
|
ref.current.blockedByExternalOwnership = true;
|
|
@@ -115,14 +144,12 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
115
144
|
};
|
|
116
145
|
viewProps.onResponderRelease = function(e) {
|
|
117
146
|
if (ref.current.blockedByExternalOwnership || (0, import_native.unstable_hasExternalPressOwnership)()) {
|
|
118
|
-
|
|
119
|
-
ref.current.blockedByExternalOwnership = false;
|
|
120
|
-
ref.current.state = "idle";
|
|
147
|
+
resetPress(e);
|
|
121
148
|
return;
|
|
122
149
|
}
|
|
123
150
|
userRelease === null || userRelease === void 0 ? void 0 : userRelease(e);
|
|
124
151
|
var wasLongPressed = ref.current.state === "longPressed";
|
|
125
|
-
|
|
152
|
+
clearStartTimers();
|
|
126
153
|
if (ref.current.state === "pressing") {
|
|
127
154
|
activate(e);
|
|
128
155
|
}
|
|
@@ -131,17 +158,11 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
131
158
|
(_events_onPress = events.onPress) === null || _events_onPress === void 0 ? void 0 : _events_onPress.call(events, e);
|
|
132
159
|
}
|
|
133
160
|
deactivate(e);
|
|
134
|
-
ref.current.state = "idle";
|
|
135
161
|
ref.current.blockedByExternalOwnership = false;
|
|
136
162
|
};
|
|
137
163
|
viewProps.onResponderTerminate = function(e) {
|
|
138
164
|
userTerminate === null || userTerminate === void 0 ? void 0 : userTerminate(e);
|
|
139
|
-
|
|
140
|
-
if (ref.current.state === "active" || ref.current.state === "longPressed") {
|
|
141
|
-
deactivate(e);
|
|
142
|
-
}
|
|
143
|
-
ref.current.state = "idle";
|
|
144
|
-
ref.current.blockedByExternalOwnership = false;
|
|
165
|
+
resetPress(e);
|
|
145
166
|
};
|
|
146
167
|
viewProps.onResponderTerminationRequest = function(e) {
|
|
147
168
|
if (userTerminationRequest) return userTerminationRequest(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mainThreadPressEvents.native.js","names":[],"sources":["cjs/helpers/mainThreadPressEvents.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar mainThreadPressEvents_native_exports = {};\n__export(mainThreadPressEvents_native_exports, {\n useMainThreadPressEvents: () => useMainThreadPressEvents\n});\nmodule.exports = __toCommonJS(mainThreadPressEvents_native_exports);\nvar import_native = require(\"@tamagui/native\");\nvar import_react = require(\"react\");\nvar DEFAULT_LONG_PRESS_DELAY = 500;\nvar DEFAULT_MIN_PRESS_DURATION = 130;\nfunction useMainThreadPressEvents(events, viewProps) {\n var enabled = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true, debugName = arguments.length > 3 ? arguments[3] : void 0;\n var ref = (0, import_react.useRef)(null);\n if (!ref.current) {\n ref.current = {\n state: \"idle\",\n pressInTimer: null,\n pressOutTimer: null,\n longPressTimer: null,\n activateTime: 0,\n blockedByExternalOwnership: false\n };\n }\n if (!enabled || !events) return;\n var _events_delayPressIn;\n var delayPressIn = Math.max(0, (_events_delayPressIn = events.delayPressIn) !== null && _events_delayPressIn !== void 0 ? _events_delayPressIn : 0);\n var _events_delayPressOut;\n var delayPressOut = Math.max(0, (_events_delayPressOut = events.delayPressOut) !== null && _events_delayPressOut !== void 0 ? _events_delayPressOut : 0);\n var _events_delayLongPress;\n var delayLongPress = Math.max(0, (_events_delayLongPress = events.delayLongPress) !== null && _events_delayLongPress !== void 0 ? _events_delayLongPress : DEFAULT_LONG_PRESS_DELAY);\n var _events_minPressDuration;\n var minPressDuration = Math.max(0, (_events_minPressDuration = events.minPressDuration) !== null && _events_minPressDuration !== void 0 ? _events_minPressDuration : DEFAULT_MIN_PRESS_DURATION);\n function activate(e) {\n var _events_onPressIn;\n ref.current.state = \"active\";\n ref.current.activateTime = Date.now();\n (_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 ? void 0 : _events_onPressIn.call(events, e);\n }\n function deactivate(e) {\n var pressDuration = Date.now() - ref.current.activateTime;\n var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);\n if (remaining > 0) {\n ref.current.pressOutTimer = setTimeout(function() {\n var _events_onPressOut2;\n (_events_onPressOut2 = events.onPressOut) === null || _events_onPressOut2 === void 0 ? void 0 : _events_onPressOut2.call(events, e);\n }, remaining);\n } else {\n var _events_onPressOut;\n (_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);\n }\n }\n function cleanup() {\n if (ref.current.pressInTimer) clearTimeout(ref.current.pressInTimer);\n if (ref.current.pressOutTimer) clearTimeout(ref.current.pressOutTimer);\n if (ref.current.longPressTimer) clearTimeout(ref.current.longPressTimer);\n ref.current.pressInTimer = null;\n ref.current.pressOutTimer = null;\n ref.current.longPressTimer = null;\n }\n var userStartShouldSet = viewProps.onStartShouldSetResponder;\n var userGrant = viewProps.onResponderGrant;\n var userRelease = viewProps.onResponderRelease;\n var userTerminate = viewProps.onResponderTerminate;\n var userTerminationRequest = viewProps.onResponderTerminationRequest;\n var userMove = viewProps.onResponderMove;\n viewProps.onStartShouldSetResponder = function(e) {\n if (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) return true;\n return !events.disabled && !(0, import_native.unstable_hasExternalPressOwnership)();\n };\n viewProps.onResponderGrant = function(e) {\n cleanup();\n if ((0, import_native.unstable_hasExternalPressOwnership)()) {\n ref.current.state = \"idle\";\n ref.current.blockedByExternalOwnership = true;\n return;\n }\n userGrant === null || userGrant === void 0 ? void 0 : userGrant(e);\n ref.current.blockedByExternalOwnership = false;\n ref.current.state = \"pressing\";\n if (delayPressIn > 0) {\n ref.current.pressInTimer = setTimeout(function() {\n return activate(e);\n }, delayPressIn);\n } else {\n activate(e);\n }\n if (events.onLongPress) {\n ref.current.longPressTimer = setTimeout(function() {\n if (ref.current.state === \"active\") {\n var _events_onLongPress;\n ref.current.state = \"longPressed\";\n (_events_onLongPress = events.onLongPress) === null || _events_onLongPress === void 0 ? void 0 : _events_onLongPress.call(events, e);\n }\n }, delayLongPress + delayPressIn);\n }\n };\n viewProps.onResponderRelease = function(e) {\n if (ref.current.blockedByExternalOwnership || (0, import_native.unstable_hasExternalPressOwnership)()) {\n cleanup();\n ref.current.blockedByExternalOwnership = false;\n ref.current.state = \"idle\";\n return;\n }\n userRelease === null || userRelease === void 0 ? void 0 : userRelease(e);\n var wasLongPressed = ref.current.state === \"longPressed\";\n cleanup();\n if (ref.current.state === \"pressing\") {\n activate(e);\n }\n if (!wasLongPressed) {\n var _events_onPress;\n (_events_onPress = events.onPress) === null || _events_onPress === void 0 ? void 0 : _events_onPress.call(events, e);\n }\n deactivate(e);\n ref.current.state = \"idle\";\n ref.current.blockedByExternalOwnership = false;\n };\n viewProps.onResponderTerminate = function(e) {\n userTerminate === null || userTerminate === void 0 ? void 0 : userTerminate(e);\n cleanup();\n if (ref.current.state === \"active\" || ref.current.state === \"longPressed\") {\n deactivate(e);\n }\n ref.current.state = \"idle\";\n ref.current.blockedByExternalOwnership = false;\n };\n viewProps.onResponderTerminationRequest = function(e) {\n if (userTerminationRequest) return userTerminationRequest(e);\n return events.cancelable !== false;\n };\n viewProps.onResponderMove = function(e) {\n var _events_onPressMove;\n userMove === null || userMove === void 0 ? void 0 : userMove(e);\n (_events_onPressMove = events.onPressMove) === null || _events_onPressMove === void 0 ? void 0 : _events_onPressMove.call(events, e);\n };\n}\n//# sourceMappingURL=mainThreadPressEvents.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uCAAuC,CAAC;AAC5C,SAAS,sCAAsC,EAC7C,gCAAgC,yBAClC,CAAC;AACD,OAAO,UAAU,aAAa,oCAAoC;AAClE,IAAI,gBAAgB,QAAQ,iBAAiB;AAC7C,IAAI,eAAe,QAAQ,OAAO;AAClC,IAAI,2BAA2B;AAC/B,IAAI,6BAA6B;AACjC,SAAS,yBAAyB,QAAQ,WAAW;CACnD,IAAI,UAAU,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,MAAM,YAAY,UAAU,SAAS,IAAI,UAAU,KAAK,KAAK;CAC5I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C;EAC9D,CAAC,sBAAsB,OAAO,iBAAiB,QAAQ,wBAAwB,KAAK,IAAI,KAAK,IAAI,oBAAoB,KAAK,QAAQ,CAAC;CACrI;AACF"}
|
|
1
|
+
{"version":3,"file":"mainThreadPressEvents.native.js","names":[],"sources":["cjs/helpers/mainThreadPressEvents.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar mainThreadPressEvents_native_exports = {};\n__export(mainThreadPressEvents_native_exports, {\n useMainThreadPressEvents: () => useMainThreadPressEvents\n});\nmodule.exports = __toCommonJS(mainThreadPressEvents_native_exports);\nvar import_native = require(\"@tamagui/native\");\nvar import_react = require(\"react\");\nvar DEFAULT_LONG_PRESS_DELAY = 500;\nvar DEFAULT_MIN_PRESS_DURATION = 130;\nfunction useMainThreadPressEvents(events, viewProps) {\n var enabled = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true, debugName = arguments.length > 3 ? arguments[3] : void 0;\n var ref = (0, import_react.useRef)(null);\n if (!ref.current) {\n ref.current = {\n state: \"idle\",\n pressInTimer: null,\n pressOutTimer: null,\n longPressTimer: null,\n activateTime: 0,\n blockedByExternalOwnership: false,\n pressInOutstanding: false\n };\n }\n (0, import_react.useEffect)(\n function() {\n return function() {\n clearStartTimers();\n if (ref.current.pressOutTimer) {\n clearTimeout(ref.current.pressOutTimer);\n ref.current.pressOutTimer = null;\n }\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n if (!enabled || !events) return;\n var _events_delayPressIn;\n var delayPressIn = Math.max(0, (_events_delayPressIn = events.delayPressIn) !== null && _events_delayPressIn !== void 0 ? _events_delayPressIn : 0);\n var _events_delayPressOut;\n var delayPressOut = Math.max(0, (_events_delayPressOut = events.delayPressOut) !== null && _events_delayPressOut !== void 0 ? _events_delayPressOut : 0);\n var _events_delayLongPress;\n var delayLongPress = Math.max(0, (_events_delayLongPress = events.delayLongPress) !== null && _events_delayLongPress !== void 0 ? _events_delayLongPress : DEFAULT_LONG_PRESS_DELAY);\n var _events_minPressDuration;\n var minPressDuration = Math.max(0, (_events_minPressDuration = events.minPressDuration) !== null && _events_minPressDuration !== void 0 ? _events_minPressDuration : DEFAULT_MIN_PRESS_DURATION);\n function activate(e) {\n var _events_onPressIn;\n if (ref.current.pressInOutstanding) return;\n ref.current.pressInOutstanding = true;\n ref.current.state = \"active\";\n ref.current.activateTime = Date.now();\n (_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 ? void 0 : _events_onPressIn.call(events, e);\n }\n function clearStartTimers() {\n if (ref.current.pressInTimer) clearTimeout(ref.current.pressInTimer);\n if (ref.current.longPressTimer) clearTimeout(ref.current.longPressTimer);\n ref.current.pressInTimer = null;\n ref.current.longPressTimer = null;\n }\n function releasePressOut(e) {\n var _events_onPressOut;\n if (ref.current.pressOutTimer) {\n clearTimeout(ref.current.pressOutTimer);\n ref.current.pressOutTimer = null;\n }\n if (!ref.current.pressInOutstanding) return;\n ref.current.pressInOutstanding = false;\n ref.current.state = \"idle\";\n (_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 ? void 0 : _events_onPressOut.call(events, e);\n }\n function deactivate(e) {\n if (!ref.current.pressInOutstanding) return;\n var pressDuration = Date.now() - ref.current.activateTime;\n var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);\n if (remaining > 0) {\n if (!ref.current.pressOutTimer) {\n ref.current.pressOutTimer = setTimeout(function() {\n ref.current.pressOutTimer = null;\n releasePressOut(e);\n }, remaining);\n }\n } else {\n releasePressOut(e);\n }\n }\n function resetPress(e) {\n releasePressOut(e);\n clearStartTimers();\n ref.current.blockedByExternalOwnership = false;\n }\n var userStartShouldSet = viewProps.onStartShouldSetResponder;\n var userGrant = viewProps.onResponderGrant;\n var userRelease = viewProps.onResponderRelease;\n var userTerminate = viewProps.onResponderTerminate;\n var userTerminationRequest = viewProps.onResponderTerminationRequest;\n var userMove = viewProps.onResponderMove;\n viewProps.onStartShouldSetResponder = function(e) {\n if (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) return true;\n return !events.disabled && !(0, import_native.unstable_hasExternalPressOwnership)();\n };\n viewProps.onResponderGrant = function(e) {\n releasePressOut(e);\n clearStartTimers();\n if ((0, import_native.unstable_hasExternalPressOwnership)()) {\n ref.current.state = \"idle\";\n ref.current.blockedByExternalOwnership = true;\n return;\n }\n userGrant === null || userGrant === void 0 ? void 0 : userGrant(e);\n ref.current.blockedByExternalOwnership = false;\n ref.current.state = \"pressing\";\n if (delayPressIn > 0) {\n ref.current.pressInTimer = setTimeout(function() {\n return activate(e);\n }, delayPressIn);\n } else {\n activate(e);\n }\n if (events.onLongPress) {\n ref.current.longPressTimer = setTimeout(function() {\n if (ref.current.state === \"active\") {\n var _events_onLongPress;\n ref.current.state = \"longPressed\";\n (_events_onLongPress = events.onLongPress) === null || _events_onLongPress === void 0 ? void 0 : _events_onLongPress.call(events, e);\n }\n }, delayLongPress + delayPressIn);\n }\n };\n viewProps.onResponderRelease = function(e) {\n if (ref.current.blockedByExternalOwnership || (0, import_native.unstable_hasExternalPressOwnership)()) {\n resetPress(e);\n return;\n }\n userRelease === null || userRelease === void 0 ? void 0 : userRelease(e);\n var wasLongPressed = ref.current.state === \"longPressed\";\n clearStartTimers();\n if (ref.current.state === \"pressing\") {\n activate(e);\n }\n if (!wasLongPressed) {\n var _events_onPress;\n (_events_onPress = events.onPress) === null || _events_onPress === void 0 ? void 0 : _events_onPress.call(events, e);\n }\n deactivate(e);\n ref.current.blockedByExternalOwnership = false;\n };\n viewProps.onResponderTerminate = function(e) {\n userTerminate === null || userTerminate === void 0 ? void 0 : userTerminate(e);\n resetPress(e);\n };\n viewProps.onResponderTerminationRequest = function(e) {\n if (userTerminationRequest) return userTerminationRequest(e);\n return events.cancelable !== false;\n };\n viewProps.onResponderMove = function(e) {\n var _events_onPressMove;\n userMove === null || userMove === void 0 ? void 0 : userMove(e);\n (_events_onPressMove = events.onPressMove) === null || _events_onPressMove === void 0 ? void 0 : _events_onPressMove.call(events, e);\n };\n}\n//# sourceMappingURL=mainThreadPressEvents.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uCAAuC,CAAC;AAC5C,SAAS,sCAAsC,EAC7C,gCAAgC,yBAClC,CAAC;AACD,OA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AI,YAAY,CAAC;EACvE,IAAI,iBAAiB,IAAI,QAAQ,UAAU;EAC3C,iBAAiB;EACjB,IAAI,IAAI,QAAQ,UAAU,YAAY;GACpC,SAAS,CAAC;EACZ;EACA,IAAI,CAAC,gBAAgB;GACnB,IAAI;GACJ,CAAC,kBAAkB,OAAO,aAAa,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,KAAK,QAAQ,CAAC;EACrH;EACA,WAAW,CAAC;EACZ,IAAI,QAAQ,6BAA6B;CAC3C;CACA,UAAU,uBAAuB,SAAS,GAAG;EAC3C,kBAAkB,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,CAAC;EAC7E,WAAW,CAAC;CACd;CACA,UAAU,gCAAgC,SAAS,GAAG;EACpD,IAAI,wBAAwB,OAAO,uBAAuB,CAAC;EAC3D,OAAO,OAAO,eAAe;CAC/B;CACA,UAAU,kBAAkB,SAAS,GAAG;EACtC,IAAI;EACJ,aAAa,QAAQ,aAAa,KAAK,IAAI,KAAK,IAAI,SAAS,CAAC;EAC9D,CAAC,sBAAsB,OAAO,iBAAiB,QAAQ,wBAAwB,KAAK,IAAI,KAAK,IAAI,oBAAoB,KAAK,QAAQ,CAAC;CACrI;AACF"}
|
|
@@ -815,6 +815,14 @@ ${banner}
|
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
} : null;
|
|
818
|
+
useIsomorphicLayoutEffect(() => {
|
|
819
|
+
const hadPressPlumbing = stateRef.current.hadAttachPress;
|
|
820
|
+
stateRef.current.hadAttachPress = attachPress;
|
|
821
|
+
if (hadPressPlumbing && !attachPress && !pseudoGroups?.size) (stateRef.current.setStateShallow ?? stateRef.current.baseSetStateShallow)?.({
|
|
822
|
+
press: false,
|
|
823
|
+
pressIn: false
|
|
824
|
+
});
|
|
825
|
+
}, [attachPress, pseudoGroups]);
|
|
818
826
|
if (events) Object.assign(viewProps, getWebEvents(events));
|
|
819
827
|
if (process.env.NODE_ENV === "development" && time) time`events`;
|
|
820
828
|
if (process.env.NODE_ENV === "development" && debugProp === "verbose") log(`events`, {
|