A Worklet runner for React Native
npm install react-native-worklets-coreA Worklet runner for React Native.
``js`
const worklet = () => {
'worklet'
return Math.random()
}
> [!NOTE]
> In most cases, react-native-worklets-core shouldn't be used as a standalone dependency but rather as a peer-dependency for other modules such as react-native-vision-camera, react-native-wishlist, or react-native-skia.
1. Install the library from npm:
`sh`
yarn add react-native-worklets-core
babel.config.js
2. Add the babel plugin to your :`
js`
module.exports = {
plugins: [
["react-native-worklets-core/plugin"],
// ...
],
// ...
};
`
3. Restart Metro with clean cache:
sh``
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 Christian Falch for building the initial version of this library. You're amazing! 🤩
* 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, such as integrating it with other C++ libraries like VisionCamera and WishList.