diff --git a/packages/react-native-reanimated/src/Bezier.ts b/packages/react-native-reanimated/src/Bezier.ts index c4dea99ccc9..3968f3a689c 100644 --- a/packages/react-native-reanimated/src/Bezier.ts +++ b/packages/react-native-reanimated/src/Bezier.ts @@ -1,5 +1,7 @@ 'use strict'; +import { ReanimatedError } from './errors'; + /** * 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 f42e51e5733..b93993bb057 100644 --- a/packages/react-native-reanimated/src/ConfigHelper.ts +++ b/packages/react-native-reanimated/src/ConfigHelper.ts @@ -1,6 +1,7 @@ 'use strict'; import { PropsAllowlists } from './propsAllowlists'; import { jsiConfigureProps } from './core'; +import { ReanimatedError } from './errors'; 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 5180f0ca37b..4c2e833dfe2 100644 --- a/packages/react-native-reanimated/src/NativeReanimated/NativeReanimated.ts +++ b/packages/react-native-reanimated/src/NativeReanimated/NativeReanimated.ts @@ -14,6 +14,7 @@ import type React from 'react'; import { getShadowNodeWrapperFromRef } from '../fabricUtils'; import type { LayoutAnimationBatchItem } from '../layoutReanimation/animationBuilder/commonTypes'; import ReanimatedModule from '../specs/NativeReanimatedModule'; +import { ReanimatedError } from '../errors'; // 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 ed2e5208130..16ca3922cec 100644 --- a/packages/react-native-reanimated/src/PropsRegistry.ts +++ b/packages/react-native-reanimated/src/PropsRegistry.ts @@ -1,4 +1,5 @@ 'use strict'; +import { ReanimatedError } from './errors'; 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 0f43165c8ca..69b15716d14 100644 --- a/packages/react-native-reanimated/src/UpdateProps.ts +++ b/packages/react-native-reanimated/src/UpdateProps.ts @@ -13,6 +13,7 @@ import type { ReanimatedHTMLElement } from './js-reanimated'; import { _updatePropsJS } from './js-reanimated'; import { isFabric, isJest, shouldBeUseWeb } from './PlatformChecker'; import { runOnUIImmediately } from './threads'; +import { ReanimatedError } from './errors'; 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 e5d0cefb90f..104bda4b085 100644 --- a/packages/react-native-reanimated/src/animation/decay/decay.ts +++ b/packages/react-native-reanimated/src/animation/decay/decay.ts @@ -14,6 +14,7 @@ import type { InnerDecayAnimation, } from './utils'; import { rigidDecay } from './rigidDecay'; +import { ReanimatedError } from '../../errors'; 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 8e012426507..5f107066fe4 100644 --- a/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx +++ b/packages/react-native-reanimated/src/animation/transformationMatrix/matrixUtils.tsx @@ -1,5 +1,7 @@ 'use strict'; +import { ReanimatedError } from '../../errors'; + 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 210215f026e..8211e818c21 100644 --- a/packages/react-native-reanimated/src/animation/util.ts +++ b/packages/react-native-reanimated/src/animation/util.ts @@ -37,6 +37,7 @@ import { shouldBeUseWeb } from '../PlatformChecker'; import type { EasingFunctionFactory } from '../Easing'; import { ReducedMotionManager } from '../ReducedMotion'; import { logger } from '../logger'; +import { ReanimatedError } from '../errors'; let IN_STYLE_UPDATER = false; const SHOULD_BE_USE_WEB = shouldBeUseWeb(); diff --git a/packages/react-native-reanimated/src/core.ts b/packages/react-native-reanimated/src/core.ts index 6db2700affb..af085641a19 100644 --- a/packages/react-native-reanimated/src/core.ts +++ b/packages/react-native-reanimated/src/core.ts @@ -13,6 +13,7 @@ import { makeShareableCloneRecursive } from './shareables'; import { initializeUIRuntime } from './initializers'; import type { LayoutAnimationBatchItem } from './layoutReanimation/animationBuilder/commonTypes'; import { SensorContainer } from './SensorContainer'; +import { ReanimatedError } from './errors'; 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 9fe9e7aa740..9f5fd59102d 100644 --- a/packages/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx +++ b/packages/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx @@ -52,6 +52,7 @@ import { addHTMLMutationObserver } from '../layoutReanimation/web/domUtils'; import { getViewInfo } from './getViewInfo'; import { NativeEventsManager } from './NativeEventsManager'; import type { ReanimatedHTMLElement } from '../js-reanimated'; +import { ReanimatedError } from '../errors'; const IS_WEB = isWeb(); const IS_JEST = isJest(); diff --git a/packages/react-native-reanimated/src/fabricUtils.web.ts b/packages/react-native-reanimated/src/fabricUtils.web.ts index 6cb37728bdc..e8c389f1280 100644 --- a/packages/react-native-reanimated/src/fabricUtils.web.ts +++ b/packages/react-native-reanimated/src/fabricUtils.web.ts @@ -1,5 +1,7 @@ 'use strict'; +import { ReanimatedError } from './errors'; + 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 ace51d3ff91..8c71d599e68 100644 --- a/packages/react-native-reanimated/src/hook/useAnimatedStyle.ts +++ b/packages/react-native-reanimated/src/hook/useAnimatedStyle.ts @@ -34,6 +34,7 @@ import type { AnimatedStyle, } from '../commonTypes'; import { isWorkletFunction } from '../commonTypes'; +import { ReanimatedError } from '../errors'; 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 53ab446649f..47c889cda38 100644 --- a/packages/react-native-reanimated/src/hook/utils.ts +++ b/packages/react-native-reanimated/src/hook/utils.ts @@ -1,5 +1,6 @@ 'use strict'; import type { WorkletFunction } from '../commonTypes'; +import { ReanimatedError } from '../errors'; import type { DependencyList } from './commonTypes'; // Builds one big hash from multiple worklets' hashes. diff --git a/packages/react-native-reanimated/src/interpolateColor.ts b/packages/react-native-reanimated/src/interpolateColor.ts index 010e4528819..52e57c91864 100644 --- a/packages/react-native-reanimated/src/interpolateColor.ts +++ b/packages/react-native-reanimated/src/interpolateColor.ts @@ -13,6 +13,7 @@ import { makeMutable } from './core'; import { Extrapolation, interpolate } from './interpolation'; import type { SharedValue } from './commonTypes'; import { useSharedValue } from './hook/useSharedValue'; +import { ReanimatedError } from './errors'; /** * @deprecated Please use Extrapolation instead diff --git a/packages/react-native-reanimated/src/interpolation.ts b/packages/react-native-reanimated/src/interpolation.ts index 0de7880a421..52273a906d8 100644 --- a/packages/react-native-reanimated/src/interpolation.ts +++ b/packages/react-native-reanimated/src/interpolation.ts @@ -1,5 +1,7 @@ 'use strict'; +import { ReanimatedError } from './errors'; + /** * Extrapolation type. * diff --git a/packages/react-native-reanimated/src/jestUtils.ts b/packages/react-native-reanimated/src/jestUtils.ts index 71f832ef353..9f4f2381841 100644 --- a/packages/react-native-reanimated/src/jestUtils.ts +++ b/packages/react-native-reanimated/src/jestUtils.ts @@ -9,6 +9,7 @@ import type { } from './createAnimatedComponent/commonTypes'; import { isJest } from './PlatformChecker'; import type { DefaultStyle } from './hook/commonTypes'; +import { ReanimatedError } from './errors'; 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 6edca3f51df..cb4f8617d46 100644 --- a/packages/react-native-reanimated/src/js-reanimated/JSReanimated.ts +++ b/packages/react-native-reanimated/src/js-reanimated/JSReanimated.ts @@ -11,6 +11,7 @@ import type { WebSensor } from './WebSensor'; import { mockedRequestAnimationFrame } from '../mockedRequestAnimationFrame'; import type { WorkletRuntime } from '../runtimes'; import { logger } from '../logger'; +import { ReanimatedError } from '../errors'; // 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/js-reanimated/index.ts b/packages/react-native-reanimated/src/js-reanimated/index.ts index 0178e4b3d50..be9c57ac2cd 100644 --- a/packages/react-native-reanimated/src/js-reanimated/index.ts +++ b/packages/react-native-reanimated/src/js-reanimated/index.ts @@ -8,6 +8,7 @@ import { } from './webUtils'; import { PropsAllowlists } from '../propsAllowlists'; import { logger } from '../logger'; +import { ReanimatedError } from '../errors'; const reanimatedJS = new JSReanimated(); diff --git a/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts b/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts index 8e2aad7dc2a..a9e1d9b3df5 100644 --- a/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +++ b/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts @@ -8,6 +8,7 @@ import type { import { ReduceMotion } from '../../commonTypes'; import { getReduceMotionFromConfig } from '../../animation/util'; +import { ReanimatedError } from '../../errors'; 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 b1feba23e1c..2bf7082dd46 100644 --- a/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/Keyframe.ts +++ b/packages/react-native-reanimated/src/layoutReanimation/animationBuilder/Keyframe.ts @@ -18,6 +18,7 @@ import { assertEasingIsWorklet, getReduceMotionFromConfig, } from '../../animation/util'; +import { ReanimatedError } from '../../errors'; 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 5efc025dc89..bc7a59158cc 100644 --- a/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts +++ b/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts @@ -7,6 +7,7 @@ import type { import { registerEventHandler, unregisterEventHandler } from '../../core'; import { Platform } from 'react-native'; import { isJest, shouldBeUseWeb } from '../../PlatformChecker'; +import { ReanimatedError } from '../../errors'; 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 e303637f924..1bcc684b1e6 100644 --- a/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/SharedTransition.ts +++ b/packages/react-native-reanimated/src/layoutReanimation/sharedTransitions/SharedTransition.ts @@ -16,6 +16,7 @@ import { ReduceMotion } from '../../commonTypes'; import { ProgressTransitionManager } from './ProgressTransitionManager'; import { updateLayoutAnimations } from '../../UpdateLayoutAnimations'; import { getReduceMotionFromConfig } from '../../animation/util'; +import { ReanimatedError } from '../../errors'; const SUPPORTED_PROPS = [ 'width', diff --git a/packages/react-native-reanimated/src/layoutReanimation/web/domUtils.ts b/packages/react-native-reanimated/src/layoutReanimation/web/domUtils.ts index 066533613d5..ea7b7cd3af4 100644 --- a/packages/react-native-reanimated/src/layoutReanimation/web/domUtils.ts +++ b/packages/react-native-reanimated/src/layoutReanimation/web/domUtils.ts @@ -7,6 +7,7 @@ import { setElementPosition, snapshots } from './componentStyle'; import { Animations } from './config'; import type { AnimationNames } from './config'; import { logger } from '../../logger'; +import { ReanimatedError } from '../../errors'; const PREDEFINED_WEB_ANIMATIONS_ID = 'ReanimatedPredefinedWebAnimationsStyle'; const CUSTOM_WEB_ANIMATIONS_ID = 'ReanimatedCustomWebAnimationsStyle'; diff --git a/packages/react-native-reanimated/src/mutables.ts b/packages/react-native-reanimated/src/mutables.ts index f35f217cd53..79261a1014e 100644 --- a/packages/react-native-reanimated/src/mutables.ts +++ b/packages/react-native-reanimated/src/mutables.ts @@ -1,6 +1,7 @@ 'use strict'; import { shouldBeUseWeb } from './PlatformChecker'; import type { Mutable } from './commonTypes'; +import { ReanimatedError } from './errors'; import { shareableMappingCache } from './shareableMappingCache'; import { makeShareableCloneRecursive } from './shareables'; diff --git a/packages/react-native-reanimated/src/platform-specific/checkCppVersion.ts b/packages/react-native-reanimated/src/platform-specific/checkCppVersion.ts index 190e346e9a6..15a192e0704 100644 --- a/packages/react-native-reanimated/src/platform-specific/checkCppVersion.ts +++ b/packages/react-native-reanimated/src/platform-specific/checkCppVersion.ts @@ -2,6 +2,7 @@ import { jsVersion } from './jsVersion'; import { logger } from '../logger'; +import { ReanimatedError } from '../errors'; export function checkCppVersion() { const cppVersion = global._REANIMATED_VERSION_CPP; diff --git a/packages/react-native-reanimated/src/runtimes.ts b/packages/react-native-reanimated/src/runtimes.ts index 55a701faaec..cd0df6975f5 100644 --- a/packages/react-native-reanimated/src/runtimes.ts +++ b/packages/react-native-reanimated/src/runtimes.ts @@ -1,7 +1,7 @@ 'use strict'; import { isWorkletFunction } from './commonTypes'; import type { WorkletFunction } from './commonTypes'; -import { registerReanimatedError } from './errors'; +import { ReanimatedError, registerReanimatedError } from './errors'; import { setupCallGuard, setupConsole } from './initializers'; import NativeReanimatedModule from './NativeReanimated'; import { shouldBeUseWeb } from './PlatformChecker'; diff --git a/packages/react-native-reanimated/src/shareables.ts b/packages/react-native-reanimated/src/shareables.ts index 95093680275..555a0b1d20d 100644 --- a/packages/react-native-reanimated/src/shareables.ts +++ b/packages/react-native-reanimated/src/shareables.ts @@ -7,7 +7,7 @@ import type { WorkletFunction, } from './commonTypes'; import { shouldBeUseWeb } from './PlatformChecker'; -import { registerWorkletStackDetails } from './errors'; +import { ReanimatedError, registerWorkletStackDetails } from './errors'; import { jsVersion } from './platform-specific/jsVersion'; import { shareableMappingCache,