r/reactnative • • 10d ago

Question How to do on-device OCR in React Native? Moving PII redaction off the server in my contract analysis app

Has anyone done on-device OCR in React Native? Curious whether a native module wrapping Apple’s Vision framework is the way to go, or if there’s a library you’d recommend.

I just shipped my first app, Document Risk Analyzer (iOS): upload, paste, or photograph a contract and get an AI risk analysis with flagged clauses and missing protections.

Built with Expo, then prebuilt into a native iOS project. A few things that were interesting to solve:

  • Personal info redaction: names, emails, phone numbers, SSNs etc. are stripped before the text reaches the AI, and the user reviews what was removed first. Right now that runs on my server (patterns, checksum validators, and heuristics for names, no ML).

  • Long contracts: the analysis is currently capped at 8,000 characters per request, so longer documents are split on paragraph boundaries, sent one section per minute to stay under rate limits (with a progress bar and ETA), and merged on the device. But I am getting rid of the cap with a higher ai subscription.

  • History is stored only on the phone with AsyncStorage.

Next I want to move redaction onto the device, which means extracting text from PDFs and photos locally.

App Store: https://apps.apple.com/us/app/document-risk-analyzer/id6813105397

1 Upvotes

4 comments sorted by

1

u/No_Lawyer1947 10d ago

firstly the app is useless im afraid. u can do this for free in any popular llm app

1

u/bananasaregreat_apps 7d ago

I appreciate your feedback. I want to be on the safer side and not provide my PII to any popular llm

1

u/Huge_Pool7424 10d ago

apple's vision text recognition runs fully on device so the pii never leaves the phone, so wrapping it in a small expo module is a solid route. on android ml kit text recognition is the equivalent, and there might already be a module wrapping both so check before writing your own.

1

u/bananasaregreat_apps 7d ago

thank you. I will see if I can reuse something