Skip to main content

isRNRuntime
Available from 0.8.0

Checks if the current runtime is the React Native Runtime.

Reference

import {
isRNRuntime,
scheduleOnUI,
scheduleOnRuntime,
createWorkletRuntime,
} from 'react-native-worklets';

console.log(isRNRuntime()); // true

scheduleOnUI(() => {
console.log(isRNRuntime()); // false
})();

const workerRuntime = createWorkletRuntime();
scheduleOnRuntime(workerRuntime, () => {
console.log(isRNRuntime()); // false
})();

Type definitions

function isRNRuntime(): boolean;

Returns

true if the current runtime is the RN Runtime, false otherwise.

Remarks

  • The function checks the value of globalThis.__RUNTIME_KIND to determine the kind of the current runtime. See getRuntimeKind for more details.

We are Software Mansion.