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

plugin library ScanOCR is returning undefined #1285

Closed
3 of 4 tasks
mihailpozarski opened this issue Oct 17, 2022 · 4 comments
Closed
3 of 4 tasks

plugin library ScanOCR is returning undefined #1285

mihailpozarski opened this issue Oct 17, 2022 · 4 comments
Labels
💭 question Further information is requested

Comments

@mihailpozarski
Copy link
Sponsor

Question

I know this has nothing to do with this library, but is the only place to look for some help. I'm using the community plugin vision-camera-ocr but suddenly it started to return undefined on my project... I thought it was my code(haven't change it since it was working), so i tried the example project of vision-camera-ocr and it behaves the same way.

After investigating the vision-camera-ocr repo I notice that there is no activity from the creator since the start of the repository. maybe it would be good to remove it from the recommended community plugins, unless there is somebody that wants to maintain it or if i could get me some tips on how to check it(i would love to help but i'm lacking knowledge to do so 😢... i'm working on learning)

What I tried

This is the issue i made to the ocr repo:

My project suddenly started to fail when attempting to OCR vision camera frames. It throws Frame Processor threw an error: Cannot read property 'result' of undefined... my code (removed all not related code to the issue):

import 'react-native-reanimated';
import {runOnJS} from 'react-native-reanimated';
import {scanOCR} from 'vision-camera-ocr';
import {
  Camera,
  useCameraDevices,
  useFrameProcessor,
} from 'react-native-vision-camera';

const frameProcessor = useFrameProcessor(frame => {
  'worklet';
  const result = scanOCR(frame).result;
  if (result.text.length > 0) {
    runOnJS(processText)(result.text);
  }
}, []);

scanOCR(frame) is returning undefined instead of a OCR result... the weird thing is i haven't changed my code at all from when it was working.

I ran the example project on the repo and it has the same issue.

my dependencies:

"react-native": "0.70.0",
"react-native-reanimated": "^2.10.0",
"react-native-vision-camera": "^2.14.1",
"vision-camera-ocr": "^1.0.0",

my babel.config.js:

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

if you need the complete component code let me know. As im new to React Native I don't have the knowledge to check the library to find the issue

Thanks for the awesome library!

VisionCamera Version

2.14.1

Additional information

@mihailpozarski mihailpozarski added the 💭 question Further information is requested label Oct 17, 2022
@janhelleman
Copy link

Hi, did you find a solution to this problem?

@mihailpozarski
Copy link
Sponsor Author

Hi @janhelleman , I made a long pause on this proyect after posting the question (sorry about that). I think this was related to some sort of cache... I just tried the app and now it's running normally 😓. I will see if i can replicate the issue and get it's origin.. for now i will close this and re open if i encounter it again

@maddeye
Copy link

maddeye commented Nov 24, 2022

I have the same issue, but cleaning the cache does not help.
I also reinstalled every involved package. Still get only an undefined.

@lightning331
Copy link

Still same.
It works well on IOS but the result always get "undefined" on Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💭 question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants