Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 3.17.0-rc.1 #6819

Merged
merged 36 commits into from
Dec 13, 2024
Merged

release: 3.17.0-rc.1 #6819

merged 36 commits into from
Dec 13, 2024

Conversation

tjzel
Copy link
Collaborator

@tjzel tjzel commented Dec 13, 2024

kacperkapusciak and others added 30 commits December 13, 2024 15:51
This PR explains the worklet behaviour on the Web and separates the
[Worklets
guide](https://docs.swmansion.com/react-native-reanimated/docs/guides/worklets)
into easier to reference and scan sections.

---------

Co-authored-by: Tomek Zawadzki <[email protected]>
## Summary

Moving `SingleInstanceChecker` to Worklets and applying it there.

## Test plan

🚀
## Summary

Replace the deprecated `TurboReactPackage` with the newer
`BaseReactPackage` to improve compatibility with future React Native
releases. Note that this change requires at least [email protected]+,
but this should not be an issue as, according to the compatibility
table, [email protected] only supports versions 0.74 and above.

Similar change has been introduced in the SVG package
software-mansion/react-native-svg#2541

## Test plan

CI should pass
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from
6.0.5 to 6.0.6.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/moxystudio/node-cross-spawn/blob/v6.0.6/CHANGELOG.md">cross-spawn's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/moxystudio/node-cross-spawn/compare/v6.0.5...v6.0.6">6.0.6</a>
(2024-11-18)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>disable regexp backtracking (<a
href="https://redirect.github.com/moxystudio/node-cross-spawn/issues/160">#160</a>)
(<a
href="https://github.com/moxystudio/node-cross-spawn/commit/ba5aaef">ba5aaef</a>)</li>
<li><strong>core:</strong> support worker threads (<a
href="https://redirect.github.com/moxystudio/node-cross-spawn/issues/127">#127</a>)
(<a
href="https://github.com/moxystudio/node-cross-spawn/commit/f4af31c">f4af31c</a>)</li>
</ul>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/moxystudio/node-cross-spawn/commit/d35c865b877d2f9ded7c1ed87521c2fdb689c8dd"><code>d35c865</code></a>
chore(release): 6.0.6</li>
<li><a
href="https://github.com/moxystudio/node-cross-spawn/commit/5a37e19173a759782e3f716b04c8df90a02daec8"><code>5a37e19</code></a>
chore: update package.json and package.lock</li>
<li><a
href="https://github.com/moxystudio/node-cross-spawn/commit/ba5aaef78340f0a4523a90276306b2f45fc6859a"><code>ba5aaef</code></a>
fix: disable regexp backtracking (<a
href="https://redirect.github.com/moxystudio/node-cross-spawn/issues/160">#160</a>)</li>
<li><a
href="https://github.com/moxystudio/node-cross-spawn/commit/f4af31c8ee70e1830450755eceac775876b391b9"><code>f4af31c</code></a>
fix(core): support worker threads (<a
href="https://redirect.github.com/moxystudio/node-cross-spawn/issues/127">#127</a>)</li>
<li>See full diff in <a
href="https://github.com/moxystudio/node-cross-spawn/compare/v6.0.5...v6.0.6">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cross-spawn&package-manager=npm_and_yarn&previous-version=6.0.5&new-version=6.0.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/software-mansion/react-native-reanimated/network/alerts).

</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
## Summary

Partially addresses
#6719.

This is better because it doesn't enter the traversal codepath inside
React. The `findNodeHandle` calculation inside the `Animated.View`
itself is not so bad because it's short circuited inside for native refs
(at least with `View`). Whereas passing a class instance like here
always triggers the slower path in React. Regardless, it's already
computed so why compute again?

## Test plan

I've added console logs in our app to verify whether
`animatedComponent._componentViewTag ===
findNodeHandle(animatedComponent)` and it always turned out true in the
cases I hit.

Not sure if there any cases where those could be different.

Co-authored-by: Krzysztof Piaskowy <[email protected]>
<!-- 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. -->

## Summary

Moving `makeShareableClone` function from `NativeReanimatedModule` to
`NativeWorkletsModule`.

## Test plan

CI
<!-- 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. -->

## Summary

The API for sharedValue has changed from using .value to get() and set()
methods. As a result, the mock that previously returned an object with a
single value property no longer works in the tests.

## Test plan

This is a PR for the mocks, so it's not necessary for it.

---------

Co-authored-by: Tomasz Żelawski <[email protected]>
<!-- 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. -->

## Summary

<!-- Explain the motivation for this PR. Include "Fixes #<number>" if
applicable. -->

Migrating deprecated `npx react-native init` command to `npx
@react-native-community/cli init` as mentioned
[here](#6533 (review))

---------

Co-authored-by: Tomasz Żelawski <[email protected]>
<!-- 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. -->

## Summary

Moving `MessageQueueThread` to Worklets. It still has the name
`REAMessageThread` or similar in some places. This will be addressed in
the following PR.

## Test plan

- [x] iOS 0.76 paper/fabric
- [x] android 0.76 paper/fabric

CI does the rest.
<!-- 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. -->

## Summary

Fixes
#6665

Applying the change I made to `react-native-builder-bob`:
- callstack/react-native-builder-bob#695

It restores `classic` runtime for the `@babel/react-native` preset used
for generating ESModule code. The behavior was changed when we bumped
builder-bob:
- #6485


## Test plan

I ran the `diff` for the version of `lib` without `jsxRuntime: classic`
and with it - the differences are only in regards to `_jsx` usage. You
can read more here:
-
#6665
## Summary

Refactoring `makeShareableCloneRecursive` so it would be actually
readable now.

The behavior of the function (and it's flow) shouldn't change.

## Test plan

- [x] Runtime tests
<!-- 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. -->

## Summary

<!-- Explain the motivation for this PR. Include "Fixes #<number>" if
applicable. -->

## Test plan

<!-- Provide a minimal but complete code snippet that can be used to
test out this change along with instructions how to run it and a
description of the expected behavior. -->
## Summary

This PR restores the `nativeStateSource` argument in
`makeShareableCloneRecursive` calls, that got lost in #5724

## Test plan
…6766)

## Summary

`NativeReanimatedModule` is the name of the ObjC/Java modules generated
from `REAModule` and `ReanimatedModule`. It's confusing that we name
some Cpp object the same way. With this change Cpp
`NativeReanimatedModule` becomes `ReanimatedModuleProxy`, the same name
we use to refer to it from JavaScript.

## Test plan

CI
## Summary

Analogous to:
- #6766 

`NativeWorkletsModule` is the name of the ObjC/Java modules generated
from `WorkletsModule`. It's confusing that we name some Cpp object the
same way. With this change Cpp `NativeWorkletsModule` becomes
`WorkletsModuleProxy`, the same name we use to refer to it from
JavaScript.

## Test plan

CI
## Summary

This PR fixes the following crash that happens during a reload due to
`jsi::Value` outliving the UI runtime.

The offending `jsi::Value` comes from `operationsInBatch_` inside
`ReanimatedModuleProxy` (formerly `NativeReanimatedModule`.

In `~ReanimatedModuleProxy` we manually clear data structures containing
`jsi::Value` prior to resetting `uiWorkletRuntime_` which effectively
terminates the runtimes. It looks like we forgot about
`operationsInBatch_`.

<img width="1624" alt="Screenshot 2024-12-02 at 13 00 08"
src="https://github.com/user-attachments/assets/23c8df28-885e-45e7-b88c-779edc3c4fb5">

## Test plan

1. Launch FabricExample app
2. Reload the app several times
3. Repeat steps 1 and 2 several times
## Summary

The following crash happened to me during an app reload. The top stack
frame points to `getValueUnpackerCode` but the actual offender is inside
`createReanimatedModuleBridgeless` where `workletsModuleProxy` returned
from `[workletsModule getWorkletsModuleProxy]` is `nullptr`.

<img width="1624" alt="Screenshot 2024-12-02 at 12 59 30"
src="https://github.com/user-attachments/assets/a15b8a16-00a9-42aa-abca-4bb03c264986">

## Test plan
## Summary

Turns out it can be understood that you should be using `get` in render
instead of `.value`.

## Test plan
## Summary

This PR addresses the issue reported at
[https://github.com/software-mansion/react-native-reanimated/issues/6719](https://github.com/software-mansion/react-native-reanimated/issues/6719)
and aims to:

- **Unify the method used to obtain the view tag**, as there are
currently several approaches.
- **Avoid passing a class component to the findNodeHandler**. Instead,
we'll pass a ref to the component, similar to what Expo implemented
here:
[https://github.com/expo/expo/pull/33016](https://github.com/expo/expo/pull/33016).
- **Limit unnecessary invocations of findNodeHandler** to no more than
one call per render.
- **Remove the invocation of findHostInstance from Paper renderer** on
the New Architecture.

**Additional Remarks:**
- When a class component is passed to `createAnimatedComponent`, it will
still fall back to the slow path where we can get a native ref.
- In `NativeEventManager`, we need to call findNodeHandler again after
every render to ensure that the children of `<GestureDetector />`
haven't changed their native tags.
- `LayoutAnimationConfig` still uses findNodeHandler. It requires a
complete refactor of their functionality to eliminate its use, and I
plan to handle this in another PR.
- `findHostInstance_DEPRECATED` always follows the slow path even for
native refs, which is why I've implemented our own version of
`findHostInstance` to optimize the happy path.

Fixes
#6719

Related PRs:
- #6030
- #5960
- #4445
- expo/expo#33016

## Test plan

- [x] check Paper
- [x] check Fabric
- [x] check Web
…mmary (#6690)

## Summary

This pull request makes 2 changes to the library's documentation:

1. In `useEvent` (versions 2 and 3), some typos, grammar details and
instances of missing articles were corrected.
2. In the library's main `README`, it tweaks the wording of the
document's opening summary to make it more clear and more fluent in its
expression.

I think `1` will be uncontroversial, but you might want to revert `2` if
I've misunderstood what the author was trying to say.

(Just noticed these things while reading the documentation this evening.
Please take, edit and use these proposed changes as you see fit 🙏)

---------

Co-authored-by: Kacper Kapuściak <[email protected]>
#6698 (#6700)

Fixes:  Shared Element Transition (Solution provided) #6698 

Add safety checks in handleTabNavigatorChange to prevent crash

This fixes a crash that occurs when _disappearingScreens array is empty
or
contains invalid objects by adding appropriate null checks and bounds
checking.

The crash would occur when:
- The _disappearingScreens array is empty
- navTabScreen or its reactSuperview is null
- targetScreen is null

App was crashing during shared element transition because of invalid
array access.

Fixes #6698

---------

Co-authored-by: Krzysztof Piaskowy <[email protected]>
## Summary

In brownfield, ` // we need only one instance because SurfacePresenter
is the same during the application lifetime` is false since you can
destroy RN and create it again.

## Test plan
Run Reanimated in brownfield and try to create and destroy the whole RN
a couple of times.
## Summary

`PlatformLogger` remained in Reanimated during early steps of
establishing Worklets Module due to how difficult it was to move it back
then. Now it's very simple, so let's do it.

## Test plan

See in app if `LogExample` works.
## Summary


Currently, every time we want to execute a shareable worklet, we need to
call `toJSValue()` to convert Reanimated's Shareable into a runnable
JavaScript function. This operation can be quite expensive for larger
methods that have many dependencies in their closure (such as objects
and other worklets). Previously, the result of `toJSValue()` wasn't
cached, which meant we had to convert the same shareable multiple times,
especially on every call to `runOnUI()` and in response to events -
potentially on every frame.

This happens because the part of the code - `runGuarded` - is called
frequently. You can see this code
[here](https://github.com/software-mansion/react-native-reanimated/blob/3.17.0-rc.0/packages/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h#L36).

This PR introduces the retention of all worklets and caches the result
of `toJSValue()` per runtime.

⚠️ This change is potentially risky, and it's challenging to predict if
there are any edge cases where caching everything might not be
appropriate. However, at this moment, we haven't found any regressions
related to memory issues or crashes.

⚠️ This PR changes the default behavior of worklets. Previously,
worklets were stateless and destroyed their closure after every
invocation, but now the closure will persist as long as the worklet
lives.

#### stateless vs stateful example
```js
export default function Example() {
  let counter = {value: 0};
  const workletFunction = () => {
    'worklet';
    counter.value++;
    console.log(counter);
  };
  return <Button title="click" onPress={runOnUI(workletFunction)}/>;
}
```

**Previous output**
```
{"value": 1}
{"value": 1}
{"value": 1}
```

**Current output**
```
{"value": 1}
{"value": 2}
{"value": 3}
```

However, after the render, the worklet and their closure will be created
again.

#### Issue reproduction example
<details>
<summary>code</summary>

```js
import { Text, StyleSheet, View, Button } from 'react-native';

import React from 'react';
import Animated, { withSpring, useAnimatedScrollHandler, withClamp, withDecay, withDelay, withTiming, useAnimatedRef, scrollTo, runOnUI } from 'react-native-reanimated';

function mleko() {
  'worklet';
  console.log('mleko');
}

export default function EmptyExample() {
  const aref = useAnimatedRef<Animated.ScrollView>();
  const onScroll = useAnimatedScrollHandler({
    onBeginDrag: () => {
      'worklet'
      withSpring;
      withClamp;
      withDecay;
      withDelay;
      withTiming;
    },
  });
  return (
    <View style={styles.container}>
      <Button onPress={() => {
        runOnUI(() => {
          mleko();
          withTiming;
          console.log('runOnUI');
          scrollTo(aref, 0, 100, true);
        })();
      }} title='click' />
      <Animated.ScrollView onScroll={onScroll} ref={aref}>
        {Array.from({ length: 1000 }, (_, i) => (
          <Text key={i}>Item_____________ {i}</Text>
        ))}
      </Animated.ScrollView>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    marginTop: 100,
  },
});

```

</details>

#### Memory test example

I have tested whether this change leads to memory leaks, and according
to my tests, the behavior remains exactly the same as before. Here is my
test example:

<details>
<summary>code</summary>

```js
import { Text, StyleSheet, View, Button } from 'react-native';

import {useRef} from 'react';
import Animated, { withSpring, useAnimatedScrollHandler, withClamp, withDecay, withDelay, withTiming, useAnimatedRef, scrollTo, runOnUI } from 'react-native-reanimated';

export default function EmptyExample() {
  const aref = useAnimatedRef<Animated.ScrollView>();
  const onScroll = useAnimatedScrollHandler({
    onBeginDrag: () => {
      'worklet'
      withSpring;
      withClamp;
      withDecay;
      withDelay;
      withTiming;
    },
  });

  const ref = useRef(0);

  function test1() {
    const obj = {a: 5};
    for(let i = 0; i < 10000; i++) {
      runOnUI(() => {
        const a = 5 + obj.a;
        if (a < 5) {
          console.log('a', a);
        }
      })();
    }
  }

  return (
    <View style={styles.container}>
      <Button onPress={test1} title='test1' />
      <Button onPress={() => {
        global.gc();
        runOnUI(() => {
          global.gc();
        })();
      }} title='gc' />
      <Button onPress={() => {
        runOnUI(() => {
          withTiming;
          scrollTo(aref, 0, 100, true);
        })();
      }} title='scroll' />
      <Animated.ScrollView onScroll={onScroll} ref={aref}>
        {Array.from({ length: 1000 }, (_, i) => (
          <Text key={i}>Item_____________ {i}</Text>
        ))}
      </Animated.ScrollView>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    marginTop: 100,
  },
});

```

</details>

To test for memory leaks, you can follow these steps:
1. Add a counter of shareable worklets
```diff
+int ShareableWorklet::objCounter = 0;
ShareableWorklet::ShareableWorklet(jsi::Runtime &rt, const jsi::Object &worklet)
    : ShareableObject(rt, worklet) {
  valueType_ = WorkletType;
+  objCounter++;
}
ShareableWorklet::~ShareableWorklet() {
+  objCounter--;
}
```
2. Add breakpoints to the constructor and destructor.
3. Press the `test1` button a few times.
4. Press the `gc` (garbage collection) button a few times.
5. Check if the counter returns to the value it had at the beginning.
6. Note: The counter should never reach 0 because there are some
internal worklets that exist in the global scope and should never be
destructed during the lifetime of the React Context.

#### Additional tests cases

I've also checked for any regressions in our Example app, but everything
seems to be functioning normally.

<details>
<summary>code</summary>

```js
import { Text, StyleSheet, View, Button } from 'react-native';

import React, {useEffect, useRef} from 'react';
import Animated, { withSpring, useAnimatedScrollHandler, withClamp, withDecay, withDelay, withTiming, useAnimatedRef, scrollTo, runOnUI, runOnJS, useSharedValue } from 'react-native-reanimated';

function mleko() {
  'worklet';
  console.log('mleko');
}

export default function EmptyExample() {
  const aref = useAnimatedRef<Animated.ScrollView>();
  const onScroll = useAnimatedScrollHandler({
    onBeginDrag: () => {
      'worklet'
      withSpring;
      withClamp;
      withDecay;
      withDelay;
      withTiming;
    },
  });

  const ref = useRef(0);
  const sv = useSharedValue(0);

  function test1() {
    sv.value++;
    function tmp(arg: number) {
      sv.value++;
      console.log('tmp', ref.current, sv.value);
    }
    const obj = {a: 5};
    for(let i = 0; i < 10000; i++) {
      runOnUI(() => {
        const a = 5 + obj.a;
        if (a < 5) {
          console.log('a', a);
        }
      })();
    }
  }

  const remoteObject = {a: 5};
  function test2() {
    sv.value++;
    remoteObject.a++;
    function a({a, b}: {a: number, b: number} = {a: 5, b: 10}) {
      sv.value++;
      console.log('a', a, b, ref, remoteObject, sv.value);
    }
    function schedule(obj: any) {
      sv.value++;
      console.log('schedule', obj, remoteObject, sv.value);
      runOnUI((tmp) => {
        sv.value++;
        console.log('runOnUI', tmp, sv.value);
        runOnJS(a)(tmp as any);
      })({a: 3, b: 4});
    }
    runOnUI(() => {
      sv.value++;
      runOnJS(schedule)({a: 1, b: 2});
    })();
  }

  useEffect(() => {
    // setInterval(() => {
    //   ref.current++;
    //   console.log('ref', ref.current);
    // }, 1000);
  }, []);

  return (
    <View style={styles.container}>
      <Button onPress={test1} title='test1' />
      <Button onPress={test2} title='test2' />
      <Button onPress={() => {
        global.gc();
        runOnUI(() => {
          global.gc();
        })();
      }} title='gc' />
      <Button onPress={() => {
        runOnUI(() => {
          mleko();
          withTiming;
          console.log('runOnUI');
          scrollTo(aref, 0, 100, true);
        })();
      }} title='scroll' />
      <Animated.ScrollView onScroll={onScroll} ref={aref}>
        {Array.from({ length: 1000 }, (_, i) => (
          <Text key={i}>Item_____________ {i}</Text>
        ))}
      </Animated.ScrollView>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    marginTop: 100,
  },
});

```

</details>
…xt (#6603)

Using v8 javascript engine was causing react-native-reanimated gradle
build to fail:
#3570

Changing the `V8_SO_DIR` according to the recommendation from @reinismu
fixes this:
Kudo/react-native-v8#208 (comment)

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

## Summary

Fixes #3570

## Test plan

I'm not sure how the current CI is passing
(#3570 (comment)),
but that would be the way to test it.

---------

Co-authored-by: Tomasz Żelawski <[email protected]>
…es (#6796)

## Summary
Fixes
Expensify/react-native-live-markdown#574. See
root cause analysis in
Expensify/react-native-live-markdown#574 (comment).

This PR fixes a crash caused by calling `ShareableHandle::toJSValue`
with second remote runtime after initializing `remoteValue_` with a
`jsi::Value` belonging to the first remote runtime.

I assume that this is a rare scenario so we only memoize the value for
the first remote runtime and we recreate the value for all subsequent
runtimes.

## Test plan

Reproduction:

<details>
<summary>EmptyExample.tsx</summary>

```tsx
import { Text, StyleSheet, View } from 'react-native';

import React from 'react';
import {
  createWorkletRuntime,
  runOnRuntime,
  useAnimatedStyle,
} from 'react-native-reanimated';

const regex = /\d/;

const workletRuntime = createWorkletRuntime('another');

export default function EmptyExample() {
  useAnimatedStyle(() => {
    console.log('useAnimatedStyle', String(regex));
    return {};
  });

  runOnRuntime(workletRuntime, () => {
    'worklet';
    console.log('runOnRuntime', String(regex));
    return {};
  })();

  return (
    <View style={styles.container}>
      <Text>Hello world!</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});
```

</details>
<!-- 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. -->

## Summary

Turns out that majority of work with regards to using `RuntimeExecutor`
done in
- #5734
can be reverted since `jsCallInvoker` is staying in the API.

Thanks to that we can significantly cleanup the code which is helpful
for Worklets.


## Test plan

I tested the changes on 0.74, 0.75 and 0.76 for Android/iOS Paper/Fabric
and all worked well.
## Summary

This pull requests moves `JSScheduler`, a class responsible for
scheduling operations back to the JavaScript thread, to Worklets.

- `JSScheduler` is now available from `WorkletsModuleProxy` in cpp and
that's how `ReanimatedModuleProxy` obtains it when it needs it. More
sophisticated APIs will be made in the future.
- Both `ReanimatedModule` and `WorkletsModule` are now responsible to
forward `jsCallInvoker` to their own Proxy modules. `jsCallInvoker` is
no longer available in `JSScheduler`.

## Test plan

CI
<!-- 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. -->

## Summary

This pull requests moves `UIScheduler`, a class responsible for
scheduling operations to the Main Thread, to Worklets. While it seems
that `Reanimated` should have some freedom scheduling to the Main Thread
if it doesn't use the UI Runtime, I think it's better to move it now as
is and add some secondary APIs later on. We'll have a better overview of
what we need once more code is moved to Worklets.

## Test plan

- CI
- [x] Working 0.76 Paper/Fabric iOS/Android
<!-- 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. -->

## Summary

In #6312
new API with `get`/`set` methods was added.

However mock implementation wasn't updated and `useDerivedValue` still
returns only `value`. This PR fixes this problem and returns getter as
well.

## Test plan

Run test that uses `.get()` on a value returned from `useDerivedValue`,

Co-authored-by: Tomasz Żelawski <[email protected]>
tjzel and others added 6 commits December 13, 2024 15:51
## Summary

I was doing some weird git stuff and github closed previous PR 🤷 #6790

## Test plan

🚀
<!-- 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. -->

## Summary

Added by accident during monorepo migration.

## Test plan

<!-- Provide a minimal but complete code snippet that can be used to
test out this change along with instructions how to run it and a
description of the expected behavior. -->
## Summary

`RNRuntimeWorkletDecorator` executes before `RNRuntimeDecorator`
already.

## Test plan

Works fine 👍
## Summary

🚀 

## Test plan

Android linting CI
@tjzel tjzel merged commit 498356f into 3.17-stable Dec 13, 2024
34 of 66 checks passed
@tjzel tjzel deleted the @tjzel/release/3.17.0-rc.1 branch December 13, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.