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
-
did you find any solution?Novice– Novice2025年06月04日 17:25:38 +00:00Commented Jun 4, 2025 at 17:25
-
did you found any solution for this ?Arun Singh– Arun Singh2025年07月19日 17:27:35 +00:00Commented Jul 19, 2025 at 17:27
2 Answers 2
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"],
// ...
],
// ...
};
Comments
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');
})
Comments
Explore related questions
See similar questions with these tags.