isUIRuntime Available from 0.8.0
Checks if the current runtime is the UI Runtime.
Reference
import {
isUIRuntime,
scheduleOnUI,
scheduleOnRuntime,
createWorkletRuntime,
} from 'react-native-worklets';
console.log(isUIRuntime()); // false
scheduleOnUI(() => {
console.log(isUIRuntime()); // true
})();
const workerRuntime = createWorkletRuntime();
scheduleOnRuntime(workerRuntime, () => {
console.log(isUIRuntime()); // false
})();


Type definitions
function isUIRuntime(): boolean;
Returns
true if the current runtime is the UI Runtime, false otherwise.
Remarks
- The function checks the value of
globalThis.__RUNTIME_KINDto determine the kind of the current runtime. See getRuntimeKind for more details.