From 4ce84b2aa492409fb943895dbc262021e5fc0e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20=C5=BBelawski?= <40713406+tjzel@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:11:12 +0100 Subject: [PATCH] refactor: move _WORKLET injection to Worklets decorator (#6816) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary `RNRuntimeWorkletDecorator` executes before `RNRuntimeDecorator` already. ## Test plan Works fine 👍 --- .../cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp | 2 -- .../cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp | 2 ++ 2 files changed, 2 insertions(+), 2 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 5bf60c154a8b..8c3473b961de 100644 --- a/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +++ b/packages/react-native-reanimated/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp @@ -6,8 +6,6 @@ namespace reanimated { void RNRuntimeDecorator::decorate( jsi::Runtime &rnRuntime, const std::shared_ptr &reanimatedModuleProxy) { - rnRuntime.global().setProperty(rnRuntime, "_WORKLET", false); - jsi::Runtime &uiRuntime = reanimatedModuleProxy->getUIRuntime(); auto workletRuntimeValue = rnRuntime.global() 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 8575570f72b7..440666f169f7 100644 --- a/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +++ b/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp @@ -5,6 +5,8 @@ namespace worklets { void RNRuntimeWorkletDecorator::decorate( jsi::Runtime &rnRuntime, const std::shared_ptr &workletsModuleProxy) { + rnRuntime.global().setProperty(rnRuntime, "_WORKLET", false); + rnRuntime.global().setProperty( rnRuntime, "__workletsModuleProxy",