@amazon-devices/react-native-worklets is the React Native multithreading library that provides the foundation for Reanimated’s performance capabilities. It allows you to run JavaScript code in parallel on multiple threads and runtimes, enabling smooth animations and interactions that don’t block the main JavaScript thread.
What are Worklets?
Worklets are JavaScript functions that can be serialized and executed on different threads. When you mark a function with the'worklet' directive, the Babel plugin transforms it into a serializable format that can be copied and run on the UI thread or other custom runtimes.
Key Features
- Multithreading: Execute JavaScript code on separate threads (UI thread, custom worklet runtimes)
- Zero-copy serialization: Efficiently transfer functions between threads without performance overhead
- Babel plugin integration: Automatically transforms marked functions into worklets
- Runtime creation: Create custom JavaScript runtimes for specialized workloads
- Seamless integration: Works transparently with Reanimated for animations and gestures
Documentation
Check out dedicated documentation page for info about this library, API reference and more: https://docs.swmansion.com/react-native-worklets/.Installation
-
Add the JavaScript library dependency in the
package.jsonfile. -
Add
@amazon-devices/react-native-worklets/pluginplugin to yourbabel.config.js -
Clear Metro bundler cache using
npm start -- --reset-cachecommand. -
Reinstall
package-lock.jsonfile usingnpm installcommand. - If you’ll need more detailed info, you could refer to the installation section of the external docs.
Examples
Demonstrates creating and using custom worklet runtimes for parallel processingAPIs
Worklets library on Vega provides comprehensive APIs for multithreading, memory management, and utility functions.Threading
Memory
Utility
Exceptions on Vega
Worklets library on Vega has a few exceptions in terms of API support. This section will go over those exceptions.- Feature flags are currently not supported on Vega
- Bundle Mode is currently not supported on Vega

