@zeey4d/react-native-gesture-engine 1.0.0 → 1.0.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/README.md +1 -0
- package/dist/index.js +38 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -10
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
+
import { Accelerometer, Gyroscope } from 'expo-sensors';
|
|
2
|
+
import { DeviceEventEmitter, Vibration, AccessibilityInfo } from 'react-native';
|
|
3
|
+
import * as Haptics from 'expo-haptics';
|
|
1
4
|
import { useRef, useState, useEffect } from 'react';
|
|
2
5
|
|
|
3
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
-
}) : x)(function(x) {
|
|
6
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
-
});
|
|
9
|
-
|
|
10
6
|
// src/core/EventBus.ts
|
|
11
7
|
var EventBus = class {
|
|
12
8
|
constructor() {
|
|
@@ -222,21 +218,6 @@ var TouchInputProvider = class {
|
|
|
222
218
|
this.eventBus.emit("input:raw" /* InputRaw */, event);
|
|
223
219
|
}
|
|
224
220
|
};
|
|
225
|
-
|
|
226
|
-
// src/input/SensorInputProvider.ts
|
|
227
|
-
var Accelerometer;
|
|
228
|
-
var Gyroscope;
|
|
229
|
-
function loadSensorModules() {
|
|
230
|
-
try {
|
|
231
|
-
const sensors = __require("expo-sensors");
|
|
232
|
-
Accelerometer = sensors.Accelerometer;
|
|
233
|
-
Gyroscope = sensors.Gyroscope;
|
|
234
|
-
} catch {
|
|
235
|
-
console.warn(
|
|
236
|
-
"[GestureEngine] expo-sensors not found. SensorInputProvider will not function."
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
221
|
var SensorInputProvider = class {
|
|
241
222
|
constructor(eventBus, updateIntervalMs = 100) {
|
|
242
223
|
this.eventBus = eventBus;
|
|
@@ -244,7 +225,6 @@ var SensorInputProvider = class {
|
|
|
244
225
|
this.accelSubscription = null;
|
|
245
226
|
this.gyroSubscription = null;
|
|
246
227
|
this.updateIntervalMs = Math.max(16, updateIntervalMs);
|
|
247
|
-
loadSensorModules();
|
|
248
228
|
}
|
|
249
229
|
get isActive() {
|
|
250
230
|
return this._isActive;
|
|
@@ -307,23 +287,12 @@ var SensorInputProvider = class {
|
|
|
307
287
|
}
|
|
308
288
|
}
|
|
309
289
|
};
|
|
310
|
-
|
|
311
|
-
// src/input/HardwareInputProvider.ts
|
|
312
|
-
var DeviceEventEmitter;
|
|
313
|
-
function loadEmitter() {
|
|
314
|
-
try {
|
|
315
|
-
const rn = __require("react-native");
|
|
316
|
-
DeviceEventEmitter = rn.DeviceEventEmitter;
|
|
317
|
-
} catch {
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
290
|
var HardwareInputProvider = class {
|
|
321
291
|
constructor(eventBus, eventName = "onHardwareKey") {
|
|
322
292
|
this.eventBus = eventBus;
|
|
323
293
|
this._isActive = false;
|
|
324
294
|
this.subscription = null;
|
|
325
295
|
this.eventName = eventName;
|
|
326
|
-
loadEmitter();
|
|
327
296
|
}
|
|
328
297
|
get isActive() {
|
|
329
298
|
return this._isActive;
|
|
@@ -1944,27 +1913,11 @@ var CustomAction = class {
|
|
|
1944
1913
|
this.callback(event);
|
|
1945
1914
|
}
|
|
1946
1915
|
};
|
|
1947
|
-
|
|
1948
|
-
// src/feedback/HapticFeedback.ts
|
|
1949
|
-
var Haptics;
|
|
1950
|
-
var Vibration;
|
|
1951
|
-
function loadModules() {
|
|
1952
|
-
try {
|
|
1953
|
-
Haptics = __require("expo-haptics");
|
|
1954
|
-
} catch {
|
|
1955
|
-
}
|
|
1956
|
-
try {
|
|
1957
|
-
const rn = __require("react-native");
|
|
1958
|
-
Vibration = rn.Vibration;
|
|
1959
|
-
} catch {
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
1916
|
var HapticFeedback = class {
|
|
1963
1917
|
constructor(enabled = true) {
|
|
1964
1918
|
this._isSupported = false;
|
|
1965
1919
|
this.useVibrationFallback = false;
|
|
1966
1920
|
this.enabled = enabled;
|
|
1967
|
-
loadModules();
|
|
1968
1921
|
if (Haptics) {
|
|
1969
1922
|
this._isSupported = true;
|
|
1970
1923
|
} else if (Vibration) {
|
|
@@ -2020,21 +1973,10 @@ var VisualFeedback = class {
|
|
|
2020
1973
|
this.callback = callback;
|
|
2021
1974
|
}
|
|
2022
1975
|
};
|
|
2023
|
-
|
|
2024
|
-
// src/feedback/AccessibilityFeedback.ts
|
|
2025
|
-
var AccessibilityInfo;
|
|
2026
|
-
function loadAccessibility() {
|
|
2027
|
-
try {
|
|
2028
|
-
const rn = __require("react-native");
|
|
2029
|
-
AccessibilityInfo = rn.AccessibilityInfo;
|
|
2030
|
-
} catch {
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
1976
|
var AccessibilityFeedback = class {
|
|
2034
1977
|
constructor() {
|
|
2035
1978
|
this._isSupported = false;
|
|
2036
1979
|
this.announcementBuilder = null;
|
|
2037
|
-
loadAccessibility();
|
|
2038
1980
|
this._isSupported = !!AccessibilityInfo?.announceForAccessibility;
|
|
2039
1981
|
}
|
|
2040
1982
|
get isSupported() {
|