From e60e35be864364fc7955e115fbc47b0eb4c92461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20=C5=BBelawski?= <40713406+tjzel@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:19:11 +0100 Subject: [PATCH] fix: inject IS_FABRIC from worklets (#6833) ## Summary We need to inject it from the Decorator that executes sooner. ## Test plan Example App doesn't throw errors anymore on bare BokehExample --- .../reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp | 7 ------- .../worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp b/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp index fa22cd1d203..59ff85f6505 100644 --- a/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +++ b/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp @@ -19,13 +19,6 @@ void RNRuntimeDecorator::decorate( rnRuntime.global().setProperty( rnRuntime, "_WORKLET_RUNTIME", workletRuntimeValue); -#ifdef RCT_NEW_ARCH_ENABLED - constexpr auto isFabric = true; -#else - constexpr auto isFabric = false; -#endif // RCT_NEW_ARCH_ENABLED - rnRuntime.global().setProperty(rnRuntime, "_IS_FABRIC", isFabric); - rnRuntime.global().setProperty( rnRuntime, "_IS_BRIDGELESS", reanimatedModuleProxy->isBridgeless()); diff --git a/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp b/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp index 440666f169f..e21555de871 100644 --- a/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +++ b/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp @@ -7,6 +7,13 @@ void RNRuntimeWorkletDecorator::decorate( const std::shared_ptr &workletsModuleProxy) { rnRuntime.global().setProperty(rnRuntime, "_WORKLET", false); +#ifdef RCT_NEW_ARCH_ENABLED + constexpr auto isFabric = true; +#else + constexpr auto isFabric = false; +#endif // RCT_NEW_ARCH_ENABLED + rnRuntime.global().setProperty(rnRuntime, "_IS_FABRIC", isFabric); + rnRuntime.global().setProperty( rnRuntime, "__workletsModuleProxy",