Worklet runner for React Native.
const worklet = () => {
'worklet'
return Math.random()
}
- Install the library from npm:
yarn add react-native-worklets
- Add the babel plugin to your
babel.config.js
:module.exports = { plugins: [ ["react-native-worklets/plugin"], // ... ], // ... };
- Restart Metro with clean cache:
yarn start --reset-cache
See USAGE.md
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
- Credits go to Software Mansion for introducing the concept of Worklets in Reanimated v2. This library is inspired by Reanimated v2 with a few structural changes to the Worklets architecture to make it more flexible for different use-cases.