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

Property 🐛 __scanQRCodes doesn't exist! #1543

Closed
3 of 4 tasks
michealChin opened this issue Mar 26, 2023 · 8 comments · Fixed by #1466
Closed
3 of 4 tasks

Property 🐛 __scanQRCodes doesn't exist! #1543

michealChin opened this issue Mar 26, 2023 · 8 comments · Fixed by #1466
Labels
🐛 bug Something isn't working

Comments

@michealChin
Copy link

What were you trying to do?

I follow the tutorial on how to create custom frame processor plugins from the docs/guides but I got the Property __scanQRCodes doesn't exist error. I was trying to implement the plugin for the frame processor inside the same project code, so I try to follow the code from Colorwaver where the __getColorPalette frame processor plugin also inside the same project code. However I still end up with the same error message.

Reproduceable Code

babel.config.js
module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [    
    [
      'react-native-reanimated/plugin',
      {
        globals: ['__scanQRCodes'],
      },
   ],
  ],
};

index.ts
import type { Frame } from 'react-native-vision-camera'

declare global {
    var __scanQRCodes: (
      frame: Frame,
    ) => string[];
  }
/**
 * Scans QR codes.
 */
export function scanQRCodes (frame: Frame): string[] {
  'worklet'
  return __scanQRCodes(frame)
}

App.tsx
import { scanQRCodes } from '../../../scanCard/src/index'
const frameProcessor = useFrameProcessor((frame) => {
    'worklet';
     const qrCode =scanQRCodes (frame);
 }, [])

What happened instead?

It pop up the Property '__scanQRCodes doesn't exist error message!

Relevant log output

Property '__scanQRCodes' doesn't exist, js engine: hermes

Device

Android 12

VisionCamera Version

2.15.4

Additional information

@michealChin michealChin added the 🐛 bug Something isn't working label Mar 26, 2023
@zzz08900
Copy link
Contributor

zzz08900 commented Apr 1, 2023

I was trying to implement the plugin for the frame processor inside the same project code
From my experience, don't do that if you are not an Android + js developer. For rookies a better approach would be, create a new react native project folder for testing and use local dependency to install your WIP frame processor plugin, and you could setup rsync or something similar to sync the files.

A few hacks were needed to make things work if you put both in same project folder and you probably don't want to dive into that while building your frame processor plugin.

@fukemy
Copy link

fukemy commented Jun 8, 2023

hi did u solved this?

@fukemy
Copy link

fukemy commented Jun 8, 2023

ok I found solution, instead of __beautifulFace just write FrameProcessorPlugins.beautifulFace(frame)

@rafaelmotta
Copy link

ok I found solution, instead of __beautifulFace just write FrameProcessorPlugins.beautifulFace(frame)

where did you import FrameProcessorPlugins? I tried importing from react-native-vision-camera, but isn't defined.

@fukemy
Copy link

fukemy commented Jun 9, 2023

which version you using? I am using v3

@rafaelmotta
Copy link

ah okay, i'm using v2

@myselfuser1
Copy link

@mrousavy
Copy link
Owner

Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.

I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?

Here's an instruction on how you can test that: #1674 (comment)

If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉
Otherwise please let me know and I'll keep this issue open to keep track of it.

Thank you!

@mrousavy
Copy link
Owner

mrousavy commented Oct 6, 2023

Hey!

JFYI; VisionCamera V3 now includes a QR/Barcode Scanner! 😍 Check out the CodeScanner Documentation 🚀

Try upgrading to V3 if you can, it has a much more stable yet flexible foundation.

If you appreciate me dedicating my free time to improving VisionCamera and implementing features like the Code Scanner, please consider sponsoring me on GitHub 💖 to show your support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants