@onlynative/inertia 0.0.1-alpha.8 → 0.0.1-alpha.9

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.
Files changed (55) hide show
  1. package/dist/gestureLayer/index.d.mts +2 -2
  2. package/dist/gestureLayer/index.d.ts +2 -2
  3. package/dist/gestureLayer/index.js +3 -1402
  4. package/dist/gestureLayer/index.js.map +1 -1
  5. package/dist/gestureLayer/index.mjs +3 -1402
  6. package/dist/gestureLayer/index.mjs.map +1 -1
  7. package/dist/index.d.mts +3 -3
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +69 -1461
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +70 -1462
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/motion/Image.d.mts +1 -1
  14. package/dist/motion/Image.d.ts +1 -1
  15. package/dist/motion/Image.js +68 -1460
  16. package/dist/motion/Image.js.map +1 -1
  17. package/dist/motion/Image.mjs +70 -1462
  18. package/dist/motion/Image.mjs.map +1 -1
  19. package/dist/motion/Pressable.d.mts +1 -1
  20. package/dist/motion/Pressable.d.ts +1 -1
  21. package/dist/motion/Pressable.js +68 -1460
  22. package/dist/motion/Pressable.js.map +1 -1
  23. package/dist/motion/Pressable.mjs +70 -1462
  24. package/dist/motion/Pressable.mjs.map +1 -1
  25. package/dist/motion/ScrollView.d.mts +1 -1
  26. package/dist/motion/ScrollView.d.ts +1 -1
  27. package/dist/motion/ScrollView.js +68 -1460
  28. package/dist/motion/ScrollView.js.map +1 -1
  29. package/dist/motion/ScrollView.mjs +70 -1462
  30. package/dist/motion/ScrollView.mjs.map +1 -1
  31. package/dist/motion/Text.d.mts +1 -1
  32. package/dist/motion/Text.d.ts +1 -1
  33. package/dist/motion/Text.js +68 -1460
  34. package/dist/motion/Text.js.map +1 -1
  35. package/dist/motion/Text.mjs +70 -1462
  36. package/dist/motion/Text.mjs.map +1 -1
  37. package/dist/motion/View.d.mts +1 -1
  38. package/dist/motion/View.d.ts +1 -1
  39. package/dist/motion/View.js +68 -1460
  40. package/dist/motion/View.js.map +1 -1
  41. package/dist/motion/View.mjs +70 -1462
  42. package/dist/motion/View.mjs.map +1 -1
  43. package/dist/touch/index.d.mts +1 -1
  44. package/dist/touch/index.d.ts +1 -1
  45. package/dist/{types-BwyvoH2V.d.mts → types-cU43dEmH.d.mts} +42 -15
  46. package/dist/{types-BwyvoH2V.d.ts → types-cU43dEmH.d.ts} +42 -15
  47. package/dist/{useGesture-BPPp9LhV.d.ts → useGesture-B7A_1DVg.d.ts} +1 -1
  48. package/dist/{useGesture-BnBF4OtT.d.mts → useGesture-cimMrzC1.d.mts} +1 -1
  49. package/jest-setup.js +4 -0
  50. package/package.json +8 -2
  51. package/src/__type-tests__/variants.test-d.tsx +67 -0
  52. package/src/layout/sharedRegistry.ts +7 -4
  53. package/src/motion/createMotionComponent.tsx +63 -33
  54. package/src/motion/installCheck.ts +7 -11
  55. package/src/types.ts +58 -19
package/dist/index.mjs CHANGED
@@ -1,21 +1,10 @@
1
- import { Platform, TurboModuleRegistry, Image, Pressable, ScrollView, Text, View } from 'react-native';
1
+ import { Image, Pressable, ScrollView, Text, View, Platform } from 'react-native';
2
2
  import { createContext, forwardRef, useRef, useState, useEffect, useMemo, useContext, useCallback, Children, isValidElement } from 'react';
3
- import Animated, { useSharedValue, useAnimatedStyle, interpolateColor, useReducedMotion, withSequence, LinearTransition, runOnJS as runOnJS$1, withRepeat, withTiming, withSpring, withDelay, withDecay, Easing, useAnimatedReaction, useDerivedValue, Extrapolation, useAnimatedScrollHandler, interpolate } from 'react-native-reanimated';
3
+ import Animated, { useSharedValue, useAnimatedStyle, interpolateColor, reanimatedVersion, useReducedMotion, withSequence, LinearTransition, runOnJS, withRepeat, withTiming, withSpring, withDelay, withDecay, Easing, useAnimatedReaction, useDerivedValue, Extrapolation, useAnimatedScrollHandler, interpolate } from 'react-native-reanimated';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
+ import { isWorkletFunction } from 'react-native-worklets';
5
6
 
6
- var __typeError = (msg) => {
7
- throw TypeError(msg);
8
- };
9
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
- }) : x)(function(x) {
12
- if (typeof require !== "undefined") return require.apply(this, arguments);
13
- throw Error('Dynamic require of "' + x + '" is not supported');
14
- });
15
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
16
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
17
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
18
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
7
+ // src/motion/Image.tsx
19
8
  var DEFAULT_MOTION_CONFIG = {
20
9
  reducedMotion: "user"
21
10
  };
@@ -65,1394 +54,6 @@ function isFocusVisible() {
65
54
  ensureInstalled();
66
55
  return modality === "keyboard";
67
56
  }
