scheduleOnUI
scheduleOnUI lets you schedule a function to be executed on the UI Runtime. The callback executes asynchronously and doesn't return a value.
To compare it with runOnUIAsync and runOnUISync, see Running worklet functions on the UI runtime.
Reference
Code
Code
Colours connect each executing thread to its current code line. Recently executed lines fade over the next three ticks.
function myFunction() {
'worklet';
console.log('Hello from the UI Runtime!');
}
scheduleOnUI(myFunction);
console.log('The RN Runtime continues');
Console 0
No output yet
Output appears here as the code runs.


Type definitions
function scheduleOnUI<Args extends unknown[], ReturnValue>(
fun: (...args: Args) => ReturnValue,
...args: Args
): void;
Arguments
fun
A reference to a function you want to schedule on the UI Runtime.
args
Arguments to pass to the function.
Remarks
-
The callback passed as the argument is automatically workletized and ready to be run on the UI Runtime.
-
On the Web,
scheduleOnUIschedules work to run on the next animation frame usingrequestAnimationFrame.
Call table
| Mode | RN Runtime | UI Runtime | Worker Runtime |
|---|---|---|---|
| Bundle Mode | ✅ | ✅ | ✅ |
| Legacy Eval Mode | ✅ | ❌ | ❌ |
Platform compatibility
| Native | Web |
|---|---|
| ✅ | ✅ |