@hanzogui/native 4.4.0 → 7.3.0
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/gestureState.cjs +46 -26
- package/dist/cjs/gestureState.native.js +50 -29
- package/dist/cjs/gestureState.native.js.map +1 -1
- package/dist/cjs/setup-gesture-handler.cjs +3 -3
- package/dist/cjs/setup-gesture-handler.native.js +3 -3
- package/dist/cjs/setup-gesture-handler.native.js.map +1 -1
- package/dist/cjs/setup-safe-area.cjs +2 -27
- package/dist/cjs/setup-safe-area.native.js +8 -16
- package/dist/cjs/setup-safe-area.native.js.map +1 -1
- package/dist/esm/PressBoundary.mjs.map +1 -1
- package/dist/esm/gestureState.mjs +46 -26
- package/dist/esm/gestureState.mjs.map +1 -1
- package/dist/esm/gestureState.native.js +50 -29
- package/dist/esm/gestureState.native.js.map +1 -1
- package/dist/esm/setup-gesture-handler.mjs +3 -3
- package/dist/esm/setup-gesture-handler.mjs.map +1 -1
- package/dist/esm/setup-gesture-handler.native.js +3 -3
- package/dist/esm/setup-gesture-handler.native.js.map +1 -1
- package/dist/esm/setup-safe-area.mjs +1 -26
- package/dist/esm/setup-safe-area.mjs.map +1 -1
- package/dist/esm/setup-safe-area.native.js +8 -16
- package/dist/esm/setup-safe-area.native.js.map +1 -1
- package/package.json +21 -7
- package/src/PressBoundary.tsx +1 -1
- package/src/gestureState.ts +74 -36
- package/src/index.ts +1 -1
- package/src/setup-burnt.ts +1 -1
- package/src/setup-gesture-handler.ts +5 -5
- package/src/setup-keyboard-controller.ts +1 -1
- package/src/setup-safe-area.ts +2 -2
- package/src/setup-worklets.ts +1 -1
- package/src/setup-zeego.ts +1 -1
- package/types/PressBoundary.d.ts +1 -1
- package/types/PressBoundary.d.ts.map +11 -0
- package/types/burntState.d.ts.map +11 -0
- package/types/components.d.ts.map +11 -0
- package/types/gesture-handler.d.ts.map +11 -0
- package/types/gestureState.d.ts.map +11 -0
- package/types/globalState.d.ts.map +11 -0
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +11 -0
- package/types/keyboardControllerState.d.ts.map +11 -0
- package/types/linearGradientState.d.ts.map +11 -0
- package/types/nativeMenuContext.d.ts.map +11 -0
- package/types/portalState.d.ts.map +11 -0
- package/types/safeAreaState.d.ts.map +11 -0
- package/types/setup-burnt.d.ts.map +11 -0
- package/types/setup-expo-linear-gradient.d.ts.map +11 -0
- package/types/setup-gesture-handler.d.ts +1 -1
- package/types/setup-gesture-handler.d.ts.map +11 -0
- package/types/setup-keyboard-controller.d.ts.map +11 -0
- package/types/setup-keyboard-controller.web.d.ts.map +11 -0
- package/types/setup-safe-area.d.ts.map +11 -0
- package/types/setup-teleport.d.ts.map +11 -0
- package/types/setup-worklets.d.ts.map +11 -0
- package/types/setup-zeego.d.ts.map +11 -0
- package/types/types.d.ts.map +11 -0
- package/types/workletsState.d.ts.map +11 -0
- package/types/zeegoState.d.ts.map +11 -0
- package/gesture-handler/index.cjs +0 -1
- package/gesture-handler/index.js +0 -1
- package/gesture-handler/index.native.cjs +0 -1
- package/gesture-handler/index.native.js +0 -1
- package/setup-burnt/index.cjs +0 -2
- package/setup-burnt/index.js +0 -2
- package/setup-burnt/index.native.cjs +0 -2
- package/setup-burnt/index.native.js +0 -2
- package/setup-expo-linear-gradient/index.cjs +0 -2
- package/setup-expo-linear-gradient/index.js +0 -2
- package/setup-expo-linear-gradient/index.native.cjs +0 -2
- package/setup-expo-linear-gradient/index.native.js +0 -2
- package/setup-gesture-handler/index.cjs +0 -2
- package/setup-gesture-handler/index.js +0 -2
- package/setup-gesture-handler/index.native.cjs +0 -2
- package/setup-gesture-handler/index.native.js +0 -2
- package/setup-keyboard-controller/index.cjs +0 -2
- package/setup-keyboard-controller/index.js +0 -2
- package/setup-keyboard-controller/index.native.cjs +0 -2
- package/setup-keyboard-controller/index.native.js +0 -2
- package/setup-safe-area/index.cjs +0 -2
- package/setup-safe-area/index.js +0 -2
- package/setup-safe-area/index.native.cjs +0 -2
- package/setup-safe-area/index.native.js +0 -2
- package/setup-teleport/index.cjs +0 -2
- package/setup-teleport/index.js +0 -2
- package/setup-teleport/index.native.cjs +0 -2
- package/setup-teleport/index.native.js +0 -2
- package/setup-worklets/index.cjs +0 -2
- package/setup-worklets/index.js +0 -2
- package/setup-worklets/index.native.cjs +0 -2
- package/setup-worklets/index.native.js +0 -2
- package/setup-zeego/index.cjs +0 -2
- package/setup-zeego/index.js +0 -2
- package/setup-zeego/index.native.cjs +0 -2
- package/setup-zeego/index.native.js +0 -2
- package/tsconfig.json +0 -12
|
@@ -36,16 +36,22 @@ const state = (0, import_globalState.createGlobalState)(`gesture`, {
|
|
|
36
36
|
});
|
|
37
37
|
let pressGestureDebugId = 0;
|
|
38
38
|
let externalPressDebugId = 0;
|
|
39
|
+
function getEventPointerId(e) {
|
|
40
|
+
const pointerId = e?.pointerId ?? e?.pointer?.id ?? e?.event?.pointerId ?? e?.event?.pointer?.id ?? e?.nativeEvent?.pointerId ?? e?.nativeEvent?.id ?? e?.event?.nativeEvent?.pointerId ?? e?.event?.nativeEvent?.id ?? null;
|
|
41
|
+
return pointerId == null || Number.isNaN(pointerId) ? null : Number(pointerId);
|
|
42
|
+
}
|
|
39
43
|
const pressState = {
|
|
40
44
|
owner: null,
|
|
41
45
|
ownerId: null,
|
|
42
46
|
ownerSource: null,
|
|
47
|
+
ownerPointerId: null,
|
|
43
48
|
timestamp: 0
|
|
44
49
|
};
|
|
45
50
|
function resetPressOwner() {
|
|
46
51
|
pressState.owner = null;
|
|
47
52
|
pressState.ownerId = null;
|
|
48
53
|
pressState.ownerSource = null;
|
|
54
|
+
pressState.ownerPointerId = null;
|
|
49
55
|
pressState.timestamp = 0;
|
|
50
56
|
}
|
|
51
57
|
function resetStaleOwner(now, debugName) {
|
|
@@ -58,8 +64,6 @@ function claimExternalPressOwnership(debugName) {
|
|
|
58
64
|
resetStaleOwner(now, debugName);
|
|
59
65
|
const token = {};
|
|
60
66
|
const ownerId = ++externalPressDebugId;
|
|
61
|
-
const previousOwnerId = pressState.ownerId;
|
|
62
|
-
const previousOwnerSource = pressState.ownerSource;
|
|
63
67
|
pressState.owner = token;
|
|
64
68
|
pressState.ownerId = ownerId;
|
|
65
69
|
pressState.ownerSource = "external";
|
|
@@ -94,62 +98,78 @@ function getGestureHandler() {
|
|
|
94
98
|
const longPressDuration = config.delayLongPress ?? 500;
|
|
95
99
|
const myToken = {};
|
|
96
100
|
const myDebugId = ++pressGestureDebugId;
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
let didLongPress = false;
|
|
102
|
+
let didPressIn = false;
|
|
103
|
+
let pressInTimer = null;
|
|
104
|
+
const GRACE_PERIOD_MS = process.env.GUI_RNGH_PRESS_DELAY ? +process.env.GUI_RNGH_PRESS_DELAY : 24;
|
|
105
|
+
const tryClaimOwnership = e => {
|
|
99
106
|
const now = Date.now();
|
|
100
107
|
resetStaleOwner(now, config.debugName);
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
if (pressState.owner === null || withinGrace && pressState.ownerSource !== "external") {
|
|
108
|
+
const currentPointerId = getEventPointerId(e);
|
|
109
|
+
const isSameTouchPointer = currentPointerId == null || pressState.ownerPointerId == null || pressState.ownerPointerId === currentPointerId;
|
|
110
|
+
if (pressState.owner === null || pressState.ownerSource === "internal" && isSameTouchPointer) {
|
|
105
111
|
pressState.owner = myToken;
|
|
106
112
|
pressState.ownerId = myDebugId;
|
|
107
113
|
pressState.ownerSource = "internal";
|
|
114
|
+
pressState.ownerPointerId = currentPointerId;
|
|
108
115
|
pressState.timestamp = now;
|
|
109
116
|
}
|
|
110
117
|
return pressState.owner === myToken;
|
|
111
118
|
};
|
|
112
119
|
const isOwner = () => pressState.owner === myToken;
|
|
113
120
|
const releaseOwnership = () => {
|
|
121
|
+
if (pressInTimer) {
|
|
122
|
+
clearTimeout(pressInTimer);
|
|
123
|
+
pressInTimer = null;
|
|
124
|
+
}
|
|
114
125
|
if (pressState.owner === myToken) {
|
|
115
126
|
resetPressOwner();
|
|
116
127
|
}
|
|
117
128
|
};
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
const firePressIn = e => {
|
|
130
|
+
if (!didPressIn && isOwner()) {
|
|
131
|
+
didPressIn = true;
|
|
132
|
+
config.onPressIn?.(e);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const schedulePressIn = e => {
|
|
136
|
+
if (pressInTimer) {
|
|
137
|
+
clearTimeout(pressInTimer);
|
|
138
|
+
}
|
|
139
|
+
pressInTimer = setTimeout(() => {
|
|
140
|
+
pressInTimer = null;
|
|
121
141
|
if (isOwner()) {
|
|
122
|
-
|
|
142
|
+
firePressIn(e);
|
|
123
143
|
}
|
|
124
144
|
}, GRACE_PERIOD_MS + 1);
|
|
145
|
+
};
|
|
146
|
+
const tap = Gesture.Tap().runOnJS(true).maxDuration(1e4).onBegin(e => {
|
|
147
|
+
didLongPress = false;
|
|
148
|
+
didPressIn = false;
|
|
149
|
+
tryClaimOwnership(e);
|
|
150
|
+
schedulePressIn(e);
|
|
125
151
|
}).onEnd(e => {
|
|
126
|
-
if (isOwner()) {
|
|
152
|
+
if (isOwner() && !didLongPress) {
|
|
153
|
+
firePressIn(e);
|
|
127
154
|
config.onPress?.(e);
|
|
128
155
|
}
|
|
129
156
|
}).onFinalize(e => {
|
|
130
157
|
if (isOwner()) {
|
|
131
158
|
config.onPressOut?.(e);
|
|
132
159
|
releaseOwnership();
|
|
160
|
+
} else if (didPressIn) {
|
|
161
|
+
didPressIn = false;
|
|
162
|
+
config.onPressOut?.(e);
|
|
133
163
|
}
|
|
134
164
|
});
|
|
135
165
|
if (config.hitSlop) tap.hitSlop(config.hitSlop);
|
|
136
166
|
if (!config.onLongPress) return tap;
|
|
137
|
-
const longPress = Gesture.LongPress().runOnJS(true).minDuration(longPressDuration).
|
|
138
|
-
|
|
139
|
-
setTimeout(() => {
|
|
140
|
-
if (isOwner()) {
|
|
141
|
-
config.onPressIn?.(e);
|
|
142
|
-
}
|
|
143
|
-
}, GRACE_PERIOD_MS + 1);
|
|
144
|
-
}).onStart(e => {
|
|
167
|
+
const longPress = Gesture.LongPress().runOnJS(true).minDuration(longPressDuration).onStart(e => {
|
|
168
|
+
didLongPress = true;
|
|
145
169
|
if (isOwner()) {
|
|
170
|
+
firePressIn(e);
|
|
146
171
|
config.onLongPress?.(e);
|
|
147
172
|
}
|
|
148
|
-
}).onFinalize(e => {
|
|
149
|
-
if (isOwner()) {
|
|
150
|
-
config.onPressOut?.(e);
|
|
151
|
-
releaseOwnership();
|
|
152
|
-
}
|
|
153
173
|
});
|
|
154
174
|
if (config.hitSlop) longPress.hitSlop(config.hitSlop);
|
|
155
175
|
return Gesture.Exclusive(longPress, tap);
|
|
@@ -38,16 +38,24 @@ var state = (0, import_globalState.createGlobalState)(`gesture`, {
|
|
|
38
38
|
});
|
|
39
39
|
var pressGestureDebugId = 0;
|
|
40
40
|
var externalPressDebugId = 0;
|
|
41
|
+
function getEventPointerId(e) {
|
|
42
|
+
var _e_pointer, _e_event, _e_event_pointer, _e_event1, _e_nativeEvent, _e_nativeEvent1, _e_event_nativeEvent, _e_event2, _e_event_nativeEvent1, _e_event3;
|
|
43
|
+
var _e_pointerId, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
|
|
44
|
+
var pointerId = (_ref6 = (_ref5 = (_ref4 = (_ref3 = (_ref2 = (_ref1 = (_ref = (_e_pointerId = e === null || e === void 0 ? void 0 : e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : e === null || e === void 0 ? void 0 : (_e_pointer = e.pointer) === null || _e_pointer === void 0 ? void 0 : _e_pointer.id) !== null && _ref !== void 0 ? _ref : e === null || e === void 0 ? void 0 : (_e_event = e.event) === null || _e_event === void 0 ? void 0 : _e_event.pointerId) !== null && _ref1 !== void 0 ? _ref1 : e === null || e === void 0 ? void 0 : (_e_event1 = e.event) === null || _e_event1 === void 0 ? void 0 : (_e_event_pointer = _e_event1.pointer) === null || _e_event_pointer === void 0 ? void 0 : _e_event_pointer.id) !== null && _ref2 !== void 0 ? _ref2 : e === null || e === void 0 ? void 0 : (_e_nativeEvent = e.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.pointerId) !== null && _ref3 !== void 0 ? _ref3 : e === null || e === void 0 ? void 0 : (_e_nativeEvent1 = e.nativeEvent) === null || _e_nativeEvent1 === void 0 ? void 0 : _e_nativeEvent1.id) !== null && _ref4 !== void 0 ? _ref4 : e === null || e === void 0 ? void 0 : (_e_event2 = e.event) === null || _e_event2 === void 0 ? void 0 : (_e_event_nativeEvent = _e_event2.nativeEvent) === null || _e_event_nativeEvent === void 0 ? void 0 : _e_event_nativeEvent.pointerId) !== null && _ref5 !== void 0 ? _ref5 : e === null || e === void 0 ? void 0 : (_e_event3 = e.event) === null || _e_event3 === void 0 ? void 0 : (_e_event_nativeEvent1 = _e_event3.nativeEvent) === null || _e_event_nativeEvent1 === void 0 ? void 0 : _e_event_nativeEvent1.id) !== null && _ref6 !== void 0 ? _ref6 : null;
|
|
45
|
+
return pointerId == null || Number.isNaN(pointerId) ? null : Number(pointerId);
|
|
46
|
+
}
|
|
41
47
|
var pressState = {
|
|
42
48
|
owner: null,
|
|
43
49
|
ownerId: null,
|
|
44
50
|
ownerSource: null,
|
|
51
|
+
ownerPointerId: null,
|
|
45
52
|
timestamp: 0
|
|
46
53
|
};
|
|
47
54
|
function resetPressOwner() {
|
|
48
55
|
pressState.owner = null;
|
|
49
56
|
pressState.ownerId = null;
|
|
50
57
|
pressState.ownerSource = null;
|
|
58
|
+
pressState.ownerPointerId = null;
|
|
51
59
|
pressState.timestamp = 0;
|
|
52
60
|
}
|
|
53
61
|
function resetStaleOwner(now, debugName) {
|
|
@@ -60,8 +68,6 @@ function claimExternalPressOwnership(debugName) {
|
|
|
60
68
|
resetStaleOwner(now, debugName);
|
|
61
69
|
var token = {};
|
|
62
70
|
var ownerId = ++externalPressDebugId;
|
|
63
|
-
var previousOwnerId = pressState.ownerId;
|
|
64
|
-
var previousOwnerSource = pressState.ownerSource;
|
|
65
71
|
pressState.owner = token;
|
|
66
72
|
pressState.ownerId = ownerId;
|
|
67
73
|
pressState.ownerSource = "external";
|
|
@@ -97,17 +103,20 @@ function getGestureHandler() {
|
|
|
97
103
|
var longPressDuration = (_config_delayLongPress = config.delayLongPress) !== null && _config_delayLongPress !== void 0 ? _config_delayLongPress : 500;
|
|
98
104
|
var myToken = {};
|
|
99
105
|
var myDebugId = ++pressGestureDebugId;
|
|
100
|
-
var
|
|
101
|
-
var
|
|
106
|
+
var didLongPress = false;
|
|
107
|
+
var didPressIn = false;
|
|
108
|
+
var pressInTimer = null;
|
|
109
|
+
var GRACE_PERIOD_MS = process.env.GUI_RNGH_PRESS_DELAY ? +process.env.GUI_RNGH_PRESS_DELAY : 24;
|
|
110
|
+
var tryClaimOwnership = function (e) {
|
|
102
111
|
var now = Date.now();
|
|
103
112
|
resetStaleOwner(now, config.debugName);
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
if (pressState.owner === null || withinGrace && pressState.ownerSource !== "external") {
|
|
113
|
+
var currentPointerId = getEventPointerId(e);
|
|
114
|
+
var isSameTouchPointer = currentPointerId == null || pressState.ownerPointerId == null || pressState.ownerPointerId === currentPointerId;
|
|
115
|
+
if (pressState.owner === null || pressState.ownerSource === "internal" && isSameTouchPointer) {
|
|
108
116
|
pressState.owner = myToken;
|
|
109
117
|
pressState.ownerId = myDebugId;
|
|
110
118
|
pressState.ownerSource = "internal";
|
|
119
|
+
pressState.ownerPointerId = currentPointerId;
|
|
111
120
|
pressState.timestamp = now;
|
|
112
121
|
}
|
|
113
122
|
return pressState.owner === myToken;
|
|
@@ -116,21 +125,41 @@ function getGestureHandler() {
|
|
|
116
125
|
return pressState.owner === myToken;
|
|
117
126
|
};
|
|
118
127
|
var releaseOwnership = function () {
|
|
128
|
+
if (pressInTimer) {
|
|
129
|
+
clearTimeout(pressInTimer);
|
|
130
|
+
pressInTimer = null;
|
|
131
|
+
}
|
|
119
132
|
if (pressState.owner === myToken) {
|
|
120
133
|
resetPressOwner();
|
|
121
134
|
}
|
|
122
135
|
};
|
|
123
|
-
var
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
var firePressIn = function (e) {
|
|
137
|
+
if (!didPressIn && isOwner()) {
|
|
138
|
+
var _config_onPressIn;
|
|
139
|
+
didPressIn = true;
|
|
140
|
+
(_config_onPressIn = config.onPressIn) === null || _config_onPressIn === void 0 ? void 0 : _config_onPressIn.call(config, e);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
var schedulePressIn = function (e) {
|
|
144
|
+
if (pressInTimer) {
|
|
145
|
+
clearTimeout(pressInTimer);
|
|
146
|
+
}
|
|
147
|
+
pressInTimer = setTimeout(function () {
|
|
148
|
+
pressInTimer = null;
|
|
126
149
|
if (isOwner()) {
|
|
127
|
-
|
|
128
|
-
(_config_onPressIn = config.onPressIn) === null || _config_onPressIn === void 0 ? void 0 : _config_onPressIn.call(config, e);
|
|
150
|
+
firePressIn(e);
|
|
129
151
|
}
|
|
130
152
|
}, GRACE_PERIOD_MS + 1);
|
|
153
|
+
};
|
|
154
|
+
var tap = Gesture.Tap().runOnJS(true).maxDuration(1e4).onBegin(function (e) {
|
|
155
|
+
didLongPress = false;
|
|
156
|
+
didPressIn = false;
|
|
157
|
+
tryClaimOwnership(e);
|
|
158
|
+
schedulePressIn(e);
|
|
131
159
|
}).onEnd(function (e) {
|
|
132
|
-
if (isOwner()) {
|
|
160
|
+
if (isOwner() && !didLongPress) {
|
|
133
161
|
var _config_onPress;
|
|
162
|
+
firePressIn(e);
|
|
134
163
|
(_config_onPress = config.onPress) === null || _config_onPress === void 0 ? void 0 : _config_onPress.call(config, e);
|
|
135
164
|
}
|
|
136
165
|
}).onFinalize(function (e) {
|
|
@@ -138,29 +167,21 @@ function getGestureHandler() {
|
|
|
138
167
|
var _config_onPressOut;
|
|
139
168
|
(_config_onPressOut = config.onPressOut) === null || _config_onPressOut === void 0 ? void 0 : _config_onPressOut.call(config, e);
|
|
140
169
|
releaseOwnership();
|
|
170
|
+
} else if (didPressIn) {
|
|
171
|
+
var _config_onPressOut1;
|
|
172
|
+
didPressIn = false;
|
|
173
|
+
(_config_onPressOut1 = config.onPressOut) === null || _config_onPressOut1 === void 0 ? void 0 : _config_onPressOut1.call(config, e);
|
|
141
174
|
}
|
|
142
175
|
});
|
|
143
176
|
if (config.hitSlop) tap.hitSlop(config.hitSlop);
|
|
144
177
|
if (!config.onLongPress) return tap;
|
|
145
|
-
var longPress = Gesture.LongPress().runOnJS(true).minDuration(longPressDuration).
|
|
146
|
-
|
|
147
|
-
setTimeout(function () {
|
|
148
|
-
if (isOwner()) {
|
|
149
|
-
var _config_onPressIn;
|
|
150
|
-
(_config_onPressIn = config.onPressIn) === null || _config_onPressIn === void 0 ? void 0 : _config_onPressIn.call(config, e);
|
|
151
|
-
}
|
|
152
|
-
}, GRACE_PERIOD_MS + 1);
|
|
153
|
-
}).onStart(function (e) {
|
|
178
|
+
var longPress = Gesture.LongPress().runOnJS(true).minDuration(longPressDuration).onStart(function (e) {
|
|
179
|
+
didLongPress = true;
|
|
154
180
|
if (isOwner()) {
|
|
155
181
|
var _config_onLongPress;
|
|
182
|
+
firePressIn(e);
|
|
156
183
|
(_config_onLongPress = config.onLongPress) === null || _config_onLongPress === void 0 ? void 0 : _config_onLongPress.call(config, e);
|
|
157
184
|
}
|
|
158
|
-
}).onFinalize(function (e) {
|
|
159
|
-
if (isOwner()) {
|
|
160
|
-
var _config_onPressOut;
|
|
161
|
-
(_config_onPressOut = config.onPressOut) === null || _config_onPressOut === void 0 ? void 0 : _config_onPressOut.call(config, e);
|
|
162
|
-
releaseOwnership();
|
|
163
|
-
}
|
|
164
185
|
});
|
|
165
186
|
if (config.hitSlop) longPress.hitSlop(config.hitSlop);
|
|
166
187
|
return Gesture.Exclusive(longPress, tap);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","gestureState_exports","__export","claimExternalPressOwnership","getGestureHandler","releaseExternalPressOwnership","module","exports","import_globalState","require","state","createGlobalState","enabled","Gesture","GestureDetector","ScrollView","pressGestureDebugId","externalPressDebugId","pressState","owner","ownerId","ownerSource","timestamp","resetPressOwner","resetStaleOwner","now","debugName","Date","token","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","gestureState_exports","__export","claimExternalPressOwnership","getGestureHandler","releaseExternalPressOwnership","module","exports","import_globalState","require","state","createGlobalState","enabled","Gesture","GestureDetector","ScrollView","pressGestureDebugId","externalPressDebugId","getEventPointerId","e","_e_pointer","_e_event","_e_event_pointer","_e_event1","_e_nativeEvent","_e_nativeEvent1","_e_event_nativeEvent","_e_event2","_e_event_nativeEvent1","_e_event3","_e_pointerId","_ref","_ref1","_ref2","_ref3","_ref4","_ref5","_ref6","pointerId","pointer","id","event","nativeEvent","Number","isNaN","pressState","owner","ownerId","ownerSource","ownerPointerId","timestamp","resetPressOwner","resetStaleOwner","now","debugName","Date","token","isEnabled","get","set","updates","Object","assign","disable","createPressGesture","config","_config_delayLongPress","longPressDuration","delayLongPress","myToken","myDebugId","didLongPress","didPressIn","pressInTimer","GRACE_PERIOD_MS","process","env","GUI_RNGH_PRESS_DELAY","tryClaimOwnership","currentPointerId","isSameTouchPointer","isOwner","releaseOwnership","clearTimeout","firePressIn","_config_onPressIn","onPressIn","call","schedulePressIn","setTimeout","tap","Tap","runOnJS","maxDuration","onBegin","onEnd","_config_onPress","onPress","onFinalize","_config_onPressOut","onPressOut","_config_onPressOut1","hitSlop","onLongPress","longPress","LongPress","minDuration","onStart"],"sources":["../../src/gestureState.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,oBAAA;AAAAC,QA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GqC,OAAA;MACzC,KAAArC,MAAA,CAAAsC,WAAA,SAAAb,GAAA;MACF,IAAAc,SAAA,GAAA3F,OAAA,CAAA4F,SAAA,GAAAb,OAAA,OAAAc,WAAA,CAAAvC,iBAAA,EAAAwC,OAAA,WAAAxF,CAAA;QACFoD,YAAA","ignoreList":[]}
|
|
@@ -39,8 +39,8 @@ function setupGestureHandler(config) {
|
|
|
39
39
|
if (config) {
|
|
40
40
|
currentConfig = config;
|
|
41
41
|
}
|
|
42
|
-
const isFirstRun = !g.
|
|
43
|
-
g.
|
|
42
|
+
const isFirstRun = !g.__gui_native_gesture_setup_complete;
|
|
43
|
+
g.__gui_native_gesture_setup_complete = true;
|
|
44
44
|
try {
|
|
45
45
|
const rngh = require("react-native-gesture-handler");
|
|
46
46
|
const {
|
|
@@ -55,7 +55,7 @@ function setupGestureHandler(config) {
|
|
|
55
55
|
GestureDetector,
|
|
56
56
|
ScrollView: ScrollView || null
|
|
57
57
|
});
|
|
58
|
-
g.
|
|
58
|
+
g.__gui_sheet_gesture_state__ = {
|
|
59
59
|
enabled: currentConfig.sheet !== false,
|
|
60
60
|
Gesture,
|
|
61
61
|
GestureDetector,
|
|
@@ -41,8 +41,8 @@ function setupGestureHandler(config) {
|
|
|
41
41
|
if (config) {
|
|
42
42
|
currentConfig = config;
|
|
43
43
|
}
|
|
44
|
-
var isFirstRun = !g.
|
|
45
|
-
g.
|
|
44
|
+
var isFirstRun = !g.__gui_native_gesture_setup_complete;
|
|
45
|
+
g.__gui_native_gesture_setup_complete = true;
|
|
46
46
|
try {
|
|
47
47
|
var rngh = require("react-native-gesture-handler");
|
|
48
48
|
var {
|
|
@@ -57,7 +57,7 @@ function setupGestureHandler(config) {
|
|
|
57
57
|
GestureDetector,
|
|
58
58
|
ScrollView: ScrollView || null
|
|
59
59
|
});
|
|
60
|
-
g.
|
|
60
|
+
g.__gui_sheet_gesture_state__ = {
|
|
61
61
|
enabled: currentConfig.sheet !== false,
|
|
62
62
|
Gesture,
|
|
63
63
|
GestureDetector,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","setup_gesture_handler_exports","__export","getGestureHandlerConfig","setupGestureHandler","module","exports","import_gestureState","require","currentConfig","pressEvents","sheet","config","g","globalThis","isFirstRun","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","setup_gesture_handler_exports","__export","getGestureHandlerConfig","setupGestureHandler","module","exports","import_gestureState","require","currentConfig","pressEvents","sheet","config","g","globalThis","isFirstRun","__gui_native_gesture_setup_complete","rngh","Gesture","GestureDetector","ScrollView","getGestureHandler","set","enabled","__gui_sheet_gesture_state__","e"],"sources":["../../src/setup-gesture-handler.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,6BAAA;AAAAC,QAAA,CAAAD,6BAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAA,uBAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AAmBAC,MAAA,CAAAC,OAAA,GAAAV,YAAkC,CAAAK,6BAAA;AASlC,IAAIM,mBAAsC,GAAAC,OAAA;AAAA,IACxCC,aAAa;EACbC,WAAO;EACTC,KAAA;AAEO;AACL,SAAOR,wBAAA;EACT,OAAAM,aAAA;AAEO;AACL,SAAML,mBAAIA,CAAAQ,MAAA;EAGV,IAAIC,CAAA,GAAAC,UAAQ;EACV,IAAAF,MAAA;IACFH,aAAA,GAAAG,MAAA;EAGA;EACA,IAAEG,UAAA,IAAAF,CAAA,CAAAG,mCAAsC;EAExCH,CAAA,CAAAG,mCAAI;EAEF;IACA,IAAAC,IAAQ,GAAAT,OAAS,+BAAgC;IAEjD,IAAI;MAAAU,OAAA;MAAWC,eAAA;MAAiBC;IAAA,IAAAH,IAAA;IAE9B,IAAAC,OAAA,IAAAC,eAAA;MAAwB,EACtB,EAAAZ,mBAAS,CAAAc,iBAA8B,IAAAC,GAAA;QACvCC,OAAA,EAAAd,aAAA,CAAAC,WAAA;QACAQ,OAAA;QACAC,eAAY;QACbC,UAAA,EAAAA,UAAA;MAGD,EAAE;MAA8BP,CAAA,CAC9BW,2BAAuB;QACvBD,OAAA,EAAAd,aAAA,CAAAE,KAAA;QACAO,OAAA;QACAC,eAAY;QACdC,UAAA,EAAAA,UAAA;MACF;IACF;EAEA,SAAAK,CAAA,GACF;AAGA","ignoreList":[]}
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
function setup() {
|
|
3
|
-
if (true) {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
const g = globalThis;
|
|
7
|
-
if (g.__gui_native_safe_area_setup_complete) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
g.__gui_native_safe_area_setup_complete = true;
|
|
11
|
-
try {
|
|
12
|
-
const safeAreaContext = require("react-native-safe-area-context");
|
|
13
|
-
const {
|
|
14
|
-
useSafeAreaInsets,
|
|
15
|
-
useSafeAreaFrame,
|
|
16
|
-
initialWindowMetrics
|
|
17
|
-
} = safeAreaContext;
|
|
18
|
-
if (useSafeAreaInsets) {
|
|
19
|
-
(0, import_safeAreaState.getSafeArea)().set({
|
|
20
|
-
enabled: true,
|
|
21
|
-
useSafeAreaInsets,
|
|
22
|
-
useSafeAreaFrame: useSafeAreaFrame || null,
|
|
23
|
-
initialMetrics: initialWindowMetrics || null
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
} catch {}
|
|
27
|
-
}
|
|
1
|
+
require("./safeAreaState.cjs");
|
|
2
|
+
function setup() {}
|
|
28
3
|
setup();
|
|
@@ -2,29 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
var import_safeAreaState = require("./safeAreaState.native.js");
|
|
4
4
|
function setup() {
|
|
5
|
-
if (false) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
5
|
var g = globalThis;
|
|
9
|
-
if (g.__gui_native_safe_area_setup_complete)
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
6
|
+
if (g.__gui_native_safe_area_setup_complete) return;
|
|
12
7
|
g.__gui_native_safe_area_setup_complete = true;
|
|
13
8
|
try {
|
|
14
|
-
var safeAreaContext = require("react-native-safe-area-context");
|
|
15
9
|
var {
|
|
16
10
|
useSafeAreaInsets,
|
|
17
11
|
useSafeAreaFrame,
|
|
18
12
|
initialWindowMetrics
|
|
19
|
-
} =
|
|
20
|
-
if (useSafeAreaInsets) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
}
|
|
13
|
+
} = require("react-native-safe-area-context");
|
|
14
|
+
if (useSafeAreaInsets) (0, import_safeAreaState.getSafeArea)().set({
|
|
15
|
+
enabled: true,
|
|
16
|
+
useSafeAreaInsets,
|
|
17
|
+
useSafeAreaFrame: useSafeAreaFrame || null,
|
|
18
|
+
initialMetrics: initialWindowMetrics || null
|
|
19
|
+
});
|
|
28
20
|
} catch (e) {}
|
|
29
21
|
}
|
|
30
22
|
setup();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["import_safeAreaState","require","setup","g","globalThis","__gui_native_safe_area_setup_complete","
|
|
1
|
+
{"version":3,"names":["import_safeAreaState","require","setup","g","globalThis","__gui_native_safe_area_setup_complete","useSafeAreaInsets","useSafeAreaFrame","initialWindowMetrics","getSafeArea","set","enabled","initialMetrics","e"],"sources":["../../src/setup-safe-area.ts"],"sourcesContent":[null],"mappings":"AAwBA;;AAEA,IAAAA,oBAAiB,GAAAC,OAAA;AAEf,SAAIC,KAAQA,CAAA;EACV,IAAAC,CAAA,GAAAC,UAAA;EAAA,IACFD,CAAA,CAAAE,qCAAA;EAEAF,CAAA,CAAAE,qCAAU;EACV;IACE;MAAAC,iBAAA;MAAAC,gBAAA;MAAAC;IAAA,IAAAP,OAAA;IACF,IAAAK,iBAAA,MAAAN,oBAAA,CAAAS,WAAA,IAAAC,GAAA;MACAC,OAAE;MAEFL,iBAAI;MACFC,gBAAM,EAAAA,gBAA0B;MAChCK,cAAQ,EAAAJ,oBAAmB;IAE3B;EACE,SAAAK,CAAA;AAAkB;AACPX,KAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","claimExternalPressOwnership","releaseExternalPressOwnership","jsx","composeFirst","ours","theirs","args","composeLast","PressBoundary","forwardRef","PressBoundary2","enabled","stopPropagation","debugName","onTouchStart","onTouchEnd","onTouchCancel","onResponderGrant","onResponderRelease","onResponderTerminate","props","forwardedRef","tokenRef","useRef","isEnabled","claim","useCallback","current","release","useEffect","ref"],"sources":["../../src/PressBoundary.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,IAAA,QAA4B;AACrC,SACEC,2BAAA,EACAC,6BAAA,QAEK;AA+DH,SAAAC,GAAA;AAnDJ,SAASC,aAAiDC,IAAA,EAASC,MAAA,EAAY;EAC7E,OAAO,IAAIC,IAAA,KAAwB;IACjCF,IAAA,CAAK,GAAGE,IAAI;IACZD,MAAA,GAAS,GAAGC,IAAI;EAClB;AACF;AAEA,SAASC,YAAgDF,MAAA,EAAuBD,IAAA,EAAS;EACvF,OAAO,IAAIE,IAAA,KAAwB;IACjCD,MAAA,GAAS,GAAGC,IAAI;IAChBF,IAAA,CAAK,GAAGE,IAAI;EACd;AACF;AAEO,MAAME,aAAA,GAETV,KAAA,CAAMW,UAAA,CAAqC,SAASC,
|
|
1
|
+
{"version":3,"names":["React","View","claimExternalPressOwnership","releaseExternalPressOwnership","jsx","composeFirst","ours","theirs","args","composeLast","PressBoundary","forwardRef","PressBoundary2","enabled","stopPropagation","debugName","onTouchStart","onTouchEnd","onTouchCancel","onResponderGrant","onResponderRelease","onResponderTerminate","props","forwardedRef","tokenRef","useRef","isEnabled","claim","useCallback","current","release","useE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CAASK,OAAA,EAASd,SAAS;IACzDS,QAAA,CAASK,OAAA,GAAU;EACrB,GAAG,CAACd,SAAS,CAAC;EAEdf,KAAA,CAAM+B,SAAA,CAAU,MAAMD,OAAA,EAAS,CAACA,OAAO,CAAC;EAExC,OACE,eAAA1B,GAAA,CAACH,IAAA;IACC+B,GAAA,EAAKT,YAAA;IACJ,GAAGD,KAAA;IACJN,YAAA,EAAcX,YAAA,CAAasB,KAAA,EAAOX,YAAY;IAC9CC,UAAA,EAAYR,WAAA,CAAYQ,UAAA,EAAYa,OAAO;IAC3CZ,aAAA,EAAeT,WAAA,CAAYS,aAAA,EAAeY,OAAO;IACjDX,gBAAA,EAAkBd,YAAA,CAAasB,KAAA,EAAOR,gBAAgB;IACtDC,kBAAA,EAAoBX,WAAA,CAAYW,kBAAA,EAAoBU,OAAO;IAC3DT,oBAAA,EAAsBZ,WAAA,CAAYY,oBAAA,EAAsBS,OAAO;EAAA,CACjE;AAEJ,CAAC","ignoreList":[]}
|
|
@@ -7,16 +7,22 @@ const state = createGlobalState(`gesture`, {
|
|
|
7
7
|
});
|
|
8
8
|
let pressGestureDebugId = 0;
|
|
9
9
|
let externalPressDebugId = 0;
|
|
10
|
+
function getEventPointerId(e) {
|
|
11
|
+
const pointerId = e?.pointerId ?? e?.pointer?.id ?? e?.event?.pointerId ?? e?.event?.pointer?.id ?? e?.nativeEvent?.pointerId ?? e?.nativeEvent?.id ?? e?.event?.nativeEvent?.pointerId ?? e?.event?.nativeEvent?.id ?? null;
|
|
12
|
+
return pointerId == null || Number.isNaN(pointerId) ? null : Number(pointerId);
|
|
13
|
+
}
|
|
10
14
|
const pressState = {
|
|
11
15
|
owner: null,
|
|
12
16
|
ownerId: null,
|
|
13
17
|
ownerSource: null,
|
|
18
|
+
ownerPointerId: null,
|
|
14
19
|
timestamp: 0
|
|
15
20
|
};
|
|
16
21
|
function resetPressOwner() {
|
|
17
22
|
pressState.owner = null;
|
|
18
23
|
pressState.ownerId = null;
|
|
19
24
|
pressState.ownerSource = null;
|
|
25
|
+
pressState.ownerPointerId = null;
|
|
20
26
|
pressState.timestamp = 0;
|
|
21
27
|
}
|
|
22
28
|
function resetStaleOwner(now, debugName) {
|
|
@@ -29,8 +35,6 @@ function claimExternalPressOwnership(debugName) {
|
|
|
29
35
|
resetStaleOwner(now, debugName);
|
|
30
36
|
const token = {};
|
|
31
37
|
const ownerId = ++externalPressDebugId;
|
|
32
|
-
const previousOwnerId = pressState.ownerId;
|
|
33
|
-
const previousOwnerSource = pressState.ownerSource;
|
|
34
38
|
pressState.owner = token;
|
|
35
39
|
pressState.ownerId = ownerId;
|
|
36
40
|
pressState.ownerSource = "external";
|
|
@@ -65,62 +69,78 @@ function getGestureHandler() {
|
|
|
65
69
|
const longPressDuration = config.delayLongPress ?? 500;
|
|
66
70
|
const myToken = {};
|
|
67
71
|
const myDebugId = ++pressGestureDebugId;
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
let didLongPress = false;
|
|
73
|
+
let didPressIn = false;
|
|
74
|
+
let pressInTimer = null;
|
|
75
|
+
const GRACE_PERIOD_MS = process.env.GUI_RNGH_PRESS_DELAY ? +process.env.GUI_RNGH_PRESS_DELAY : 24;
|
|
76
|
+
const tryClaimOwnership = e => {
|
|
70
77
|
const now = Date.now();
|
|
71
78
|
resetStaleOwner(now, config.debugName);
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
if (pressState.owner === null || withinGrace && pressState.ownerSource !== "external") {
|
|
79
|
+
const currentPointerId = getEventPointerId(e);
|
|
80
|
+
const isSameTouchPointer = currentPointerId == null || pressState.ownerPointerId == null || pressState.ownerPointerId === currentPointerId;
|
|
81
|
+
if (pressState.owner === null || pressState.ownerSource === "internal" && isSameTouchPointer) {
|
|
76
82
|
pressState.owner = myToken;
|
|
77
83
|
pressState.ownerId = myDebugId;
|
|
78
84
|
pressState.ownerSource = "internal";
|
|
85
|
+
pressState.ownerPointerId = currentPointerId;
|
|
79
86
|
pressState.timestamp = now;
|
|
80
87
|
}
|
|
81
88
|
return pressState.owner === myToken;
|
|
82
89
|
};
|
|
83
90
|
const isOwner = () => pressState.owner === myToken;
|
|
84
91
|
const releaseOwnership = () => {
|
|
92
|
+
if (pressInTimer) {
|
|
93
|
+
clearTimeout(pressInTimer);
|
|
94
|
+
pressInTimer = null;
|
|
95
|
+
}
|
|
85
96
|
if (pressState.owner === myToken) {
|
|
86
97
|
resetPressOwner();
|
|
87
98
|
}
|
|
88
99
|
};
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
100
|
+
const firePressIn = e => {
|
|
101
|
+
if (!didPressIn && isOwner()) {
|
|
102
|
+
didPressIn = true;
|
|
103
|
+
config.onPressIn?.(e);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const schedulePressIn = e => {
|
|
107
|
+
if (pressInTimer) {
|
|
108
|
+
clearTimeout(pressInTimer);
|
|
109
|
+
}
|
|
110
|
+
pressInTimer = setTimeout(() => {
|
|
111
|
+
pressInTimer = null;
|
|
92
112
|
if (isOwner()) {
|
|
93
|
-
|
|
113
|
+
firePressIn(e);
|
|
94
114
|
}
|
|
95
115
|
}, GRACE_PERIOD_MS + 1);
|
|
116
|
+
};
|
|
117
|
+
const tap = Gesture.Tap().runOnJS(true).maxDuration(1e4).onBegin(e => {
|
|
118
|
+
didLongPress = false;
|
|
119
|
+
didPressIn = false;
|
|
120
|
+
tryClaimOwnership(e);
|
|
121
|
+
schedulePressIn(e);
|
|
96
122
|
}).onEnd(e => {
|
|
97
|
-
if (isOwner()) {
|
|
123
|
+
if (isOwner() && !didLongPress) {
|
|
124
|
+
firePressIn(e);
|
|
98
125
|
config.onPress?.(e);
|
|
99
126
|
}
|
|
100
127
|
}).onFinalize(e => {
|
|
101
128
|
if (isOwner()) {
|
|
102
129
|
config.onPressOut?.(e);
|
|
103
130
|
releaseOwnership();
|
|
131
|
+
} else if (didPressIn) {
|
|
132
|
+
didPressIn = false;
|
|
133
|
+
config.onPressOut?.(e);
|
|
104
134
|
}
|
|
105
135
|
});
|
|
106
136
|
if (config.hitSlop) tap.hitSlop(config.hitSlop);
|
|
107
137
|
if (!config.onLongPress) return tap;
|
|
108
|
-
const longPress = Gesture.LongPress().runOnJS(true).minDuration(longPressDuration).
|
|
109
|
-
|
|
110
|
-
setTimeout(() => {
|
|
111
|
-
if (isOwner()) {
|
|
112
|
-
config.onPressIn?.(e);
|
|
113
|
-
}
|
|
114
|
-
}, GRACE_PERIOD_MS + 1);
|
|
115
|
-
}).onStart(e => {
|
|
138
|
+
const longPress = Gesture.LongPress().runOnJS(true).minDuration(longPressDuration).onStart(e => {
|
|
139
|
+
didLongPress = true;
|
|
116
140
|
if (isOwner()) {
|
|
141
|
+
firePressIn(e);
|
|
117
142
|
config.onLongPress?.(e);
|
|
118
143
|
}
|
|
119
|
-
}).onFinalize(e => {
|
|
120
|
-
if (isOwner()) {
|
|
121
|
-
config.onPressOut?.(e);
|
|
122
|
-
releaseOwnership();
|
|
123
|
-
}
|
|
124
144
|
});
|
|
125
145
|
if (config.hitSlop) longPress.hitSlop(config.hitSlop);
|
|
126
146
|
return Gesture.Exclusive(longPress, tap);
|