Skip to content

Conversation

@tjzel
Copy link
Collaborator

@tjzel tjzel commented May 26, 2025

Summary

To execute the bundle on Worklet Runtimes we need to somehow access it. Unfortunately, currently there are no APIs for that and we need to patch React Native to expose them.

Once we settle for a good API both internally and externally I will upstream these changes to facebook/react-native#50788 (review)

Test plan

Fabric example works on:

  • iOS debug
  • iOS prod
  • android debug
  • android prod

tjzel and others added 30 commits May 7, 2025 17:17
refactor(Worklets): jsiWorkletsModuleProxy + ios

feat(Worklets): runOnUIAsync (#7469)

This PR adds a `runOnUIAsync` function.
A function that schedules a worklet on the UI Runtime, to be executed on
the UI thread. It returns a Promise of the worklet's return value. The
Promise is resolved asynchronously, not immediately after the callback
execution.

Example usage :
```js
import { runOnUIAsync } from 'react-native-worklets';

// RN Runtime, JS thread

const result: Promise<number> = runOnUIAsync((): number => {
  return 42;
});

await result; // 42
```

`runOnUIAsync` example :
<video
src="https://github.com/user-attachments/assets/8c72548d-6d41-43d6-809c-3f27f13d664f"
/>

fix: ensure last[propName] is defined in style updater (#7485)

<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

Ensure that `last[propName]` is initialised to fix an exception on web.
This bug was introduced by changes in #6749.

I noticed this issue after upgrading to the latest version of
react-native-reanimated. In my case, the library was trying to index
`last['transform']` which didn't exist for whatever reason.

<img width="573" alt="Screenshot 2025-05-08 at 16 23 04"
src="https://github.com/user-attachments/assets/1262b09a-600d-4ffb-8aa2-a02d8bc9e97e"
/>

<img width="676" alt="Screenshot 2025-05-08 at 16 24 29"
src="https://github.com/user-attachments/assets/d17ccde5-744f-4e57-b6cd-4100a88acdae"
/>

feat(CI): monorepo static checks (#7484)

QoL CI since now we keep some scripts etc. in the root. I also fixed
problems found by `yarn lint` and `yarn format` and added necessary
configs.

🪨

refactor(Worklets)(makeShareableClone): add makeShareableString (#7481)

The first in a series of PRs that are intended to refactor the logic of
the `makeShareableClone` function.
The current implementation does not have a single source of truth, as we
have two type checking logics for the passed value, one on the `JS` side
and one on the `Cpp` side.
The idea of the refactor is to implement one source of truth on the `JS`
side and call the corresponding method on the `Cpp` side e.g:
```js
if (typeof value === ‘string’) {
  return global._makeShareableString(value);
}
```

In addition, in this PR I have rewritten the `Shareables` example to
make it more readable and easier to use.
`Shareables` example
<video
src="https://github.com/user-attachments/assets/5d61009d-e31b-44fc-b4fd-c21a8c417612"
/>

chore: fix linting
tjzel added 19 commits June 5, 2025 11:59
Base automatically changed from @tjzel/worklets/workletizable-modules to main June 5, 2025 21:38
@tjzel tjzel added this pull request to the merge queue Jun 6, 2025
Merged via the queue into main with commit 72aed40 Jun 6, 2025
18 checks passed
@tjzel tjzel deleted the @tjzel/worklets/patches-for-experimental-bundling branch June 6, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants