From 573192ce820f696b89627b744ebb95d8335d3169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=81opaci=C5=84ski?= Date: Mon, 12 Aug 2024 18:57:12 +0200 Subject: [PATCH] Fix ReanimatedError issues --- apps/common-app/src/examples/EmptyExample.tsx | 2 +- apps/fabric-example/ios/Podfile.lock | 2 +- .../cpp/reanimated/Fabric/ShadowTreeCloner.h | 8 +++++--- .../WorkletRuntimeDecorator.cpp | 3 ++- .../react-native-reanimated/jest-setup.js | 19 ------------------- .../react-native-reanimated/jest.config.js | 3 +++ .../plugin/build/plugin.js | 2 +- .../plugin/src/class.ts | 2 +- .../react-native-reanimated/src/Bezier.ts | 2 -- .../src/ConfigHelper.ts | 1 - .../src/NativeReanimated/NativeReanimated.ts | 1 - .../src/PropsRegistry.ts | 1 - .../src/UpdateProps.ts | 1 - .../src/animation/decay/decay.ts | 1 - .../transformationMatrix/matrixUtils.tsx | 2 -- .../src/animation/util.ts | 1 - packages/react-native-reanimated/src/core.ts | 1 - .../createAnimatedComponent.tsx | 1 - .../src/fabricUtils.web.ts | 2 -- .../src/hook/useAnimatedStyle.ts | 1 - .../react-native-reanimated/src/hook/utils.ts | 1 - packages/react-native-reanimated/src/index.ts | 1 + .../src/interpolateColor.ts | 1 - .../src/interpolation.ts | 2 -- .../react-native-reanimated/src/jestUtils.ts | 1 - .../src/js-reanimated/JSReanimated.ts | 1 - .../animationBuilder/BaseAnimationBuilder.ts | 1 - .../animationBuilder/Keyframe.ts | 1 - .../ProgressTransitionManager.ts | 1 - .../sharedTransitions/SharedTransition.ts | 1 - .../src/logger/logger.ts | 4 ++-- .../react-native-reanimated/src/mutables.ts | 1 - .../react-native-reanimated/src/runtimes.ts | 1 - .../react-native-reanimated/src/shareables.ts | 1 - .../src/valueUnpacker.ts | 11 +++++------ 35 files changed, 22 insertions(+), 63 deletions(-) diff --git a/apps/common-app/src/examples/EmptyExample.tsx b/apps/common-app/src/examples/EmptyExample.tsx index 0a9a4070680..aa6167a10d5 100644 --- a/apps/common-app/src/examples/EmptyExample.tsx +++ b/apps/common-app/src/examples/EmptyExample.tsx @@ -20,7 +20,7 @@ import Animated, { withTiming, } from 'react-native-reanimated'; -const SHOW_EXAMPLE: number = 14; +const SHOW_EXAMPLE: number = -2; /** [-1] * Error: [Reanimated] Property `text` was whitelisted both as UI and native prop. Please remove it from diff --git a/apps/fabric-example/ios/Podfile.lock b/apps/fabric-example/ios/Podfile.lock index 4d4d4bcea67..afb9f4ac5f9 100644 --- a/apps/fabric-example/ios/Podfile.lock +++ b/apps/fabric-example/ios/Podfile.lock @@ -2195,7 +2195,7 @@ SPEC CHECKSUMS: RNScreens: de6e57426ba0e6cbc3fb5b4f496e7f08cb2773c2 RNSVG: 6b65086b51556fd9723d5570a3455e865e1304a3 SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d - Yoga: 132f64c229103548a5c95fe12e2ab492fbd5c793 + Yoga: 1e170d028257c3ceb6e652dd62b2698dbc108a4b PODFILE CHECKSUM: baaf1c2684753f6bff7da2866e138e1af1fe3499 diff --git a/packages/react-native-reanimated/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h b/packages/react-native-reanimated/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h index efa186252f9..e3f9f6d9141 100644 --- a/packages/react-native-reanimated/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +++ b/packages/react-native-reanimated/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h @@ -4,8 +4,8 @@ #include #include -#include #include +#include #include #include #include @@ -15,8 +15,10 @@ using namespace react; namespace reanimated { -using PropsMap = std::unordered_map>; -using ChildrenMap = std::unordered_map>; +using PropsMap = + std::unordered_map>; +using ChildrenMap = + std::unordered_map>; RootShadowNode::Unshared cloneShadowTreeWithNewProps( const RootShadowNode &oldRootNode, diff --git a/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp b/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp index 75e795e6655..672f04242bc 100644 --- a/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +++ b/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp @@ -105,7 +105,8 @@ void WorkletRuntimeDecorator::decorate( for (size_t i = 0; i < argsSize; i++) { args[i] = argsArray.getValueAtIndex(rt, i); } - remoteFun.asObject(rt).asFunction(rt).call(rt, const_cast(args.data()), args.size()); + remoteFun.asObject(rt).asFunction(rt).call( + rt, const_cast(args.data()), args.size()); } }); }); diff --git a/packages/react-native-reanimated/jest-setup.js b/packages/react-native-reanimated/jest-setup.js index 0dfbfecaf29..983b977cd31 100644 --- a/packages/react-native-reanimated/jest-setup.js +++ b/packages/react-native-reanimated/jest-setup.js @@ -1,21 +1,2 @@ delete global.MessageChannel; require('./src/jestUtils').setUpTests(); - -function formatMessage(msg) { - return `[Reanimated] ${msg}`; -} - -global.__reanimatedLogger = { - warn(msg) { - console.warn(formatMessage(msg)); - }, - error(msg) { - console.log(formatMessage(msg)); - }, - fatal(msg) { - console.log(formatMessage(msg)); - }, - newError(msg) { - return new Error(formatMessage(msg)); - } -} diff --git a/packages/react-native-reanimated/jest.config.js b/packages/react-native-reanimated/jest.config.js index 7264cee785c..700df174109 100644 --- a/packages/react-native-reanimated/jest.config.js +++ b/packages/react-native-reanimated/jest.config.js @@ -5,4 +5,7 @@ module.exports = { setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'], testEnvironment: 'node', transformIgnorePatterns: [], + globals: { + ReanimatedError: true + } }; diff --git a/packages/react-native-reanimated/plugin/build/plugin.js b/packages/react-native-reanimated/plugin/build/plugin.js index 8ca17e48df5..538da401f5a 100644 --- a/packages/react-native-reanimated/plugin/build/plugin.js +++ b/packages/react-native-reanimated/plugin/build/plugin.js @@ -1486,7 +1486,7 @@ var require_class = __commonJS({ } function recursiveTopoSort(current, toSort, sorted, stack) { if (stack.has(current.name)) { - throw new Error("Cycle detected. This should never happen."); + throw new Error("[Reanimated] Cycle detected. This should never happen."); } if (sorted.find((element) => element.name === current.name)) { return; diff --git a/packages/react-native-reanimated/plugin/src/class.ts b/packages/react-native-reanimated/plugin/src/class.ts index 88e5dd1c8ab..b358c107dc4 100644 --- a/packages/react-native-reanimated/plugin/src/class.ts +++ b/packages/react-native-reanimated/plugin/src/class.ts @@ -293,7 +293,7 @@ function recursiveTopoSort( stack: Set ) { if (stack.has(current.name)) { - throw new Error('Cycle detected. This should never happen.'); + throw new Error('[Reanimated] Cycle detected. This should never happen.'); } if (sorted.find((element) => element.name === current.name)) { return; diff --git a/packages/react-native-reanimated/src/Bezier.ts b/packages/react-native-reanimated/src/Bezier.ts index c9d6d4e0ed4..c4dea99ccc9 100644 --- a/packages/react-native-reanimated/src/Bezier.ts +++ b/packages/react-native-reanimated/src/Bezier.ts @@ -1,7 +1,5 @@ 'use strict'; -import { logger } from './logger'; - /** * https://github.com/gre/bezier-easing * BezierEasing - use bezier curve for transition easing function diff --git a/packages/react-native-reanimated/src/ConfigHelper.ts b/packages/react-native-reanimated/src/ConfigHelper.ts index 00a0be5794b..f42e51e5733 100644 --- a/packages/react-native-reanimated/src/ConfigHelper.ts +++ b/packages/react-native-reanimated/src/ConfigHelper.ts @@ -1,7 +1,6 @@ 'use strict'; import { PropsAllowlists } from './propsAllowlists'; import { jsiConfigureProps } from './core'; -import { logger } from './logger'; function assertNoOverlapInLists() { for (const key in PropsAllowlists.NATIVE_THREAD_PROPS_WHITELIST) { diff --git a/packages/react-native-reanimated/src/NativeReanimated/NativeReanimated.ts b/packages/react-native-reanimated/src/NativeReanimated/NativeReanimated.ts index c3daf6e2d93..5180f0ca37b 100644 --- a/packages/react-native-reanimated/src/NativeReanimated/NativeReanimated.ts +++ b/packages/react-native-reanimated/src/NativeReanimated/NativeReanimated.ts @@ -14,7 +14,6 @@ import type React from 'react'; import { getShadowNodeWrapperFromRef } from '../fabricUtils'; import type { LayoutAnimationBatchItem } from '../layoutReanimation/animationBuilder/commonTypes'; import ReanimatedModule from '../specs/NativeReanimatedModule'; -import { logger } from '../logger'; // this is the type of `__reanimatedModuleProxy` which is injected using JSI export interface NativeReanimatedModule { diff --git a/packages/react-native-reanimated/src/PropsRegistry.ts b/packages/react-native-reanimated/src/PropsRegistry.ts index 9405cf70ee6..0f56b4f7e28 100644 --- a/packages/react-native-reanimated/src/PropsRegistry.ts +++ b/packages/react-native-reanimated/src/PropsRegistry.ts @@ -1,6 +1,5 @@ 'use strict'; -import { logger } from './logger'; import { isFabric } from './PlatformChecker'; import { runOnUI } from './threads'; diff --git a/packages/react-native-reanimated/src/UpdateProps.ts b/packages/react-native-reanimated/src/UpdateProps.ts index 34eb2c60090..0f43165c8ca 100644 --- a/packages/react-native-reanimated/src/UpdateProps.ts +++ b/packages/react-native-reanimated/src/UpdateProps.ts @@ -13,7 +13,6 @@ import type { ReanimatedHTMLElement } from './js-reanimated'; import { _updatePropsJS } from './js-reanimated'; import { isFabric, isJest, shouldBeUseWeb } from './PlatformChecker'; import { runOnUIImmediately } from './threads'; -import { logger } from './logger'; let updateProps: ( viewDescriptor: SharedValue, diff --git a/packages/react-native-reanimated/src/animation/decay/decay.ts b/packages/react-native-reanimated/src/animation/decay/decay.ts index 9096aa53ce5..e5d0cefb90f 100644 --- a/packages/react-native-reanimated/src/animation/decay/decay.ts +++ b/packages/react-native-reanimated/src/animation/decay/decay.ts @@ -14,7 +14,6 @@ import type { InnerDecayAnimation, } from './utils'; import { rigidDecay } from './rigidDecay'; -import { logger } from '../../logger'; export type WithDecayConfig = DecayConfig; diff --git a/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx b/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx index 18f6c69c5e4..8e012426507 100644 --- a/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx +++ b/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx @@ -1,7 +1,5 @@ 'use strict'; -import { logger } from '../../logger'; - type FixedLengthArray< T, L extends number, diff --git a/packages/react-native-reanimated/src/animation/util.ts b/packages/react-native-reanimated/src/animation/util.ts index 90eee131f14..210215f026e 100644 --- a/packages/react-native-reanimated/src/animation/util.ts +++ b/packages/react-native-reanimated/src/animation/util.ts @@ -89,7 +89,6 @@ export function recognizePrefixSuffix( value: string | number ): RecognizedPrefixSuffix { 'worklet'; - console.log('recognizePrefixSuffix'); if (typeof value === 'string') { const match = value.match( /([A-Za-z]*)(-?\d*\.?\d*)([eE][-+]?[0-9]+)?([A-Za-z%]*)/ diff --git a/packages/react-native-reanimated/src/core.ts b/packages/react-native-reanimated/src/core.ts index c93d27f6d0a..6db2700affb 100644 --- a/packages/react-native-reanimated/src/core.ts +++ b/packages/react-native-reanimated/src/core.ts @@ -13,7 +13,6 @@ import { makeShareableCloneRecursive } from './shareables'; import { initializeUIRuntime } from './initializers'; import type { LayoutAnimationBatchItem } from './layoutReanimation/animationBuilder/commonTypes'; import { SensorContainer } from './SensorContainer'; -import { logger } from './logger'; export { startMapper, stopMapper } from './mappers'; export { runOnJS, runOnUI, executeOnUIRuntimeSync } from './threads'; diff --git a/packages/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx b/packages/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx index 236653b148a..9d6acc95cf1 100644 --- a/packages/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx +++ b/packages/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx @@ -51,7 +51,6 @@ import { addHTMLMutationObserver } from '../layoutReanimation/web/domUtils'; import { getViewInfo } from './getViewInfo'; import { NativeEventsManager } from './NativeEventsManager'; import type { ReanimatedHTMLElement } from '../js-reanimated'; -import { logger } from '../logger'; const IS_WEB = isWeb(); diff --git a/packages/react-native-reanimated/src/fabricUtils.web.ts b/packages/react-native-reanimated/src/fabricUtils.web.ts index 6ca4fcac58d..6cb37728bdc 100644 --- a/packages/react-native-reanimated/src/fabricUtils.web.ts +++ b/packages/react-native-reanimated/src/fabricUtils.web.ts @@ -1,7 +1,5 @@ 'use strict'; -import { logger } from './logger'; - export function getShadowNodeWrapperFromRef() { throw new ReanimatedError( 'Trying to call `getShadowNodeWrapperFromRef` on web.' diff --git a/packages/react-native-reanimated/src/hook/useAnimatedStyle.ts b/packages/react-native-reanimated/src/hook/useAnimatedStyle.ts index b1630144d88..ace51d3ff91 100644 --- a/packages/react-native-reanimated/src/hook/useAnimatedStyle.ts +++ b/packages/react-native-reanimated/src/hook/useAnimatedStyle.ts @@ -34,7 +34,6 @@ import type { AnimatedStyle, } from '../commonTypes'; import { isWorkletFunction } from '../commonTypes'; -import { logger } from '../logger'; const SHOULD_BE_USE_WEB = shouldBeUseWeb(); diff --git a/packages/react-native-reanimated/src/hook/utils.ts b/packages/react-native-reanimated/src/hook/utils.ts index 58e39cd292c..b2e9ddbfea4 100644 --- a/packages/react-native-reanimated/src/hook/utils.ts +++ b/packages/react-native-reanimated/src/hook/utils.ts @@ -2,7 +2,6 @@ import type { WorkletFunction } from '../commonTypes'; import type { DependencyList } from './commonTypes'; -import { logger } from '../logger'; // Builds one big hash from multiple worklets' hashes. export function buildWorkletsHash( diff --git a/packages/react-native-reanimated/src/index.ts b/packages/react-native-reanimated/src/index.ts index d60e52c851f..d67e031e071 100644 --- a/packages/react-native-reanimated/src/index.ts +++ b/packages/react-native-reanimated/src/index.ts @@ -19,6 +19,7 @@ export { getViewProp, executeOnUIRuntimeSync, } from './core'; +export { ReanimatedError } from './errors'; export type { GestureHandlers, AnimatedRef, diff --git a/packages/react-native-reanimated/src/interpolateColor.ts b/packages/react-native-reanimated/src/interpolateColor.ts index 62acafabea6..010e4528819 100644 --- a/packages/react-native-reanimated/src/interpolateColor.ts +++ b/packages/react-native-reanimated/src/interpolateColor.ts @@ -13,7 +13,6 @@ import { makeMutable } from './core'; import { Extrapolation, interpolate } from './interpolation'; import type { SharedValue } from './commonTypes'; import { useSharedValue } from './hook/useSharedValue'; -import { logger } from './logger'; /** * @deprecated Please use Extrapolation instead diff --git a/packages/react-native-reanimated/src/interpolation.ts b/packages/react-native-reanimated/src/interpolation.ts index a489dd0b698..0de7880a421 100644 --- a/packages/react-native-reanimated/src/interpolation.ts +++ b/packages/react-native-reanimated/src/interpolation.ts @@ -1,7 +1,5 @@ 'use strict'; -import { logger } from './logger'; - /** * Extrapolation type. * diff --git a/packages/react-native-reanimated/src/jestUtils.ts b/packages/react-native-reanimated/src/jestUtils.ts index cd5edc26fee..93dfb73dd84 100644 --- a/packages/react-native-reanimated/src/jestUtils.ts +++ b/packages/react-native-reanimated/src/jestUtils.ts @@ -9,7 +9,6 @@ import type { } from './createAnimatedComponent/commonTypes'; import { isJest } from './PlatformChecker'; import type { DefaultStyle } from './hook/commonTypes'; -import { logger } from './logger'; declare global { namespace jest { diff --git a/packages/react-native-reanimated/src/js-reanimated/JSReanimated.ts b/packages/react-native-reanimated/src/js-reanimated/JSReanimated.ts index 5c853de3f59..3604a9f75d2 100644 --- a/packages/react-native-reanimated/src/js-reanimated/JSReanimated.ts +++ b/packages/react-native-reanimated/src/js-reanimated/JSReanimated.ts @@ -10,7 +10,6 @@ import { SensorType } from '../commonTypes'; import type { WebSensor } from './WebSensor'; import { mockedRequestAnimationFrame } from '../mockedRequestAnimationFrame'; import type { WorkletRuntime } from '../runtimes'; -import { logger } from '../logger'; // In Node.js environments (like when static rendering with Expo Router) // requestAnimationFrame is unavailable, so we use our mock. diff --git a/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts b/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts index e10b768b70c..8e2aad7dc2a 100644 --- a/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +++ b/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts @@ -8,7 +8,6 @@ import type { import { ReduceMotion } from '../../commonTypes'; import { getReduceMotionFromConfig } from '../../animation/util'; -import { logger } from '../../logger'; export class BaseAnimationBuilder { durationV?: number; diff --git a/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/Keyframe.ts b/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/Keyframe.ts index aecd8b265a5..b1feba23e1c 100644 --- a/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/Keyframe.ts +++ b/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/Keyframe.ts @@ -18,7 +18,6 @@ import { assertEasingIsWorklet, getReduceMotionFromConfig, } from '../../animation/util'; -import { logger } from '../../logger'; interface KeyframePoint { duration: number; diff --git a/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts b/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts index 7f830ef5251..5efc025dc89 100644 --- a/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts +++ b/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts @@ -7,7 +7,6 @@ import type { import { registerEventHandler, unregisterEventHandler } from '../../core'; import { Platform } from 'react-native'; import { isJest, shouldBeUseWeb } from '../../PlatformChecker'; -import { logger } from '../../logger'; type TransitionProgressEvent = { closing: number; diff --git a/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/SharedTransition.ts b/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/SharedTransition.ts index 6c2a2330102..e303637f924 100644 --- a/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/SharedTransition.ts +++ b/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/SharedTransition.ts @@ -16,7 +16,6 @@ import { ReduceMotion } from '../../commonTypes'; import { ProgressTransitionManager } from './ProgressTransitionManager'; import { updateLayoutAnimations } from '../../UpdateLayoutAnimations'; import { getReduceMotionFromConfig } from '../../animation/util'; -import { logger } from '../../logger'; const SUPPORTED_PROPS = [ 'width', diff --git a/packages/react-native-reanimated/src/logger/logger.ts b/packages/react-native-reanimated/src/logger/logger.ts index f84081e26df..00c32be1cad 100644 --- a/packages/react-native-reanimated/src/logger/logger.ts +++ b/packages/react-native-reanimated/src/logger/logger.ts @@ -50,9 +50,9 @@ export function logToLogBoxAndConsole(data: LogData) { } export function replaceLoggerImplementation( - logFunction: (data: LogData) => void + newLogFunction: (data: LogData) => void ) { - loggerImpl.logFunction = logFunction; + loggerImpl.logFunction = newLogFunction; shareableMappingCache.set(logger, makeShareableCloneRecursive(logger)); } diff --git a/packages/react-native-reanimated/src/mutables.ts b/packages/react-native-reanimated/src/mutables.ts index ddbca230b12..cc4d025b43a 100644 --- a/packages/react-native-reanimated/src/mutables.ts +++ b/packages/react-native-reanimated/src/mutables.ts @@ -1,7 +1,6 @@ 'use strict'; import { shouldBeUseWeb } from './PlatformChecker'; import type { Mutable } from './commonTypes'; -import { logger } from './logger'; import { shareableMappingCache } from './shareableMappingCache'; import { makeShareableCloneRecursive } from './shareables'; diff --git a/packages/react-native-reanimated/src/runtimes.ts b/packages/react-native-reanimated/src/runtimes.ts index 1e5194e06a2..fd556469de3 100644 --- a/packages/react-native-reanimated/src/runtimes.ts +++ b/packages/react-native-reanimated/src/runtimes.ts @@ -9,7 +9,6 @@ import { makeShareableCloneOnUIRecursive, makeShareableCloneRecursive, } from './shareables'; -import { logger } from './logger'; const SHOULD_BE_USE_WEB = shouldBeUseWeb(); diff --git a/packages/react-native-reanimated/src/shareables.ts b/packages/react-native-reanimated/src/shareables.ts index ca83e7debfd..c2abc007af5 100644 --- a/packages/react-native-reanimated/src/shareables.ts +++ b/packages/react-native-reanimated/src/shareables.ts @@ -13,7 +13,6 @@ import { shareableMappingCache, shareableMappingFlag, } from './shareableMappingCache'; -import { logger } from './logger'; // for web/chrome debugger/jest environments this file provides a stub implementation // where no shareable references are used. Instead, the objects themselves are used diff --git a/packages/react-native-reanimated/src/valueUnpacker.ts b/packages/react-native-reanimated/src/valueUnpacker.ts index 8a0404db042..26e8dbe356f 100644 --- a/packages/react-native-reanimated/src/valueUnpacker.ts +++ b/packages/react-native-reanimated/src/valueUnpacker.ts @@ -2,7 +2,6 @@ import { shouldBeUseWeb } from './PlatformChecker'; import { isWorkletFunction } from './commonTypes'; import type { WorkletFunction } from './commonTypes'; -import { logger } from './logger'; function valueUnpacker( objectToUnpack: any, @@ -89,19 +88,19 @@ if (__DEV__ && !shouldBeUseWeb()) { 'worklet'; }) as WorkletFunction<[], void>; if (!isWorkletFunction(testWorklet)) { - throw new ReanimatedError( - `Failed to create a worklet. See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#failed-to-create-a-worklet for more details.` + throw new Error( + `[Reanimated] Failed to create a worklet. See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#failed-to-create-a-worklet for more details.` ); } if (!isWorkletFunction(valueUnpacker)) { - throw new ReanimatedError('`valueUnpacker` is not a worklet'); + throw new Error('[Reanimated] `valueUnpacker` is not a worklet'); } const closure = (valueUnpacker as ValueUnpacker).__closure; if (closure === undefined) { - throw new ReanimatedError('`valueUnpacker` closure is undefined'); + throw new Error('[Reanimated] `valueUnpacker` closure is undefined'); } if (Object.keys(closure).length !== 0) { - throw new ReanimatedError('`valueUnpacker` must have empty closure'); + throw new Error('[Reanimated] `valueUnpacker` must have empty closure'); } }