Skip to main content

createSynchronizable
Available from 0.6.0

Creates a new Synchronizable holding the provided initial value. Returns the created Synchronizable.

Reference

import { createSynchronizable } from 'react-native-worklets';

const synchronizable = createSynchronizable({ a: 42 });

Type definitions

function createSynchronizable<TValue>(
initialValue: TValue
): Synchronizable<TValue>;

Arguments

initialValue

The initial value to be held by the created Synchronizable. As it has to be serialized before passing to C++, it must be one of the supported types listed in the Serializable documentation.

Remarks

  • Outside of Bundle Mode, createSynchronizable can be called only on the RN Runtime. In Bundle Mode, it can be called from any Runtime.