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

Extract Worklet API to RuntimeManager.h #1861

Merged
merged 25 commits into from
Mar 31, 2021

Conversation

mrousavy
Copy link
Contributor

@mrousavy mrousavy commented Mar 23, 2021

Part 3 of 3

  • Lift valueSetter, runtime, errorHandler, scheduler and workletsCache out of NativeReanimatedModule, into RuntimeDecorator.h
  • Let NativeReanimatedModule extend RuntimeDecorator (all worklet API consumers should do that)
  • Let every API func accept RuntimeDecorator instead of NativeReanimatedModule to make it more abstract

@mrousavy
Copy link
Contributor Author

mrousavy commented Mar 24, 2021

Note that I still haven't tested if it would work to use a SharedValue in a separate worklet runtime (that is not the REA UI runtime).

So e.g.:

// [[react JS runtime]]
const sv = useSharedValue(1)

const as = useAnimatedStyle(() => ({
  // [[reanimated UI runtime]]
  opacity: sv.value
}), [sv]);
const fp = useFrameProcessor(() => {
  // [[VisionCamera frame processor runtime]]
  sv.value = Math.random() // <-- no idea if that works.
}, [sv]);

// ...

If it doesn't work, this will require an additional PR in the future.

@mrousavy
Copy link
Contributor Author

mrousavy commented Mar 30, 2021

@Szymon20000 / @piaskowyk let me know if you need anything.

Copy link
Member

@piaskowyk piaskowyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, It looks ok to me👌
It is waiting for @Szymon20000 review.

Common/cpp/NativeModules/NativeReanimatedModule.cpp Outdated Show resolved Hide resolved
@piaskowyk piaskowyk self-assigned this Mar 30, 2021
@piaskowyk piaskowyk merged commit 815847e into software-mansion:master Mar 31, 2021
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.

3 participants