makeShareable
⚠️ This is deprecated and will be removed in the next major release.
makeShareable
lets you create a Shareable
object from a given value on the UI thread.
Any modifications made to this shared object on the UI thread will be automatically visible to all worklets on the UI thread.
Reference
import { makeShareable, executeOnUIRuntimeSync } from 'react-native-worklets';
const shareable = makeShareable({
count: 0,
});
executeOnUIRuntimeSync(() => {
console.log(shareable.count); // 0
})();
executeOnUIRuntimeSync(() => {
shareable.count = 1;
})();
executeOnUIRuntimeSync(() => {
console.log(shareable.count); // 1
})();


Type definitions
function makeShareable<T extends object>(value: T): T