question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS - worklet error , Android - undefined error

See original GitHub issue

Hi guys i was heading some issue with iOS and Android both.

Android:

Frame Processor threw an error: undefined is not a function 

iOS:

Error: Javascript worklet error
    at _f (native)

Error: Exception in HostFunction: Javascript worklet error
...

i fixed it by directly using __scanCodes

here is example code that fully works for me

Solution

export const Scanner: React.FC = () => {
  const devices = useCameraDevices();
  const device = devices.back;

  const frameProcessor = useFrameProcessor(frame => {
    'worklet';
    const barcodes = __scanCodes(frame, [BarcodeFormat.ALL_FORMATS]);
  }, []);

  if (device == null) return <></>;
  return (
    <Camera
      style={{flex: 1}}
      device={device}
      isActive={true}
      frameProcessor={frameProcessor}
      frameProcessorFps={5}
    />
  );
};

i’m not sure that exactly why this works. But i will work around when i have some time

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:12
  • Comments:14

github_iconTop GitHub Comments

6reactions
tomekzawcommented, Sep 26, 2022

Hey all, react-native-reanimated maintainer here.

Exception in HostFunction: Javascript worklet error is a generic error message that shows up when some worklet throws an error (like undefined is not a function here). Reanimated catches all errors from worklets and passes them to the console or LogBox.

While the error is caused by other third-party library, we are currently improving the developer experience by presenting the full error message instead of only “Javascript worklet error”. See the PR: https://github.com/software-mansion/react-native-reanimated/pull/3558

4reactions
geobakocommented, Oct 17, 2022

As per this issue for now you can do a patch so that you can build in Xcode 14

diff --git a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h
index a2ccdcb..b9e0a56 100644
--- a/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h	
+++ b/node_modules/react-native-vision-camera/ios/Frame Processor/FrameProcessorPlugin.h	
@@ -53,7 +53,7 @@ objc_name : NSObject<FrameProcessorPluginBase>
 @end                                                                                \
 @implementation objc_name (FrameProcessorPlugin)                                    \
                                                                                     \
-__attribute__((constructor)) static void VISION_CONCAT(initialize_, objc_name)()    \
++(void)load    \
 {                                                                                   \
   [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"__" @ #name callback:^id(Frame* frame, NSArray<id>* args) {    \
     return [objc_name callback:frame withArgs:args];                               \
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'installCoreFunctions' of undefined
I am trying to integrate Reanimated 2.0 in iOS React Native swift project and getting the below error. Android App is working fine...
Read more >
Installation | React Native Reanimated - Software Mansion
After adding the react-native-reanimated/plugin to your project you may encounter a false-positive "Reanimated 2 failed to create a worklet" error.
Read more >
a module failed to load due to an error and appregistry ...
I have android and ios app in react native which both uses webview to show ... ERROR TypeError: undefined is not an object...
Read more >
GLView - Expo Documentation
Android Device, Android Emulator, iOS Device, iOS Simulator, Web ... To use this API inside Reanimated worklet, you need to pass the GL...
Read more >
Troubleshooting | Stream Chat - React Native SDK Docs
Stream Chat for React Native relies heavily on context, in instances where the Render Error undefined is not a function occurs it is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found