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

ScanOCR is returning undefined #14

Open
mihailpozarski opened this issue Oct 13, 2022 · 1 comment
Open

ScanOCR is returning undefined #14

mihailpozarski opened this issue Oct 13, 2022 · 1 comment

Comments

@mihailpozarski
Copy link

Hi @aarongrider,

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!

@lightning331
Copy link

Still same to me.
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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@lightning331 @mihailpozarski and others