npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-ocr-kit

v0.1.4

Published

On-device OCR module for Expo and React Native using ML Kit (Android) and Vision (iOS)

Readme

Expo OCR Kit

On-device text recognition for Expo and React Native.

expo-ocr-kit is a native OCR module built with the Expo Modules API. It uses ML Kit on Android and Vision on iOS, and exposes a single typed API for both platforms.

Demo

demo demo2 demo3

Why this package

  • Built with the Expo Modules API
  • Works in Expo development builds, prebuild workflows, EAS Build, and bare React Native
  • Uses platform OCR engines directly instead of a generic wrapper
  • Returns normalized cross-platform bounding boxes
  • Includes a minimal Expo config plugin for camera permission setup
  • Downsamples large images before OCR to reduce memory pressure

Installation

npm install expo-ocr-kit

Usage

import { recognizeText, type OcrResult } from 'expo-ocr-kit';

const result: OcrResult = await recognizeText(uri);

uri should be a local image URI.

API

type OcrBoundingBox = {
  x: number;
  y: number;
  width: number;
  height: number;
};

type OcrBlock = {
  text: string;
  boundingBox: OcrBoundingBox;
};

type OcrResult = {
  text: string;
  blocks: OcrBlock[];
};

Bounding boxes are returned in image-space coordinates with a top-left origin on both platforms.

Expo support

This package contains native code.

  • Supported: Expo development builds
  • Supported: expo prebuild
  • Supported: EAS Build
  • Supported: bare React Native
  • Not supported: Expo Go

Typical Expo workflow:

npx expo prebuild
npx expo run:android
npx expo run:ios

expo-ocr-kit does not provide camera capture. The OCR API is image-based, so your app should capture or pick an image first, then pass that image to OCR.

If your Expo app already uses the camera and you want this package to add the native camera permission entries during prebuild, you can use the bundled config plugin:

{
  "expo": {
    "plugins": [
      [
        "expo-ocr-kit",
        {
          "cameraPermission": "Allow this app to capture images for OCR."
        }
      ]
    ]
  }
}

The config plugin adds:

  • iOS: NSCameraUsageDescription
  • Android: android.permission.CAMERA

Runtime permission requests are still your responsibility.

What makes it different

Most OCR packages in this space fall into one of three buckets:

  • older React Native wrappers with dated native integrations
  • platform-specific text recognition packages
  • Vision Camera frame-processor plugins focused on real-time OCR

expo-ocr-kit is aimed at a different use case:

  • Expo-first native module architecture
  • batch OCR on local images
  • clean JS API for both Expo and bare React Native apps
  • native implementation details kept behind a small, typed surface

If you need real-time OCR from camera frames, a Vision Camera plugin is the right tool. If you need a production-friendly OCR module for captured images, scanned documents, screenshots, and imported files, this package is the better fit.

Implementation notes

  • Android uses ML Kit with URI loading, EXIF-aware rotation handling, and image downsampling.
  • iOS uses Vision with CGImageSource thumbnail decoding and coordinate normalization.
  • Large images are processed on reduced-size native buffers, but bounding boxes are scaled back to the original image space before they are returned.

Design direction

The core API stays intentionally generic:

recognizeText(uri: string): Promise<OcrResult>

Receipt parsing, invoice extraction, field detection, and domain-specific post-processing belong above OCR rather than inside the low-level recognition API.

Notes for contributors

  • Native iOS builds can be sensitive to filesystem paths with spaces. A path without spaces is recommended when working on the example app locally.
  • If you change native Kotlin or Swift code, rebuild the app. Metro reload is only enough for JavaScript changes.