diff --git a/android/src/main/cpp/NativeProxy.cpp b/android/src/main/cpp/NativeProxy.cpp
index 96c80221880a..1386d81187e2 100644
--- a/android/src/main/cpp/NativeProxy.cpp
+++ b/android/src/main/cpp/NativeProxy.cpp
@@ -474,6 +474,8 @@ void NativeProxy::setGlobalProperties(
jsRuntime.global().setProperty(
jsRuntime, "_WORKLET_RUNTIME", workletRuntimeValue);
+ jsRuntime.global().setProperty(jsRuntime, "_WORKLET", false);
+
#ifdef RCT_NEW_ARCH_ENABLED
jsRuntime.global().setProperty(jsRuntime, "_IS_FABRIC", true);
#else
diff --git a/ios/REAModule.mm b/ios/REAModule.mm
index 3cb75a0b8cf0..43fd35603ac6 100644
--- a/ios/REAModule.mm
+++ b/ios/REAModule.mm
@@ -215,6 +215,8 @@ - (void)setBridge:(RCTBridge *)bridge
runtime.global().setProperty(runtime, "_WORKLET_RUNTIME", workletRuntimeValue);
+ runtime.global().setProperty(runtime, "_WORKLET", false);
+
runtime.global().setProperty(runtime, "_IS_FABRIC", true);
auto version = getReanimatedVersionString(runtime);
diff --git a/ios/native/REAInitializer.mm b/ios/native/REAInitializer.mm
index 60ee16df3da1..a0ea056dd0f9 100644
--- a/ios/native/REAInitializer.mm
+++ b/ios/native/REAInitializer.mm
@@ -57,6 +57,8 @@ - (void)setBridge:(RCTBridge *)bridge;
runtime.global().setProperty(runtime, "_WORKLET_RUNTIME", workletRuntimeValue);
+ runtime.global().setProperty(runtime, "_WORKLET", false);
+
runtime.global().setProperty(runtime, "_IS_FABRIC", false);
auto version = getReanimatedVersionString(runtime);
diff --git a/src/reanimated2/threads.ts b/src/reanimated2/threads.ts
index bf4e88b39231..b81d4a0583b6 100644
--- a/src/reanimated2/threads.ts
+++ b/src/reanimated2/threads.ts
@@ -123,7 +123,7 @@ export function runOnUIImmediately(
worklet: ComplexWorkletFunction
): (...args: A) => void {
'worklet';
- if (__DEV__ && !IS_JEST && _WORKLET) {
+ if (__DEV__ && !IS_WEB && _WORKLET) {
throw new Error(
'runOnUIImmediately() cannot be called on the UI runtime. Please call the function synchronously or use `queueMicrotask` or `requestAnimationFrame` instead.'
);
@@ -141,11 +141,12 @@ export function runOnUIImmediately(
};
}
-if (__DEV__) {
- try {
- // eslint-disable-next-line @typescript-eslint/no-empty-function
- runOnUI(() => {});
- } catch (e) {
+if (__DEV__ && !IS_WEB) {
+ const f = () => {
+ 'worklet';
+ };
+ // @ts-ignore plugin
+ if (f.__workletHash === undefined) {
throw new Error(
'Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js? See installation docs at https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation#babel-plugin.'
);