Post

Every package you import in your application will be available to use in worklets. We call this feature "Bundle Mode". This is so because worklets and your app now share the very same JavaScript bundle.

0 reposts1 like

To run it, you need to install `react-native-worklets@bundle-mode-preview` and apply some patches to React Native, which expose additional APIs. The patches are non-invasive and won't change your app's behavior outside of worklets. More in the docs docs.swmansion.com/react-native...

docs.swmansion.comBundle Mode | React Native WorkletsBundle Mode is a feature that gives worklets access to your whole JavaScript bundle - meaning that any code that's present in the bundle can be executed in any worklet and on any runtime. This means t...

Ultimately this will be a plug-and-play solution, without cumbersome configurations. However, it's not that simple. Bundle Mode needs APIs that aren't yet available in React Native. Please give a thumbs up on my PR so we can ship it to React Native faster github.com/facebook/rea...

github.comproposal: BundleConsumer interface for TurboModules by tjzel · Pull Request #50788 · facebook/react-nativeSummary: With the development of react-native-worklets library I want to align it more with the tools inside React Native ecosystem and reduce the amount of hacks needed to provide multithreading J...

While the feature allows you to use virtually any library, there are some constraints. For example, some side-effects are problematic. A library that would directly import React Native can't be used on a Worklet Runtime. Don't worry, you will get a friendly error in that case.

Libraries that fetch data will also have a hard time - `fetch` is not yet available on Worklet Runtimes. We aim to add it soon™. For now, libraries that focus on the UI are the best bet to use with Bundle Mode - like `react-native-wgpu` or `react-native-live-markdown`.