68
-
69
- // ../../node_modules/react-native-worklets/lib/module/logger.js
70
- var PREFIX = "[Worklets]";
71
- function formatMessage(message) {
72
- return `${PREFIX} ${message}`;
73
- }
74
- var logger = {
75
- warn(message) {
76
- console.warn(formatMessage(message));
77
- },
78
- error(message) {
79
- console.error(formatMessage(message));
80
- }
81
- };
82
-
83
- // ../../node_modules/react-native-worklets/lib/module/runtimeKind.js
84
- var RuntimeKind = /* @__PURE__ */ (function(RuntimeKind2) {
85
- RuntimeKind2[RuntimeKind2["ReactNative"] = 1] = "ReactNative";
86
- RuntimeKind2[RuntimeKind2["UI"] = 2] = "UI";
87
- RuntimeKind2[RuntimeKind2["Worker"] = 3] = "Worker";
88
- return RuntimeKind2;
89
- })({});
90
- if (globalThis.__RUNTIME_KIND === void 0) {
91
- globalThis.__RUNTIME_KIND = RuntimeKind.ReactNative;
92
- }
93
-
94
- // ../../node_modules/react-native-worklets/lib/module/WorkletsError.js
95
- function WorkletsErrorConstructor(message) {
96
- "worklet";
97
- const prefix = "[Worklets]";
98
- const errorInstance = new Error(message ? `${prefix} ${message}` : prefix);
99
- errorInstance.name = `WorkletsError`;
100
- return errorInstance;
101
- }
102
- function registerWorkletsError() {
103
- "worklet";
104
- if (globalThis.__RUNTIME_KIND !== RuntimeKind.ReactNative) {
105
- globalThis.WorkletsError = WorkletsErrorConstructor;
106
- }
107
- }
108
- var WorkletsError = WorkletsErrorConstructor;
109
-
110
- // ../../node_modules/react-native-worklets/lib/module/bundleUnpacker.js
111
- var handleCache = /* @__PURE__ */ new WeakMap();
112
- function bundleValueUnpacker(objectToUnpack, category, remoteFunctionName) {
113
- const workletHash = objectToUnpack.__workletHash;
114
- if (workletHash !== void 0) {
115
- return getWorklet(workletHash, objectToUnpack.__closure);
116
- } else if (objectToUnpack.__init !== void 0) {
117
- let value = handleCache.get(objectToUnpack);
118
- if (value === void 0) {
119
- value = objectToUnpack.__init();
120
- handleCache.set(objectToUnpack, value);
121
- }
122
- return value;
123
- } else if (category === "RemoteFunction") {
124
- const remoteFunctionHolder = () => {
125
- const label = remoteFunctionName ? `function \`${remoteFunctionName}\`` : "anonymous function";
126
- throw new WorkletsError(`Tried to synchronously call a non-worklet ${label} on the UI thread.
127
- See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#tried-to-synchronously-call-a-non-worklet-function-on-the-ui-thread for more details.`);
128
- };
129
- remoteFunctionHolder.__remoteFunction = objectToUnpack;
130
- return remoteFunctionHolder;
131
- } else {
132
- throw new WorkletsError(`Data type in category "${category}" not recognized by value unpacker: "${globalThis._toString(objectToUnpack)}".`);
133
- }
134
- }
135
- function getWorklet(workletHash, closureVariables) {
136
- let worklet;
137
- if (__DEV__) {
138
- try {
139
- worklet = getWorkletFromMetroRequire(workletHash, closureVariables);
140
- } catch (_e) {
141
- logger.error("Unable to resolve worklet with hash " + workletHash + ". Try reloading the app.");
142
- }
143
- } else {
144
- worklet = getWorkletFromMetroRequire(workletHash, closureVariables);
145
- }
146
- return worklet;
147
- }
148
- var metroRequire = globalThis.__r;
149
- function getWorkletFromMetroRequire(workletHash, closureVariables) {
150
- const factory = metroRequire(workletHash).default;
151
- return factory(closureVariables);
152
- }
153
-
154
- // ../../node_modules/react-native-worklets/lib/module/callGuard.js
155
- function callGuardDEV(fn, ...args) {
156
- "worklet";
157
- try {
158
- return fn(...args);
159
- } catch (error) {
160
- if (globalThis.__workletsModuleProxy) {
161
- const {
162
- message,
163
- stack,
164
- name,
165
- jsEngine
166
- } = error;
167
- globalThis.__workletsModuleProxy.reportFatalErrorOnJS(message, stack ?? "", name ?? "WorkletsError", jsEngine ?? "Worklets");
168
- } else {
169
- throw error;
170
- }
171
- }
172
- }
173
- function setupCallGuard() {
174
- "worklet";
175
- if (!globalThis.__callGuardDEV) {
176
- globalThis.__callGuardDEV = callGuardDEV;
177
- }
178
- }
179
-
180
- // ../../node_modules/react-native-worklets/lib/module/errors.js
181
- var _workletStackDetails = /* @__PURE__ */ new Map();
182
- function registerWorkletStackDetails(hash, stackDetails) {
183
- _workletStackDetails.set(hash, stackDetails);
184
- }
185
- function getBundleOffset(error) {
186
- const frame = error.stack?.split("\n")?.[0];
187
- if (frame) {
188
- const parsedFrame = /@([^@]+):(\d+):(\d+)/.exec(frame);
189
- if (parsedFrame) {
190
- const [, file, line, col] = parsedFrame;
191
- return [file, Number(line), Number(col)];
192
- }
193
- }
194
- return ["unknown", 0, 0];
195
- }
196
- function processStack(stack) {
197
- if (stack === "" || stack === void 0) {
198
- return void 0;
199
- }
200
- const workletStackEntries = stack.match(/worklet_(\d+):(\d+):(\d+)/g);
201
- let result = stack;
202
- workletStackEntries?.forEach((match) => {
203
- const [, hash, origLine, origCol] = match.split(/:|_/).map(Number);
204
- const errorDetails = _workletStackDetails.get(hash);
205
- if (!errorDetails) {
206
- return;
207
- }
208
- const [error, lineOffset, colOffset] = errorDetails;
209
- const [bundleFile, bundleLine, bundleCol] = getBundleOffset(error);
210
- const line = origLine + bundleLine + lineOffset;
211
- const col = origCol + bundleCol + colOffset;
212
- result = result.replace(match, `${bundleFile}:${line}:${col}`);
213
- });
214
- return result;
215
- }
216
- function reportFatalRemoteError({
217
- message,
218
- stack,
219
- name,
220
- jsEngine
221
- }, force) {
222
- const error = new WorkletsError();
223
- error.message = message;
224
- error.stack = processStack(stack);
225
- error.name = name;
226
- error.jsEngine = jsEngine;
227
- if (force) {
228
- throw error;
229
- } else {
230
- globalThis.ErrorUtils.reportFatalError(error);
231
- }
232
- }
233
- function registerReportFatalRemoteError() {
234
- globalThis.__reportFatalRemoteError = reportFatalRemoteError;
235
- }
236
- var IS_JEST = !!process.env.JEST_WORKER_ID;
237
- var IS_WEB = Platform.OS === "web";
238
- var IS_WINDOWS = Platform.OS === "windows";
239
- var SHOULD_BE_USE_WEB = IS_JEST || IS_WEB || IS_WINDOWS;
240
-
241
- // ../../node_modules/react-native-worklets/lib/module/PlatformChecker/index.js
242
- var IS_JEST2 = false;
243
- var SHOULD_BE_USE_WEB2 = false;
244
- if (globalThis.__RUNTIME_KIND === RuntimeKind.ReactNative) {
245
- IS_JEST2 = IS_JEST;
246
- SHOULD_BE_USE_WEB2 = SHOULD_BE_USE_WEB;
247
- }
248
-
249
- // ../../node_modules/react-native-worklets/lib/module/runLoop/common/setImmediatePolyfill.js
250
- function setupSetImmediate() {
251
- "worklet";
252
- const setImmediatePolyfill = (callback, ...args) => {
253
- return setTimeout(callback, 0, ...args);
254
- };
255
- const clearImmediatePolyfill = (immediateHandle) => {
256
- clearTimeout(immediateHandle);
257
- };
258
- globalThis.setImmediate = setImmediatePolyfill;
259
- globalThis.clearImmediate = clearImmediatePolyfill;
260
- }
261
-
262
- // ../../node_modules/react-native-worklets/lib/module/runLoop/common/setIntervalPolyfill.js
263
- function setupSetInterval() {
264
- "worklet";
265
- const intervalHandleToTimeoutHandle = /* @__PURE__ */ new Map();
266
- const setIntervalPolyfill = (callback, delay = 0, ...args) => {
267
- let intervalHandle = 0;
268
- const repeatingCallback = () => {
269
- const timeoutHandle = setTimeout(repeatingCallback, delay);
270
- intervalHandleToTimeoutHandle.set(intervalHandle, timeoutHandle);
271
- callback(...args);
272
- };
273
- intervalHandle = setTimeout(repeatingCallback, delay);
274
- intervalHandleToTimeoutHandle.set(intervalHandle, intervalHandle);
275
- return intervalHandle;
276
- };
277
- const clearIntervalPolyfill = (intervalHandle) => {
278
- const timeoutHandle = intervalHandleToTimeoutHandle.get(intervalHandle);
279
- clearTimeout(timeoutHandle);
280
- intervalHandleToTimeoutHandle.delete(intervalHandle);
281
- };
282
- globalThis.setInterval = setIntervalPolyfill;
283
- globalThis.clearInterval = clearIntervalPolyfill;
284
- }
285
-
286
- // ../../node_modules/react-native-worklets/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js
287
- function mockedRequestAnimationFrame(callback) {
288
- return setTimeout(() => callback(performance.now()), 0);
289
- }
290
-
291
- // ../../node_modules/react-native-worklets/lib/module/isSynchronizable.js
292
- function isSynchronizable(value) {
293
- return typeof value === "object" && value !== null && "__synchronizableRef" in value && value.__synchronizableRef === true;
294
- }
295
-
296
- // ../../node_modules/react-native-worklets/lib/module/serializableMappingCache.js
297
- var serializableMappingFlag = /* @__PURE__ */ Symbol("serializable flag");
298
- var cache = SHOULD_BE_USE_WEB2 ? null : /* @__PURE__ */ new WeakMap();
299
- var serializableMappingCache = SHOULD_BE_USE_WEB2 ? {
300
- set() {
301
- },
302
- get() {
303
- return null;
304
- }
305
- } : {
306
- set(serializable, serializableRef) {
307
- cache.set(serializable, serializableRef || serializableMappingFlag);
308
- },
309
- get: cache.get.bind(cache)
310
- };
311
-
312
- // ../../node_modules/react-native-worklets/lib/module/utils/jsVersion.js
313
- var jsVersion = "0.5.1";
314
-
315
- // ../../node_modules/react-native-worklets/lib/module/workletFunction.js
316
- function isWorkletFunction(value) {
317
- "worklet";
318
- return (
319
- // `__workletHash` isn't extracted in Worklet Runtimes.
320
- typeof value === "function" && !!value.__workletHash
321
- );
322
- }
323
-
324
- // ../../node_modules/react-native-worklets/lib/module/WorkletsModule/JSWorklets.js
325
- function createJSWorkletsModule() {
326
- return new JSWorklets();
327
- }
328
- var requestAnimationFrameImpl = IS_JEST2 || !globalThis.requestAnimationFrame ? mockedRequestAnimationFrame : globalThis.requestAnimationFrame;
329
- var JSWorklets = class {
330
- createSerializable() {
331
- throw new WorkletsError("createSerializable should never be called in JSWorklets.");
332
- }
333
- createSerializableString() {
334
- throw new WorkletsError("createSerializableString should never be called in JSWorklets.");
335
- }
336
- createSerializableNumber() {
337
- throw new WorkletsError("createSerializableNumber should never be called in JSWorklets.");
338
- }
339
- createSerializableBoolean() {
340
- throw new WorkletsError("createSerializableBoolean should never be called in JSWorklets.");
341
- }
342
- createSerializableBigInt() {
343
- throw new WorkletsError("createSerializableBigInt should never be called in JSWorklets.");
344
- }
345
- createSerializableUndefined() {
346
- throw new WorkletsError("createSerializableUndefined should never be called in JSWorklets.");
347
- }
348
- createSerializableNull() {
349
- throw new WorkletsError("createSerializableNull should never be called in JSWorklets.");
350
- }
351
- createSerializableTurboModuleLike() {
352
- throw new WorkletsError("createSerializableTurboModuleLike should never be called in JSWorklets.");
353
- }
354
- createSerializableObject() {
355
- throw new WorkletsError("createSerializableObject should never be called in JSWorklets.");
356
- }
357
- createSerializableMap() {
358
- throw new WorkletsError("createSerializableMap should never be called in JSWorklets.");
359
- }
360
- createSerializableSet() {
361
- throw new WorkletsError("createSerializableSet should never be called in JSWorklets.");
362
- }
363
- createSerializableImport() {
364
- throw new WorkletsError("createSerializableImport should never be called in JSWorklets.");
365
- }
366
- createSerializableHostObject() {
367
- throw new WorkletsError("createSerializableHostObject should never be called in JSWorklets.");
368
- }
369
- createSerializableArray() {
370
- throw new WorkletsError("createSerializableArray should never be called in JSWorklets.");
371
- }
372
- createSerializableInitializer() {
373
- throw new WorkletsError("createSerializableInitializer should never be called in JSWorklets.");
374
- }
375
- createSerializableFunction() {
376
- throw new WorkletsError("createSerializableFunction should never be called in JSWorklets.");
377
- }
378
- createSerializableWorklet() {
379
- throw new WorkletsError("createSerializableWorklet should never be called in JSWorklets.");
380
- }
381
- scheduleOnUI(worklet) {
382
- requestAnimationFrameImpl(worklet);
383
- }
384
- executeOnUIRuntimeSync() {
385
- throw new WorkletsError("`executeOnUIRuntimeSync` is not available in JSWorklets.");
386
- }
387
- createWorkletRuntime() {
388
- throw new WorkletsError("createWorkletRuntime is not available in JSWorklets.");
389
- }
390
- scheduleOnRuntime() {
391
- throw new WorkletsError("scheduleOnRuntime is not available in JSWorklets.");
392
- }
393
- createSynchronizable() {
394
- throw new WorkletsError("createSynchronizable should never be called in JSWorklets.");
395
- }
396
- synchronizableGetDirty() {
397
- throw new WorkletsError("synchronizableGetDirty should never be called in JSWorklets.");
398
- }
399
- synchronizableGetBlocking() {
400
- throw new WorkletsError("synchronizableGetBlocking should never be called in JSWorklets.");
401
- }
402
- synchronizableSetBlocking() {
403
- throw new WorkletsError("synchronizableSetBlocking should never be called in JSWorklets.");
404
- }
405
- synchronizableLock() {
406
- throw new WorkletsError("synchronizableLock should never be called in JSWorklets.");
407
- }
408
- synchronizableUnlock() {
409
- throw new WorkletsError("synchronizableUnlock should never be called in JSWorklets.");
410
- }
411
- reportFatalErrorOnJS() {
412
- throw new WorkletsError("reportFatalErrorOnJS should never be called in JSWorklets.");
413
- }
414
- getStaticFeatureFlag() {
415
- return false;
416
- }
417
- setDynamicFeatureFlag() {
418
- }
419
- };
420
- var NativeWorkletsModule_default = TurboModuleRegistry.get("WorkletsModule");
421
-
422
- // ../../node_modules/react-native-worklets/lib/module/specs/index.js
423
- var WorkletsTurboModule = globalThis.__RUNTIME_KIND === RuntimeKind.ReactNative ? NativeWorkletsModule_default : (
424
- // In Bundle Mode, on Worklet Runtimes `RNWorkletsTurboModule` isn't
425
- // available and shouldn't be accessed. We return null here
426
- // to keep the same codebase for the Bundle Mode and legacy behavior.
427
- null
428
- );
429
-
430
- // ../../node_modules/react-native-worklets/lib/module/utils/checkCppVersion.js
431
- function checkCppVersion() {
432
- const cppVersion = global._WORKLETS_VERSION_CPP;
433
- if (cppVersion === void 0) {
434
- logger.warn(`Couldn't determine the version of the native part of Worklets.
435
- See \`https://docs.swmansion.com/react-native-worklets/docs/guides/troubleshooting#couldnt-determine-the-version-of-the-native-part-of-worklets\` for more details.`);
436
- return;
437
- }
438
- const ok = matchVersion(jsVersion, cppVersion);
439
- if (!ok) {
440
- throw new WorkletsError(`Mismatch between JavaScript part and native part of Worklets (${jsVersion} vs ${cppVersion}).
441
- See \`https://docs.swmansion.com/react-native-worklets/docs/guides/troubleshooting#mismatch-between-javascript-part-and-native-part-of-worklets\` for more details.`);
442
- }
443
- }
444
- function matchVersion(version1, version2) {
445
- if (version1.match(/^\d+\.\d+\.\d+$/) && version2.match(/^\d+\.\d+\.\d+$/)) {
446
- const [major1, minor1] = version1.split(".");
447
- const [major2, minor2] = version2.split(".");
448
- return major1 === major2 && minor1 === minor2;
449
- } else {
450
- return version1 === version2;
451
- }
452
- }
453
-
454
- // ../../node_modules/react-native-worklets/lib/module/WorkletsModule/NativeWorklets.js
455
- function createNativeWorkletsModule() {
456
- return new NativeWorklets();
457
- }
458
- var _workletsModuleProxy, _serializableUndefined, _serializableNull, _serializableTrue, _serializableFalse;
459
- var NativeWorklets = class {
460
- constructor() {
461
- __privateAdd(this, _workletsModuleProxy);
462
- __privateAdd(this, _serializableUndefined);
463
- __privateAdd(this, _serializableNull);
464
- __privateAdd(this, _serializableTrue);
465
- __privateAdd(this, _serializableFalse);
466
- globalThis._WORKLETS_VERSION_JS = jsVersion;
467
- if (global.__workletsModuleProxy === void 0 && globalThis.__RUNTIME_KIND === RuntimeKind.ReactNative) {
468
- WorkletsTurboModule?.installTurboModule();
469
- }
470
- if (global.__workletsModuleProxy === void 0) {
471
- throw new WorkletsError(`Native part of Worklets doesn't seem to be initialized.
472
- See https://docs.swmansion.com/react-native-worklets/docs/guides/troubleshooting#native-part-of-worklets-doesnt-seem-to-be-initialized for more details.`);
473
- }
474
- if (__DEV__) {
475
- checkCppVersion();
476
- }
477
- __privateSet(this, _workletsModuleProxy, global.__workletsModuleProxy);
478
- __privateSet(this, _serializableNull, __privateGet(this, _workletsModuleProxy).createSerializableNull());
479
- __privateSet(this, _serializableUndefined, __privateGet(this, _workletsModuleProxy).createSerializableUndefined());
480
- __privateSet(this, _serializableTrue, __privateGet(this, _workletsModuleProxy).createSerializableBoolean(true));
481
- __privateSet(this, _serializableFalse, __privateGet(this, _workletsModuleProxy).createSerializableBoolean(false));
482
- }
483
- createSerializable(value, shouldPersistRemote, nativeStateSource) {
484
- return __privateGet(this, _workletsModuleProxy).createSerializable(value, shouldPersistRemote, nativeStateSource);
485
- }
486
- createSerializableImport(from, to) {
487
- return __privateGet(this, _workletsModuleProxy).createSerializableImport(from, to);
488
- }
489
- createSerializableString(str) {
490
- return __privateGet(this, _workletsModuleProxy).createSerializableString(str);
491
- }
492
- createSerializableNumber(num) {
493
- return __privateGet(this, _workletsModuleProxy).createSerializableNumber(num);
494
- }
495
- createSerializableBoolean(bool) {
496
- return bool ? __privateGet(this, _serializableTrue) : __privateGet(this, _serializableFalse);
497
- }
498
- createSerializableBigInt(bigInt) {
499
- return __privateGet(this, _workletsModuleProxy).createSerializableBigInt(bigInt);
500
- }
501
- createSerializableUndefined() {
502
- return __privateGet(this, _serializableUndefined);
503
- }
504
- createSerializableNull() {
505
- return __privateGet(this, _serializableNull);
506
- }
507
- createSerializableTurboModuleLike(props, proto) {
508
- return __privateGet(this, _workletsModuleProxy).createSerializableTurboModuleLike(props, proto);
509
- }
510
- createSerializableObject(obj, shouldRetainRemote, nativeStateSource) {
511
- return __privateGet(this, _workletsModuleProxy).createSerializableObject(obj, shouldRetainRemote, nativeStateSource);
512
- }
513
- createSerializableHostObject(obj) {
514
- return __privateGet(this, _workletsModuleProxy).createSerializableHostObject(obj);
515
- }
516
- createSerializableArray(array, shouldRetainRemote) {
517
- return __privateGet(this, _workletsModuleProxy).createSerializableArray(array, shouldRetainRemote);
518
- }
519
- createSerializableMap(keys, values) {
520
- return __privateGet(this, _workletsModuleProxy).createSerializableMap(keys, values);
521
- }
522
- createSerializableSet(values) {
523
- return __privateGet(this, _workletsModuleProxy).createSerializableSet(values);
524
- }
525
- createSerializableInitializer(obj) {
526
- return __privateGet(this, _workletsModuleProxy).createSerializableInitializer(obj);
527
- }
528
- createSerializableFunction(func) {
529
- return __privateGet(this, _workletsModuleProxy).createSerializableFunction(func);
530
- }
531
- createSerializableWorklet(worklet, shouldPersistRemote) {
532
- return __privateGet(this, _workletsModuleProxy).createSerializableWorklet(worklet, shouldPersistRemote);
533
- }
534
- scheduleOnUI(serializable) {
535
- return __privateGet(this, _workletsModuleProxy).scheduleOnUI(serializable);
536
- }
537
- executeOnUIRuntimeSync(serializable) {
538
- return __privateGet(this, _workletsModuleProxy).executeOnUIRuntimeSync(serializable);
539
- }
540
- createWorkletRuntime(name, initializer, useDefaultQueue, customQueue, enableEventLoop) {
541
- return __privateGet(this, _workletsModuleProxy).createWorkletRuntime(name, initializer, useDefaultQueue, customQueue, enableEventLoop);
542
- }
543
- scheduleOnRuntime(workletRuntime, serializableWorklet) {
544
- return __privateGet(this, _workletsModuleProxy).scheduleOnRuntime(workletRuntime, serializableWorklet);
545
- }
546
- createSynchronizable(value) {
547
- return __privateGet(this, _workletsModuleProxy).createSynchronizable(value);
548
- }
549
- synchronizableGetDirty(synchronizableRef) {
550
- return __privateGet(this, _workletsModuleProxy).synchronizableGetDirty(synchronizableRef);
551
- }
552
- synchronizableGetBlocking(synchronizableRef) {
553
- return __privateGet(this, _workletsModuleProxy).synchronizableGetBlocking(synchronizableRef);
554
- }
555
- synchronizableSetBlocking(synchronizableRef, value) {
556
- return __privateGet(this, _workletsModuleProxy).synchronizableSetBlocking(synchronizableRef, value);
557
- }
558
- synchronizableLock(synchronizableRef) {
559
- return __privateGet(this, _workletsModuleProxy).synchronizableLock(synchronizableRef);
560
- }
561
- synchronizableUnlock(synchronizableRef) {
562
- return __privateGet(this, _workletsModuleProxy).synchronizableUnlock(synchronizableRef);
563
- }
564
- reportFatalErrorOnJS(message, stack, name, jsEngine) {
565
- return __privateGet(this, _workletsModuleProxy).reportFatalErrorOnJS(message, stack, name, jsEngine);
566
- }
567
- getStaticFeatureFlag(name) {
568
- return __privateGet(this, _workletsModuleProxy).getStaticFeatureFlag(name);
569
- }
570
- setDynamicFeatureFlag(name, value) {
571
- __privateGet(this, _workletsModuleProxy).setDynamicFeatureFlag(name, value);
572
- }
573
- };
574
- _workletsModuleProxy = new WeakMap();
575
- _serializableUndefined = new WeakMap();
576
- _serializableNull = new WeakMap();
577
- _serializableTrue = new WeakMap();
578
- _serializableFalse = new WeakMap();
579
-
580
- // ../../node_modules/react-native-worklets/lib/module/WorkletsModule/workletsModuleInstance.js
581
- var WorkletsModule = SHOULD_BE_USE_WEB2 ? createJSWorkletsModule() : createNativeWorkletsModule();
582
-
583
- // ../../node_modules/react-native-worklets/lib/module/serializable.js
584
- var MAGIC_KEY = "REANIMATED_MAGIC_KEY";
585
- function isHostObject(value) {
586
- "worklet";
587
- return MAGIC_KEY in value;
588
- }
589
- function isPlainJSObject(object) {
590
- "worklet";
591
- return Object.getPrototypeOf(object) === Object.prototype;
592
- }
593
- function isTurboModuleLike(object) {
594
- return isHostObject(Object.getPrototypeOf(object));
595
- }
596
- function getFromCache(value) {
597
- const cached = serializableMappingCache.get(value);
598
- if (cached === serializableMappingFlag) {
599
- return value;
600
- }
601
- return cached;
602
- }
603
- var INACCESSIBLE_OBJECT = {
604
- __init: () => {
605
- "worklet";
606
- return new Proxy({}, {
607
- get: (_, prop) => {
608
- if (prop === "_isReanimatedSharedValue" || prop === "__remoteFunction") {
609
- return false;
610
- }
611
- throw new WorkletsError(`Trying to access property \`${String(prop)}\` of an object which cannot be sent to the UI runtime.`);
612
- },
613
- set: () => {
614
- throw new WorkletsError("Trying to write to an object which cannot be sent to the UI runtime.");
615
- }
616
- });
617
- }
618
- };
619
- var VALID_ARRAY_VIEWS_NAMES = ["Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "BigInt64Array", "BigUint64Array", "DataView"];
620
- var DETECT_CYCLIC_OBJECT_DEPTH_THRESHOLD = 30;
621
- var processedObjectAtThresholdDepth;
622
- function createSerializableWeb(value) {
623
- return value;
624
- }
625
- function createSerializableNative(value, shouldPersistRemote = false, depth = 0) {
626
- detectCyclicObject(value, depth);
627
- const isObject = typeof value === "object";
628
- const isFunction = typeof value === "function";
629
- if (typeof value === "string") {
630
- return cloneString(value);
631
- }
632
- if (typeof value === "number") {
633
- return cloneNumber(value);
634
- }
635
- if (typeof value === "boolean") {
636
- return cloneBoolean(value);
637
- }
638
- if (typeof value === "bigint") {
639
- return cloneBigInt(value);
640
- }
641
- if (value === void 0) {
642
- return cloneUndefined();
643
- }
644
- if (value === null) {
645
- return cloneNull();
646
- }
647
- if (!isObject && !isFunction || value === null) {
648
- return clonePrimitive(value, shouldPersistRemote);
649
- }
650
- const cached = getFromCache(value);
651
- if (cached !== void 0) {
652
- return cached;
653
- }
654
- if (Array.isArray(value)) {
655
- return cloneArray(value, shouldPersistRemote, depth);
656
- }
657
- if (globalThis._WORKLETS_BUNDLE_MODE && isFunction && value.__bundleData) {
658
- return cloneImport(value);
659
- }
660
- if (isFunction && !isWorkletFunction(value)) {
661
- return cloneRemoteFunction(value);
662
- }
663
- if (isTurboModuleLike(value)) {
664
- return cloneTurboModuleLike(value, shouldPersistRemote, depth);
665
- }
666
- if (isHostObject(value)) {
667
- return cloneHostObject(value);
668
- }
669
- if (isPlainJSObject(value) && value.__init) {
670
- return cloneInitializer(value, shouldPersistRemote, depth);
671
- }
672
- if (isPlainJSObject(value) && value.__workletContextObjectFactory) {
673
- return cloneContextObject(value);
674
- }
675
- if ((isPlainJSObject(value) || isFunction) && isWorkletFunction(value)) {
676
- return cloneWorklet(value, shouldPersistRemote, depth);
677
- }
678
- if (isSynchronizable(value)) {
679
- return cloneSynchronizable(value);
680
- }
681
- if (isPlainJSObject(value) || isFunction) {
682
- return clonePlainJSObject(value, shouldPersistRemote, depth);
683
- }
684
- if (value instanceof Set) {
685
- return cloneSet(value);
686
- }
687
- if (value instanceof Map) {
688
- return cloneMap(value);
689
- }
690
- if (value instanceof RegExp) {
691
- return cloneRegExp(value);
692
- }
693
- if (value instanceof Error) {
694
- return cloneError(value);
695
- }
696
- if (value instanceof ArrayBuffer) {
697
- return cloneArrayBuffer(value, shouldPersistRemote);
698
- }
699
- if (ArrayBuffer.isView(value)) {
700
- return cloneArrayBufferView(value);
701
- }
702
- return inaccessibleObject(value);
703
- }
704
- if (globalThis._WORKLETS_BUNDLE_MODE) {
705
- createSerializableNative.__bundleData = {
706
- imported: "createSerializable",
707
- // @ts-expect-error resolveWeak is defined by Metro
708
- source: __require.resolveWeak("./index")
709
- };
710
- }
711
- var createSerializable = SHOULD_BE_USE_WEB2 ? createSerializableWeb : createSerializableNative;
712
- function detectCyclicObject(value, depth) {
713
- if (depth >= DETECT_CYCLIC_OBJECT_DEPTH_THRESHOLD) {
714
- if (depth === DETECT_CYCLIC_OBJECT_DEPTH_THRESHOLD) {
715
- processedObjectAtThresholdDepth = value;
716
- } else if (value === processedObjectAtThresholdDepth) {
717
- throw new WorkletsError("Trying to convert a cyclic object to a serializable. This is not supported.");
718
- }
719
- } else {
720
- processedObjectAtThresholdDepth = void 0;
721
- }
722
- }
723
- function clonePrimitive(value, shouldPersistRemote) {
724
- return WorkletsModule.createSerializable(value, shouldPersistRemote);
725
- }
726
- function cloneString(value) {
727
- return WorkletsModule.createSerializableString(value);
728
- }
729
- function cloneNumber(value) {
730
- return WorkletsModule.createSerializableNumber(value);
731
- }
732
- function cloneBoolean(value) {
733
- return WorkletsModule.createSerializableBoolean(value);
734
- }
735
- function cloneBigInt(value) {
736
- return WorkletsModule.createSerializableBigInt(value);
737
- }
738
- function cloneUndefined() {
739
- return WorkletsModule.createSerializableUndefined();
740
- }
741
- function cloneNull() {
742
- return WorkletsModule.createSerializableNull();
743
- }
744
- function cloneObjectProperties(value, shouldPersistRemote, depth) {
745
- const clonedProps = {};
746
- for (const [key, element] of Object.entries(value)) {
747
- if (key === "__initData" && clonedProps.__initData !== void 0) {
748
- continue;
749
- }
750
- clonedProps[key] = createSerializable(element, shouldPersistRemote, depth + 1);
751
- }
752
- return clonedProps;
753
- }
754
- function cloneInitializer(value, shouldPersistRemote = false, depth = 0) {
755
- const clonedProps = cloneObjectProperties(value, shouldPersistRemote, depth);
756
- return WorkletsModule.createSerializableInitializer(clonedProps);
757
- }
758
- function cloneArray(value, shouldPersistRemote, depth) {
759
- const clonedElements = value.map((element) => createSerializable(element, shouldPersistRemote, depth + 1));
760
- const clone = WorkletsModule.createSerializableArray(clonedElements, shouldPersistRemote);
761
- serializableMappingCache.set(value, clone);
762
- serializableMappingCache.set(clone);
763
- freezeObjectInDev(value);
764
- return clone;
765
- }
766
- function cloneRemoteFunction(value) {
767
- const clone = WorkletsModule.createSerializableFunction(value);
768
- serializableMappingCache.set(value, clone);
769
- serializableMappingCache.set(clone);
770
- freezeObjectInDev(value);
771
- return clone;
772
- }
773
- function cloneHostObject(value) {
774
- const clone = WorkletsModule.createSerializableHostObject(value);
775
- serializableMappingCache.set(value, clone);
776
- serializableMappingCache.set(clone);
777
- return clone;
778
- }
779
- function cloneWorklet(value, shouldPersistRemote, depth) {
780
- if (__DEV__) {
781
- const babelVersion = value.__pluginVersion;
782
- if (babelVersion !== void 0 && babelVersion !== jsVersion) {
783
- throw new WorkletsError(`Mismatch between JavaScript code version and Worklets Babel plugin version (${jsVersion} vs. ${babelVersion}).
784
- See \`https://docs.swmansion.com/react-native-worklets/docs/guides/troubleshooting#mismatch-between-javascript-code-version-and-worklets-babel-plugin-version\` for more details.
785
- Offending code was: \`${getWorkletCode(value)}\``);
786
- }
787
- registerWorkletStackDetails(value.__workletHash, value.__stackDetails);
788
- }
789
- if (value.__stackDetails) {
790
- delete value.__stackDetails;
791
- }
792
- const clonedProps = cloneObjectProperties(value, true, depth);
793
- clonedProps.__initData = createSerializable(value.__initData, true, depth + 1);
794
- const clone = WorkletsModule.createSerializableWorklet(
795
- clonedProps,
796
- // TODO: Check after refactor if we can remove shouldPersistRemote parameter (imho it's redundant here since worklets are always persistent)
797
- // retain all worklets
798
- true
799
- );
800
- serializableMappingCache.set(value, clone);
801
- serializableMappingCache.set(clone);
802
- freezeObjectInDev(value);
803
- return clone;
804
- }
805
- function cloneTurboModuleLike(value, shouldPersistRemote, depth) {
806
- const proto = Object.getPrototypeOf(value);
807
- const clonedProps = cloneObjectProperties(value, shouldPersistRemote, depth);
808
- const clone = WorkletsModule.createSerializableTurboModuleLike(clonedProps, proto);
809
- return clone;
810
- }
811
- function cloneContextObject(value) {
812
- const workletContextObjectFactory = value.__workletContextObjectFactory;
813
- const handle = cloneInitializer({
814
- __init: () => {
815
- "worklet";
816
- return workletContextObjectFactory();
817
- }
818
- });
819
- serializableMappingCache.set(value, handle);
820
- return handle;
821
- }
822
- function clonePlainJSObject(value, shouldPersistRemote, depth) {
823
- const clonedProps = cloneObjectProperties(value, shouldPersistRemote, depth);
824
- const clone = WorkletsModule.createSerializableObject(clonedProps, shouldPersistRemote, value);
825
- serializableMappingCache.set(value, clone);
826
- serializableMappingCache.set(clone);
827
- freezeObjectInDev(value);
828
- return clone;
829
- }
830
- function cloneMap(value) {
831
- const clonedKeys = [];
832
- const clonedValues = [];
833
- for (const [key, element] of value.entries()) {
834
- clonedKeys.push(createSerializable(key));
835
- clonedValues.push(createSerializable(element));
836
- }
837
- const clone = WorkletsModule.createSerializableMap(clonedKeys, clonedValues);
838
- serializableMappingCache.set(value, clone);
839
- serializableMappingCache.set(clone);
840
- freezeObjectInDev(value);
841
- return clone;
842
- }
843
- function cloneSet(value) {
844
- const clonedElements = [];
845
- for (const element of value) {
846
- clonedElements.push(createSerializable(element));
847
- }
848
- const clone = WorkletsModule.createSerializableSet(clonedElements);
849
- serializableMappingCache.set(value, clone);
850
- serializableMappingCache.set(clone);
851
- freezeObjectInDev(value);
852
- return clone;
853
- }
854
- function cloneRegExp(value) {
855
- const pattern = value.source;
856
- const flags = value.flags;
857
- const handle = cloneInitializer({
858
- __init: () => {
859
- "worklet";
860
- return new RegExp(pattern, flags);
861
- }
862
- });
863
- serializableMappingCache.set(value, handle);
864
- return handle;
865
- }
866
- function cloneError(value) {
867
- const {
868
- name,
869
- message,
870
- stack
871
- } = value;
872
- const handle = cloneInitializer({
873
- __init: () => {
874
- "worklet";
875
- const error = new Error();
876
- error.name = name;
877
- error.message = message;
878
- error.stack = stack;
879
- return error;
880
- }
881
- });
882
- serializableMappingCache.set(value, handle);
883
- return handle;
884
- }
885
- function cloneArrayBuffer(value, shouldPersistRemote) {
886
- const clone = WorkletsModule.createSerializable(value, shouldPersistRemote, value);
887
- serializableMappingCache.set(value, clone);
888
- serializableMappingCache.set(clone);
889
- return clone;
890
- }
891
- function cloneArrayBufferView(value) {
892
- const buffer = value.buffer;
893
- const typeName = value.constructor.name;
894
- const handle = cloneInitializer({
895
- __init: () => {
896
- "worklet";
897
- if (!VALID_ARRAY_VIEWS_NAMES.includes(typeName)) {
898
- throw new WorkletsError(`Invalid array view name \`${typeName}\`.`);
899
- }
900
- const constructor = global[typeName];
901
- if (constructor === void 0) {
902
- throw new WorkletsError(`Constructor for \`${typeName}\` not found.`);
903
- }
904
- return new constructor(buffer);
905
- }
906
- });
907
- serializableMappingCache.set(value, handle);
908
- return handle;
909
- }
910
- function cloneSynchronizable(value) {
911
- serializableMappingCache.set(value);
912
- return value;
913
- }
914
- function cloneImport(value) {
915
- const {
916
- source,
917
- imported
918
- } = value.__bundleData;
919
- const clone = WorkletsModule.createSerializableImport(source, imported);
920
- serializableMappingCache.set(value, clone);
921
- serializableMappingCache.set(clone);
922
- return clone;
923
- }
924
- function inaccessibleObject(value) {
925
- const clone = createSerializable(INACCESSIBLE_OBJECT);
926
- serializableMappingCache.set(value, clone);
927
- return clone;
928
- }
929
- var WORKLET_CODE_THRESHOLD = 255;
930
- function getWorkletCode(value) {
931
- const code = value?.__initData?.code;
932
- if (!code) {
933
- return "unknown";
934
- }
935
- if (code.length > WORKLET_CODE_THRESHOLD) {
936
- return `${code.substring(0, WORKLET_CODE_THRESHOLD)}...`;
937
- }
938
- return code;
939
- }
940
- function isRemoteFunction(value) {
941
- "worklet";
942
- return !!value.__remoteFunction;
943
- }
944
- function freezeObjectInDev(value) {
945
- if (!__DEV__) {
946
- return;
947
- }
948
- Object.entries(value).forEach(([key, element]) => {
949
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
950
- if (!descriptor.configurable) {
951
- return;
952
- }
953
- Object.defineProperty(value, key, {
954
- get() {
955
- return element;
956
- },
957
- set() {
958
- logger.warn(`Tried to modify key \`${key}\` of an object which has been already passed to a worklet. See
959
- https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#tried-to-modify-key-of-an-object-which-has-been-converted-to-a-serializable
960
- for more details.`);
961
- }
962
- });
963
- });
964
- Object.preventExtensions(value);
965
- }
966
- function makeShareableCloneOnUIRecursiveLEGACY(value) {
967
- "worklet";
968
- if (SHOULD_BE_USE_WEB2) {
969
- return value;
970
- }
971
- function cloneRecursive(value2) {
972
- if (typeof value2 === "object" && value2 !== null || typeof value2 === "function") {
973
- if (isHostObject(value2)) {
974
- return global._createSerializableHostObject(value2);
975
- }
976
- if (isRemoteFunction(value2)) {
977
- return value2.__remoteFunction;
978
- }
979
- if (Array.isArray(value2)) {
980
- return global._createSerializableArray(value2.map(cloneRecursive));
981
- }
982
- if (value2.__synchronizableRef) {
983
- return global._createSerializableSynchronizable(value2);
984
- }
985
- const toAdapt = {};
986
- for (const [key, element] of Object.entries(value2)) {
987
- toAdapt[key] = cloneRecursive(element);
988
- }
989
- return global._createSerializable(toAdapt, value2);
990
- }
991
- if (typeof value2 === "string") {
992
- return global._createSerializableString(value2);
993
- }
994
- if (typeof value2 === "number") {
995
- return global._createSerializableNumber(value2);
996
- }
997
- if (typeof value2 === "boolean") {
998
- return global._createSerializableBoolean(value2);
999
- }
1000
- if (typeof value2 === "bigint") {
1001
- return global._createSerializableBigInt(value2);
1002
- }
1003
- if (value2 === void 0) {
1004
- return global._createSerializableUndefined();
1005
- }
1006
- if (value2 === null) {
1007
- return global._createSerializableNull();
1008
- }
1009
- return global._createSerializable(value2, void 0);
1010
- }
1011
- return cloneRecursive(value);
1012
- }
1013
- var makeShareableCloneOnUIRecursive = globalThis._WORKLETS_BUNDLE_MODE ? createSerializable : makeShareableCloneOnUIRecursiveLEGACY;
1014
-
1015
- // ../../node_modules/react-native-worklets/lib/module/threads.js
1016
- var runOnUIQueue = [];
1017
- function setupMicrotasks() {
1018
- "worklet";
1019
- let microtasksQueue = [];
1020
- let isExecutingMicrotasksQueue = false;
1021
- global.queueMicrotask = (callback) => {
1022
- microtasksQueue.push(callback);
1023
- };
1024
- global._microtaskQueueFinalizers = [];
1025
- global.__callMicrotasks = () => {
1026
- if (isExecutingMicrotasksQueue) {
1027
- return;
1028
- }
1029
- try {
1030
- isExecutingMicrotasksQueue = true;
1031
- for (let index = 0; index < microtasksQueue.length; index += 1) {
1032
- microtasksQueue[index]();
1033
- }
1034
- microtasksQueue = [];
1035
- global._microtaskQueueFinalizers.forEach((finalizer) => finalizer());
1036
- } finally {
1037
- isExecutingMicrotasksQueue = false;
1038
- }
1039
- };
1040
- }
1041
- function callMicrotasksOnUIThread() {
1042
- "worklet";
1043
- global.__callMicrotasks();
1044
- }
1045
- var callMicrotasks = SHOULD_BE_USE_WEB2 ? () => {
1046
- } : callMicrotasksOnUIThread;
1047
- function runOnUI(worklet) {
1048
- if (__DEV__ && !SHOULD_BE_USE_WEB2 && !isWorkletFunction(worklet) && !worklet.__bundleData) {
1049
- throw new WorkletsError("`runOnUI` can only be used with worklets.");
1050
- }
1051
- return (...args) => {
1052
- if (IS_JEST2) {
1053
- WorkletsModule.scheduleOnUI(createSerializable(() => {
1054
- "worklet";
1055
- worklet(...args);
1056
- }));
1057
- return;
1058
- }
1059
- if (__DEV__) {
1060
- createSerializable(worklet);
1061
- createSerializable(args);
1062
- }
1063
- enqueueUI(worklet, args);
1064
- };
1065
- }
1066
- if (__DEV__) {
1067
- let runOnUIWorklet = function() {
1068
- "worklet";
1069
- throw new WorkletsError("`runOnUI` cannot be called on the UI runtime. Please call the function synchronously or use `queueMicrotask` or `requestAnimationFrame` instead.");
1070
- };
1071
- const serializableRunOnUIWorklet = createSerializable(runOnUIWorklet);
1072
- serializableMappingCache.set(runOnUI, serializableRunOnUIWorklet);
1073
- }
1074
- function executeOnUIRuntimeSync(worklet) {
1075
- return (...args) => {
1076
- return WorkletsModule.executeOnUIRuntimeSync(createSerializable(() => {
1077
- "worklet";
1078
- const result = worklet(...args);
1079
- return makeShareableCloneOnUIRecursive(result);
1080
- }));
1081
- };
1082
- }
1083
- function runWorkletOnJS(worklet, ...args) {
1084
- worklet(...args);
1085
- }
1086
- function runOnJS(fun) {
1087
- "worklet";
1088
- if (SHOULD_BE_USE_WEB2 || globalThis.__RUNTIME_KIND === RuntimeKind.ReactNative) {
1089
- return (...args) => queueMicrotask(args.length ? () => fun(...args) : fun);
1090
- }
1091
- if (isWorkletFunction(fun)) {
1092
- return (...args) => runOnJS(runWorkletOnJS)(fun, ...args);
1093
- }
1094
- if (fun.__remoteFunction) {
1095
- fun = fun.__remoteFunction;
1096
- }
1097
- const scheduleOnJS = typeof fun === "function" ? global._scheduleHostFunctionOnJS : global._scheduleRemoteFunctionOnJS;
1098
- return (...args) => {
1099
- scheduleOnJS(fun, args.length > 0 ? makeShareableCloneOnUIRecursive(args) : void 0);
1100
- };
1101
- }
1102
- function runOnUIAsync(worklet) {
1103
- if (__DEV__ && !SHOULD_BE_USE_WEB2 && !isWorkletFunction(worklet)) {
1104
- throw new WorkletsError("`runOnUIAsync` can only be used with worklets.");
1105
- }
1106
- return (...args) => {
1107
- return new Promise((resolve) => {
1108
- if (IS_JEST2) {
1109
- WorkletsModule.scheduleOnUI(createSerializable(() => {
1110
- "worklet";
1111
- worklet(...args);
1112
- }));
1113
- return;
1114
- }
1115
- if (__DEV__) {
1116
- createSerializable(worklet);
1117
- createSerializable(args);
1118
- }
1119
- enqueueUI(worklet, args, resolve);
1120
- });
1121
- };
1122
- }
1123
- if (__DEV__) {
1124
- let runOnUIAsyncWorklet = function() {
1125
- "worklet";
1126
- throw new WorkletsError("`runOnUIAsync` cannot be called on the UI runtime. Please call the function synchronously or use `queueMicrotask` or `requestAnimationFrame` instead.");
1127
- };
1128
- const serializableRunOnUIAsyncWorklet = createSerializable(runOnUIAsyncWorklet);
1129
- serializableMappingCache.set(runOnUIAsync, serializableRunOnUIAsyncWorklet);
1130
- }
1131
- function enqueueUI(worklet, args, resolve) {
1132
- const job = [worklet, args, resolve];
1133
- runOnUIQueue.push(job);
1134
- if (runOnUIQueue.length === 1) {
1135
- flushUIQueue();
1136
- }
1137
- }
1138
- function flushUIQueue() {
1139
- queueMicrotask(() => {
1140
- const queue = runOnUIQueue;
1141
- runOnUIQueue = [];
1142
- WorkletsModule.scheduleOnUI(createSerializable(() => {
1143
- "worklet";
1144
- queue.forEach(([workletFunction, workletArgs, jobResolve]) => {
1145
- const result = workletFunction(...workletArgs);
1146
- if (jobResolve) {
1147
- runOnJS(jobResolve)(result);
1148
- }
1149
- });
1150
- callMicrotasks();
1151
- }));
1152
- });
1153
- }
1154
-
1155
- // ../../node_modules/react-native-worklets/lib/module/runLoop/uiRuntime/requestAnimationFrame.js
1156
- function setupRequestAnimationFrame() {
1157
- "worklet";
1158
- const nativeRequestAnimationFrame = globalThis.requestAnimationFrame;
1159
- let queuedCallbacks = [];
1160
- let queuedCallbacksBegin = 0;
1161
- let queuedCallbacksEnd = 0;
1162
- let flushedCallbacks = queuedCallbacks;
1163
- let flushedCallbacksBegin = 0;
1164
- let flushedCallbacksEnd = 0;
1165
- let flushRequested = false;
1166
- globalThis.__flushAnimationFrame = (timestamp) => {
1167
- flushedCallbacks = queuedCallbacks;
1168
- queuedCallbacks = [];
1169
- flushedCallbacksBegin = queuedCallbacksBegin;
1170
- flushedCallbacksEnd = queuedCallbacksEnd;
1171
- queuedCallbacksBegin = queuedCallbacksEnd;
1172
- for (const callback of flushedCallbacks) {
1173
- callback(timestamp);
1174
- }
1175
- flushedCallbacksBegin = flushedCallbacksEnd;
1176
- callMicrotasks();
1177
- };
1178
- globalThis.requestAnimationFrame = (callback) => {
1179
- const handle = queuedCallbacksEnd++;
1180
- queuedCallbacks.push(callback);
1181
- if (!flushRequested) {
1182
- flushRequested = true;
1183
- nativeRequestAnimationFrame((timestamp) => {
1184
- flushRequested = false;
1185
- globalThis.__frameTimestamp = timestamp;
1186
- globalThis.__flushAnimationFrame(timestamp);
1187
- globalThis.__frameTimestamp = void 0;
1188
- });
1189
- }
1190
- return handle;
1191
- };
1192
- globalThis.cancelAnimationFrame = (handle) => {
1193
- if (handle < flushedCallbacksBegin || handle >= queuedCallbacksEnd) {
1194
- return;
1195
- }
1196
- if (handle < flushedCallbacksEnd) {
1197
- flushedCallbacks[handle - flushedCallbacksBegin] = () => {
1198
- };
1199
- } else {
1200
- queuedCallbacks[handle - queuedCallbacksBegin] = () => {
1201
- };
1202
- }
1203
- };
1204
- }
1205
-
1206
- // ../../node_modules/react-native-worklets/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js
1207
- function setupSetTimeout() {
1208
- "worklet";
1209
- const timeoutHandleToRafHandle = /* @__PURE__ */ new Map();
1210
- const setTimeoutPolyfill = (callback, delay = 0, ...args) => {
1211
- const start = performance.now();
1212
- let timeoutHandle = 0;
1213
- const rafCallback = () => {
1214
- const now2 = performance.now();
1215
- if (now2 - start >= delay) {
1216
- callback(...args);
1217
- timeoutHandleToRafHandle.delete(timeoutHandle);
1218
- } else {
1219
- const rafHandle = requestAnimationFrame(rafCallback);
1220
- timeoutHandleToRafHandle.set(timeoutHandle, rafHandle);
1221
- }
1222
- };
1223
- timeoutHandle = requestAnimationFrame(rafCallback);
1224
- timeoutHandleToRafHandle.set(timeoutHandle, timeoutHandle);
1225
- return timeoutHandle;
1226
- };
1227
- const clearTimeoutPolyfill = (timeoutHandle) => {
1228
- const rafHandle = timeoutHandleToRafHandle.get(timeoutHandle);
1229
- timeoutHandleToRafHandle.delete(timeoutHandle);
1230
- cancelAnimationFrame(rafHandle);
1231
- };
1232
- globalThis.setTimeout = setTimeoutPolyfill;
1233
- globalThis.clearTimeout = clearTimeoutPolyfill;
1234
- }
1235
-
1236
- // ../../node_modules/react-native-worklets/lib/module/synchronizableUnpacker.js
1237
- function __installUnpacker() {
1238
- const serializer = !globalThis._WORKLET || globalThis._WORKLETS_BUNDLE_MODE ? (value, _) => createSerializable(value) : globalThis._createSerializable;
1239
- function synchronizableUnpacker(synchronizableRef) {
1240
- const synchronizable = synchronizableRef;
1241
- const proxy = globalThis.__workletsModuleProxy;
1242
- synchronizable.__synchronizableRef = true;
1243
- synchronizable.getDirty = () => {
1244
- return proxy.synchronizableGetDirty(synchronizable);
1245
- };
1246
- synchronizable.getBlocking = () => {
1247
- return proxy.synchronizableGetBlocking(synchronizable);
1248
- };
1249
- synchronizable.setBlocking = (valueOrFunction) => {
1250
- let newValue;
1251
- if (typeof valueOrFunction === "function") {
1252
- const func = valueOrFunction;
1253
- synchronizable.lock();
1254
- const prev = synchronizable.getBlocking();
1255
- newValue = func(prev);
1256
- proxy.synchronizableSetBlocking(synchronizable, serializer(newValue, void 0));
1257
- synchronizable.unlock();
1258
- } else {
1259
- const value = valueOrFunction;
1260
- newValue = value;
1261
- proxy.synchronizableSetBlocking(synchronizable, serializer(newValue, void 0));
1262
- }
1263
- };
1264
- synchronizable.lock = () => {
1265
- proxy.synchronizableLock(synchronizable);
1266
- };
1267
- synchronizable.unlock = () => {
1268
- proxy.synchronizableUnlock(synchronizable);
1269
- };
1270
- return synchronizable;
1271
- }
1272
- globalThis.__synchronizableUnpacker = synchronizableUnpacker;
1273
- }
1274
-
1275
- // ../../node_modules/react-native-worklets/lib/module/initializers.js
1276
- var capturableConsole;
1277
- function getMemorySafeCapturableConsole() {
1278
- if (capturableConsole) {
1279
- return capturableConsole;
1280
- }
1281
- const consoleCopy = Object.fromEntries(Object.entries(console).map(([methodName, method]) => {
1282
- const methodWrapper = function methodWrapper2(...args) {
1283
- return method(...args);
1284
- };
1285
- if (method.name) {
1286
- Object.defineProperty(methodWrapper, "name", {
1287
- value: method.name,
1288
- writable: false
1289
- });
1290
- }
1291
- return [methodName, methodWrapper];
1292
- }));
1293
- capturableConsole = consoleCopy;
1294
- return consoleCopy;
1295
- }
1296
- function setupConsole(boundCapturableConsole) {
1297
- "worklet";
1298
- globalThis.console = {
1299
- assert: runOnJS(boundCapturableConsole.assert),
1300
- debug: runOnJS(boundCapturableConsole.debug),
1301
- log: runOnJS(boundCapturableConsole.log),
1302
- warn: runOnJS(boundCapturableConsole.warn),
1303
- error: runOnJS(boundCapturableConsole.error),
1304
- info: runOnJS(boundCapturableConsole.info)
1305
- };
1306
- }
1307
- var initialized = false;
1308
- function init() {
1309
- if (initialized) {
1310
- return;
1311
- }
1312
- initialized = true;
1313
- if (globalThis.__RUNTIME_KIND === void 0) {
1314
- globalThis.__RUNTIME_KIND = RuntimeKind.ReactNative;
1315
- }
1316
- initializeRuntime();
1317
- if (SHOULD_BE_USE_WEB2) {
1318
- initializeRuntimeOnWeb();
1319
- }
1320
- if (globalThis.__RUNTIME_KIND !== RuntimeKind.ReactNative) {
1321
- initializeWorkletRuntime();
1322
- } else {
1323
- initializeRNRuntime();
1324
- if (!SHOULD_BE_USE_WEB2) {
1325
- installRNBindingsOnUIRuntime();
1326
- }
1327
- }
1328
- }
1329
- function initializeRuntime() {
1330
- if (globalThis._WORKLETS_BUNDLE_MODE) {
1331
- globalThis.__valueUnpacker = bundleValueUnpacker;
1332
- }
1333
- __installUnpacker();
1334
- }
1335
- function initializeRNRuntime() {
1336
- if (__DEV__) {
1337
- const testWorklet = () => {
1338
- "worklet";
1339
- };
1340
- if (!isWorkletFunction(testWorklet)) {
1341
- throw new WorkletsError(`Failed to create a worklet. See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#failed-to-create-a-worklet for more details.`);
1342
- }
1343
- }
1344
- registerReportFatalRemoteError();
1345
- }
1346
- function initializeWorkletRuntime() {
1347
- if (globalThis._WORKLETS_BUNDLE_MODE) {
1348
- setupCallGuard();
1349
- if (__DEV__) {
1350
- const Refresh = new Proxy({}, {
1351
- get() {
1352
- return () => {
1353
- };
1354
- }
1355
- });
1356
- globalThis.__r.Refresh = Refresh;
1357
- const modules = __require.getModules();
1358
- const ReactNativeModuleId = __require.resolveWeak("react-native");
1359
- const factory = function(_global, _require, _importDefault, _importAll, module, _exports, _dependencyMap) {
1360
- module.exports = new Proxy({}, {
1361
- get: function get(_target, prop) {
1362
- globalThis.console.warn(`You tried to import '${String(prop)}' from 'react-native' module on a Worklet Runtime. Using 'react-native' module on a Worklet Runtime is not allowed.`);
1363
- return {
1364
- get() {
1365
- return void 0;
1366
- }
1367
- };
1368
- }
1369
- });
1370
- };
1371
- const mod = {
1372
- dependencyMap: [],
1373
- factory,
1374
- hasError: false,
1375
- importedAll: {},
1376
- importedDefault: {},
1377
- isInitialized: false,
1378
- publicModule: {
1379
- exports: {}
1380
- }
1381
- };
1382
- modules.set(ReactNativeModuleId, mod);
1383
- }
1384
- }
1385
- }
1386
- function initializeRuntimeOnWeb() {
1387
- globalThis._WORKLET = false;
1388
- globalThis._log = console.log;
1389
- globalThis._getAnimationTimestamp = () => performance.now();
1390
- if (IS_JEST2) {
1391
- globalThis.requestAnimationFrame = mockedRequestAnimationFrame;
1392
- }
1393
- }
1394
- function installRNBindingsOnUIRuntime() {
1395
- if (!WorkletsModule) {
1396
- throw new WorkletsError("Worklets are trying to initialize the UI runtime without a valid WorkletsModule");
1397
- }
1398
- const runtimeBoundCapturableConsole = getMemorySafeCapturableConsole();
1399
- if (!globalThis._WORKLETS_BUNDLE_MODE) {
1400
- executeOnUIRuntimeSync(setupCallGuard)();
1401
- executeOnUIRuntimeSync(registerWorkletsError)();
1402
- }
1403
- executeOnUIRuntimeSync(() => {
1404
- "worklet";
1405
- setupConsole(runtimeBoundCapturableConsole);
1406
- setupMicrotasks();
1407
- setupRequestAnimationFrame();
1408
- setupSetTimeout();
1409
- setupSetImmediate();
1410
- setupSetInterval();
1411
- })();
1412
- }
1413
-
1414
- // ../../node_modules/react-native-worklets/lib/module/workletRuntimeEntry.js
1415
- function bundleModeInit() {
1416
- if (SHOULD_BE_USE_WEB2) {
1417
- return;
1418
- }
1419
- globalThis._WORKLETS_BUNDLE_MODE = true;
1420
- const runtimeKind = globalThis.__RUNTIME_KIND;
1421
- if (runtimeKind && runtimeKind !== RuntimeKind.ReactNative) {
1422
- init();
1423
- throw new WorkletsError("Worklets initialized successfully");
1424
- }
1425
- }
1426
- bundleModeInit();
1427
-
1428
- // ../../node_modules/react-native-worklets/lib/module/featureFlags/index.js
1429
- var DynamicFlags = {
1430
- EXAMPLE_DYNAMIC_FLAG: true,
1431
- init() {
1432
- Object.keys(DynamicFlags).forEach((key) => {
1433
- if (key !== "init" && key !== "setFlag") {
1434
- WorkletsModule.setDynamicFeatureFlag(key, DynamicFlags[key]);
1435
- }
1436
- });
1437
- },
1438
- setFlag(name, value) {
1439
- if (name in DynamicFlags) {
1440
- DynamicFlags[name] = value;
1441
- WorkletsModule.setDynamicFeatureFlag(name, value);
1442
- } else {
1443
- logger.warn(`The feature flag: '${name}' no longer exists, you can safely remove invocation of \`setDynamicFeatureFlag('${name}')\` from your code.`);
1444
- }
1445
- }
1446
- };
1447
- DynamicFlags.init();
1448
-
1449
- // ../../node_modules/react-native-worklets/lib/module/index.js
1450
- init();
1451
- if (globalThis._ALWAYS_FALSE) {
1452
- bundleModeInit();
1453
- }
1454
-
1455
- // src/transitions/easing.ts
1456
57
  function ensureWorkletEasing(easing) {
1457
58
  if (!easing) return void 0;
1458
59
  const fn = isEasingFactory(easing) ? easing.factory() : easing;
@@ -1924,8 +525,6 @@ function stableStringify(v) {
1924
525
  const keys = Object.keys(obj).sort();
1925
526
  return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
1926
527
  }
1927
-
1928
- // src/motion/installCheck.ts
1929
528
  var alreadyChecked = false;
1930
529
  function ensureReanimatedInstalled() {
1931
530
  if (!__DEV__ || alreadyChecked) return;
@@ -1933,12 +532,7 @@ function ensureReanimatedInstalled() {
1933
532
  return;
1934
533
  }
1935
534
  alreadyChecked = true;
1936
- let version;
1937
- try {
1938
- const pkg = __require("react-native-reanimated/package.json");
1939
- version = pkg.version;
1940
- } catch {
1941
- }
535
+ const version = reanimatedVersion;
1942
536
  if (version) {
1943
537
  const major = parseInt(version.split(".")[0] ?? "0", 10);
1944
538
  if (major < 4) {
@@ -2087,37 +681,51 @@ function createMotionComponent(Component) {
2087
681
  const [focused, setFocused] = useState(false);
2088
682
  const [focusVisible, setFocusVisible] = useState(false);
2089
683
  const [hovered, setHovered] = useState(false);
2090
- const activeKeysRef = useRef(null);
2091
- if (activeKeysRef.current === null) {
2092
- const touched = /* @__PURE__ */ new Set();
2093
- collectTouchedKeys(touched, animateRecord);
2094
- if (initialRecord) collectTouchedKeys(touched, initialRecord);
2095
- if (variants) {
2096
- for (const variant of Object.values(variants)) {
2097
- if (!variant) continue;
2098
- collectTouchedKeys(touched, variant);
2099
- }
684
+ const touched = /* @__PURE__ */ new Set();
685
+ collectTouchedKeys(touched, animateRecord);
686
+ if (initialRecord) collectTouchedKeys(touched, initialRecord);
687
+ if (variants) {
688
+ for (const variant of Object.values(variants)) {
689
+ if (!variant) continue;
690
+ collectTouchedKeys(touched, variant);
2100
691
  }
2101
- if (gesture) {
2102
- for (const subState of [
2103
- gesture.pressed,
2104
- gesture.focused,
2105
- gesture.focusVisible,
2106
- gesture.hovered
2107
- ]) {
2108
- if (!subState) continue;
2109
- collectTouchedKeys(touched, subState);
692
+ }
693
+ if (gesture) {
694
+ for (const subState of [
695
+ gesture.pressed,
696
+ gesture.focused,
697
+ gesture.focusVisible,
698
+ gesture.hovered
699
+ ]) {
700
+ if (!subState) continue;
701
+ collectTouchedKeys(touched, subState);
702
+ }
703
+ }
704
+ if (exitRecord) collectTouchedKeys(touched, exitRecord);
705
+ const activeKeysRef = useRef(null);
706
+ const hasTransformRef = useRef(false);
707
+ const hasShadowOffsetRef = useRef(false);
708
+ const prevActive = activeKeysRef.current;
709
+ let grew = prevActive === null;
710
+ if (!grew && prevActive) {
711
+ for (const k of touched) {
712
+ if (!prevActive.includes(k)) {
713
+ grew = true;
714
+ break;
2110
715
  }
2111
716
  }
2112
- if (exitRecord) collectTouchedKeys(touched, exitRecord);
2113
- activeKeysRef.current = ALL_KEYS.filter((k) => touched.has(k));
2114
717
  }
2115
- const hasTransformRef = useRef(
2116
- activeKeysRef.current.some((k) => TRANSFORM_KEY_SET.has(k))
2117
- );
2118
- const hasShadowOffsetRef = useRef(
2119
- activeKeysRef.current.some((k) => SHADOW_OFFSET_KEY_SET.has(k))
2120
- );
718
+ if (grew) {
719
+ const merged = new Set(prevActive ?? []);
720
+ for (const k of touched) merged.add(k);
721
+ activeKeysRef.current = ALL_KEYS.filter((k) => merged.has(k));
722
+ hasTransformRef.current = activeKeysRef.current.some(
723
+ (k) => TRANSFORM_KEY_SET.has(k)
724
+ );
725
+ hasShadowOffsetRef.current = activeKeysRef.current.some(
726
+ (k) => SHADOW_OFFSET_KEY_SET.has(k)
727
+ );
728
+ }
2121
729
  const sharedValues = useAnimatableSharedValues((key) => {
2122
730
  if (SHADOW_OFFSET_KEY_SET.has(key)) {
2123
731
  const axis = shadowOffsetAxisFor(key);
@@ -2344,34 +952,34 @@ function createMotionComponent(Component) {
2344
952
  Motion2.displayName = `Motion(${Component.displayName ?? Component.name ?? "Component"})`;
2345
953
  return Motion2;
2346
954
  }
2347
- function useAnimatableSharedValues(init2) {
2348
- const translateX = useSharedValue(init2("translateX"));
2349
- const translateY = useSharedValue(init2("translateY"));
2350
- const scale = useSharedValue(init2("scale"));
2351
- const scaleX = useSharedValue(init2("scaleX"));
2352
- const scaleY = useSharedValue(init2("scaleY"));
2353
- const rotate = useSharedValue(init2("rotate"));
2354
- const rotateX = useSharedValue(init2("rotateX"));
2355
- const rotateY = useSharedValue(init2("rotateY"));
2356
- const opacity = useSharedValue(init2("opacity"));
2357
- const width = useSharedValue(init2("width"));
2358
- const height = useSharedValue(init2("height"));
2359
- const borderRadius = useSharedValue(init2("borderRadius"));
2360
- const shadowOpacity = useSharedValue(init2("shadowOpacity"));
2361
- const shadowRadius = useSharedValue(init2("shadowRadius"));
2362
- const elevation = useSharedValue(init2("elevation"));
955
+ function useAnimatableSharedValues(init) {
956
+ const translateX = useSharedValue(init("translateX"));
957
+ const translateY = useSharedValue(init("translateY"));
958
+ const scale = useSharedValue(init("scale"));
959
+ const scaleX = useSharedValue(init("scaleX"));
960
+ const scaleY = useSharedValue(init("scaleY"));
961
+ const rotate = useSharedValue(init("rotate"));
962
+ const rotateX = useSharedValue(init("rotateX"));
963
+ const rotateY = useSharedValue(init("rotateY"));
964
+ const opacity = useSharedValue(init("opacity"));
965
+ const width = useSharedValue(init("width"));
966
+ const height = useSharedValue(init("height"));
967
+ const borderRadius = useSharedValue(init("borderRadius"));
968
+ const shadowOpacity = useSharedValue(init("shadowOpacity"));
969
+ const shadowRadius = useSharedValue(init("shadowRadius"));
970
+ const elevation = useSharedValue(init("elevation"));
2363
971
  const backgroundColor = useSharedValue(
2364
- init2("backgroundColor")
972
+ init("backgroundColor")
2365
973
  );
2366
- const borderColor = useSharedValue(init2("borderColor"));
2367
- const color = useSharedValue(init2("color"));
2368
- const tintColor = useSharedValue(init2("tintColor"));
2369
- const shadowColor = useSharedValue(init2("shadowColor"));
974
+ const borderColor = useSharedValue(init("borderColor"));
975
+ const color = useSharedValue(init("color"));
976
+ const tintColor = useSharedValue(init("tintColor"));
977
+ const shadowColor = useSharedValue(init("shadowColor"));
2370
978
  const shadowOffsetWidth = useSharedValue(
2371
- init2("shadowOffsetWidth")
979
+ init("shadowOffsetWidth")
2372
980
  );
2373
981
  const shadowOffsetHeight = useSharedValue(
2374
- init2("shadowOffsetHeight")
982
+ init("shadowOffsetHeight")
2375
983
  );
2376
984
  const ref = useRef(null);
2377
985
  if (ref.current === null) {
@@ -2460,7 +1068,7 @@ function makeKeyCallbackFactory(key, sharedValue, target, onAnimationEndRef, met
2460
1068
  return (rawPhase, step) => {
2461
1069
  const cb = (finished) => {
2462
1070
  "worklet";
2463
- runOnJS$1(dispatch)(rawPhase, step, !!finished, sharedValue.value);
1071
+ runOnJS(dispatch)(rawPhase, step, !!finished, sharedValue.value);
2464
1072
  };
2465
1073
  return cb;
2466
1074
  };