4

I am facing an issue when trying to call asynchronous function inside useFrameProcessor() from vision-camera(without expo). I have tried most of the solve available on the internet but unable to find appropriate one. I have used runOnJs()/runAsync() to do asynchronous operation but failed to do so.

 const frameProcessor = useFrameProcessor((frame) => {
 'worklet'
 console.log("I'm running synchronously at 60 FPS!")
 runAsync(frame, () => {
 'worklet'
 console.log("I'm running asynchronously, possibly at a lower FPS rate!")
 })
 
 }, [])

runAsync Error :

I'm running synchronously at 60 FPS!
Frame Processor Error: Regular javascript function '' cannot be shared. Try decorating the function with the 'worklet' keyword to allow the javascript function to be used as a worklet., js engine: VisionCamera
 const frameProcessor = useFrameProcessor((frame) => {
 'worklet'
 console.log("I'm running synchronously at 60 FPS!")
 // Use runOnJS to 
 runOnJS(() => {
 
 console.log("inside run on js")
 })();
 }, [])

runOnJS Error :

I'm running synchronously at 60 FPS!
ERROR Frame Processor Error: Property '_WORKLET' doesn't exist, js engine: VisionCamera
asked Dec 1, 2024 at 5:14
2
  • did you find any solution? Commented Jun 4, 2025 at 17:25
  • did you found any solution for this ? Commented Jul 19, 2025 at 17:27

2 Answers 2

0

For those who encountered this but did not find an answer. In my case, the problem was an incorrect configuration in babel.config.js when using react-native-reanimated/plugin

This worked

module.exports = {
 plugins: [
 ['react-native-reanimated/plugin', { processNestedWorklets: true }],
 // ...
 ],
 // ...
};

was

module.exports = {
 plugins: [
 ["react-native-worklets-core/plugin"],
 // ...
 ],
 // ...
};
answered Sep 23, 2025 at 19:30
Sign up to request clarification or add additional context in comments.

Comments

-2
 const sayHello = useRunOnJS((name: string) => {
 console.log(`Hello ${name}, I am running on the JS Thread!`);
 }, []);

And then

const frameProcessor = useFrameProcessor(
 async (frame) => {
 'worklet';
 sayHello('Matheus');
})
answered Apr 30, 2025 at 1:29

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.