Serializable
Serializable is a type of shared memory that holds an immutable value that can be serialized and deserialized across different JavaScript Runtimes. It allows passing JavaScript values between Runtimes while ensuring that the data is correctly transferred and reconstructed. The reference cannot be manipulated, as it doesn't represent any standard JavaScript object.
You can't pass JavaScript values to other Runtimes without prior serialization.
Serializable memory model
Supported types
| Type | Supported |
|---|---|
| string | yes |
| number | yes |
| boolean | yes |
| object | yes |
| array | yes |
| function (non-worklet) | yes |
| HostObject | yes |
| worklet | yes |
| Map | yes |
| Set | yes |
| ArrayBuffer | yes |
| RegExp | yes |
| Cyclic objects | no |
| Objects with custom prototype | no |


Type definitions
type SerializableRef<TValue = unknown> = {
__serializableRef: true;
__nativeStateSerializableJSRef: TValue;
};
Remarks
- The JavaScript value of a Serializable is a reference wrapper that only holds the C++ side in its
jsi::NativeState. - The prop
__nativeStateSerializableJSRefpresent on the reference doesn't exist in runtime - it's only a TypeScript definition to tell you what type of value is held by the Serializable. - Functions that aren't worklets are serialized as references to function instances on the respective Runtime, meaning that they can't be invoked on other runtimes, only passed around.