Skip to content

Adds hook to allow easier usage of the plugin#9

Open
markrickert wants to merge 3 commits into
aarongrider:mainfrom
markrickert:add-hook
Open

Adds hook to allow easier usage of the plugin#9
markrickert wants to merge 3 commits into
aarongrider:mainfrom
markrickert:add-hook

Conversation

@markrickert

Copy link
Copy Markdown

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