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

Adds hook to allow easier usage of the plugin #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

markrickert
Copy link

I added a hook, similar to the one in vision-camera-code-scanner so you don't have to manually deal with all the frame processor worklet and javascript thread stuff yourself.

Now, you can just do:

import { useScanOCR } from "vision-camera-ocr";

// ...
const [frameProcessor, ocrData] = useScanOCR();
React.useEffect(() => {
  // This effect will run every time the frameprocessor gets different data.
  if (ocrData) {
    console.log('Got Data: ', ocrData);
  }
}, [ocrData]);

return (
  <Camera
    // ...
    frameProcessor={frameProcessor}
    frameProcessorFps='auto'
  />
)

I also fixed a typo in the readme usage section that should close #7

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

Successfully merging this pull request may close these issues.

1 participant