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

feat: Use worklet(...) to automatically detect useFrameProcessor dependencies #2840

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented May 3, 2024

What

Uses the new worklet(..) function from react-native-worklets-core to automatically detect dependencies for useFrameProcessor and useSkiaFrameProcessor.

This now means that the second argument (DependencyList) for useFrameProcessor is no longer required and will be automatically generated:

const [state, setState] = useState(false)
useFrameProcessor(() => {
  'worklet'
  console.log(state)
}) // <-- no more [...] here!

Additionally, useFrameProcessor and useSkiaFrameProcessor will now throw more helpful error messages when the given function is not a proper worklet.

Note

This requires react-native-worklets-core 1.3.0 or higher.

Changes

Tested on

Related issues

Copy link

vercel bot commented May 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2024 4:48pm

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.

None yet

1 participant