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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-rectangle-doc-scanner

v3.185.0

Published

Native-backed document scanner for React Native with customizable overlays.

Readme

React Native Document Scanner Wrapper

React Native-friendly wrapper around react-native-document-scanner. It exposes a declarative <DocScanner /> component that renders the native document scanner on both iOS and Android while keeping the surface area small enough to plug into custom UIs.

The native implementation lives inside the upstream library (Objective‑C/OpenCV on iOS, Kotlin/OpenCV on Android). This package simply re-exports a type-safe wrapper, optional crop editor helpers, and a full-screen scanner flow.

✨ Professional Camera Quality (v3.2+)

Major Update: Upgraded to modern AVCapturePhotoOutput API for dramatically improved image quality!

🚀 What's New:

  • Modern Camera API - Uses AVCapturePhotoOutput (iOS 10+) instead of deprecated AVCaptureStillImageOutput
  • iPhone Native Quality - Same quality as the built-in Camera app
  • Computational Photography - Automatic HDR, Deep Fusion, and Smart HDR support
  • 12MP+ Resolution - Full resolution capture on modern iPhones (up to 48MP on iPhone 14 Pro+)
  • Maximum Quality Priority - iOS 13+ quality prioritization enabled
  • 95%+ JPEG Quality - Enforced minimum compression quality to prevent quality loss

🎯 Automatic Optimizations:

  • High-Resolution Capture - Full sensor resolution enabled (AVCaptureSessionPresetHigh)
  • Minimum 95% JPEG - Prevents quality degradation from compression
  • Advanced Features:
    • Video stabilization for sharper images
    • Continuous autofocus for always-sharp captures
    • Auto exposure and white balance
    • Low-light boost in dark environments
  • Hardware-Accelerated - CIContext for efficient processing

⚡ Fully Automatic Installation:

Just install with yarn/npm - no manual configuration needed!

  • Postinstall script automatically patches camera quality
  • Optimized iOS files copied during installation
  • Works immediately after pod install

Installation

yarn add react-native-rectangle-doc-scanner \
  github:Michaelvilleneuve/react-native-document-scanner \
  react-native-perspective-image-cropper

# iOS
cd ios && pod install

Android automatically links the native module. If you manage packages manually (legacy architecture), register DocumentScannerPackage() in your MainApplication.

Usage

import React, { useRef } from 'react';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { DocScanner, type DocScannerHandle } from 'react-native-rectangle-doc-scanner';

export const ScanScreen = () => {
  const scannerRef = useRef<DocScannerHandle>(null);

  return (
    <View style={styles.container}>
      <DocScanner
        ref={scannerRef}
        overlayColor="rgba(0, 126, 244, 0.35)"
        autoCapture
        minStableFrames={6}
        onCapture={(result) => {
          console.log('Captured document:', result.path);
        }}
      >
        <View style={styles.overlay} pointerEvents="none">
          <Text style={styles.hint}>Align the document inside the frame</Text>
        </View>
      </DocScanner>

      <TouchableOpacity
        style={styles.captureButton}
        onPress={() => scannerRef.current?.capture()}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: { flex: 1, backgroundColor: '#000' },
  overlay: {
    position: 'absolute',
    top: 60,
    alignSelf: 'center',
    paddingHorizontal: 20,
    paddingVertical: 10,
    borderRadius: 12,
    backgroundColor: 'rgba(0,0,0,0.5)',
  },
  hint: { color: '#fff', fontWeight: '600' },
  captureButton: {
    position: 'absolute',
    bottom: 40,
    alignSelf: 'center',
    width: 70,
    height: 70,
    borderRadius: 35,
    backgroundColor: '#fff',
  },
});

<DocScanner /> passes through the important upstream props:

| Prop | Type | Default | Notes | | --- | --- | --- | --- | | overlayColor | string | #0b7ef4 | Native overlay tint. | | autoCapture | boolean | true | Maps to manualOnly internally. | | minStableFrames | number | 8 | Detection count before auto capture. | | enableTorch | boolean | false | Toggle device torch. | | quality | number | 90 | 0–100 (converted for native). | | useBase64 | boolean | false | Return base64 payloads instead of file URIs. | | onCapture | (result) => void | — | Receives { path, quad: null, width, height }. |

Manual capture exposes an imperative capture() method via ref. Children render on top of the camera preview so you can build your own buttons, progress indicators, or onboarding tips.

Convenience APIs

  • CropEditor – wraps react-native-perspective-image-cropper for manual corner adjustment.
  • FullDocScanner – puts the scanner and crop editor into a single modal-like flow. If the host app links either expo-image-manipulator or react-native-image-rotate, the confirmation screen exposes 90° rotation buttons; otherwise rotation controls remain hidden.

License

MIT