Skip to content

🧵 A library to run JS functions ("Worklets") on separate Threads

License

Notifications You must be signed in to change notification settings

margelo/react-native-worklets-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e407602 Â· Nov 7, 2024
Nov 7, 2024
Nov 7, 2024
Nov 6, 2024
Apr 17, 2024
Nov 7, 2024
Aug 21, 2023
Feb 16, 2023
Dec 14, 2022
Nov 7, 2024
Dec 12, 2022
Nov 7, 2024
Nov 7, 2024
Dec 12, 2022
Nov 7, 2024
Nov 7, 2024
Dec 12, 2022
Dec 12, 2022
Dec 12, 2022
Aug 21, 2023
Dec 12, 2022
Jul 11, 2024
Nov 7, 2024
Nov 7, 2024
Dec 13, 2022
Nov 7, 2024
Dec 12, 2022
Nov 7, 2024
Nov 7, 2024

Repository files navigation

🧵 react-native-worklets-core

A Worklet runner for React Native.

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.

Installation

  1. Install the library from npm:
    yarn add react-native-worklets-core
  2. Add the babel plugin to your babel.config.js:
    module.exports = {
      plugins: [
        ["react-native-worklets-core/plugin"],
        // ...
      ],
      // ...
    };
  3. Restart Metro with clean cache:
    yarn start --reset-cache

Usage

See USAGE.md

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Credits

  • 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.