mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
6.64k stars 983 forks source link

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

Open mrousavy opened 2 weeks ago

mrousavy commented 2 weeks ago

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

vercel[bot] commented 2 weeks ago

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