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

web-native-qr-scanner

v0.1.2

Published

React QR/barcode scanner component using the browser's native BarcodeDetector API with a zxing-wasm fallback, ROI cropping and requestVideoFrameCallback for near-native scanning performance in the browser.

Readme

web-native-qr-scanner

A React QR / barcode scanner component for the browser. It prefers the browser's native BarcodeDetector API (Safari 17.4+, Chrome/Edge) for near-native scanning speed, and transparently falls back to zxing-wasm (ZXing-C++ compiled to WebAssembly) on devices/browsers without native support.

Features

  • Native-first, WASM fallback — tries BarcodeDetector first, falls back to zxing-wasm if unsupported or after 5s of native misses.
  • ROI cropping — only decodes the pixels inside the visible scan frame (matching what object-cover actually displays), instead of the full camera frame. Faster decoding and fewer false positives from codes outside the frame — the same approach apps like Zalo use.
  • requestVideoFrameCallback — schedules decode attempts on the video's actual render cadence instead of blindly polling on a timer.
  • QR and 1D barcode modescode_128, code_39, ean_13, ean_8, upc_a, upc_e, itf, codabar.
  • Torch/flashlight toggle, multi-code picker sheet, permission-denied state, i18n-able labels.
  • Zero UI dependencies — icons are inlined, styling ships as a plain CSS file (works with or without Tailwind).

Install

npm install web-native-qr-scanner

react and react-dom (>=18) are peer dependencies.

Usage

import { QrScanner } from 'web-native-qr-scanner'
import 'web-native-qr-scanner/style.css'

function ScanPage() {
  return (
    <QrScanner
      mode="qr" // or "barcode"
      onDetect={(code) => console.log('scanned:', code)}
    />
  )
}

Props

| Prop | Type | Default | Description | | ----------- | ------------------------- | ------------ | ------------------------------------------------ | | onDetect | (code: string) => void | — | Called once with the decoded text. | | mode | 'qr' \| 'barcode' | 'barcode' | Restricts which formats are detected. | | className | string | — | Extra class name on the root element. | | labels | QrScannerLabels | English | Override any UI string for i18n. |

Custom labels

<QrScanner
  mode="barcode"
  onDetect={handleCode}
  labels={{
    hintBarcode: 'Đưa barcode vào khung hình',
    permissionDeniedTitle: 'Không thể truy cập camera',
  }}
/>

Browser support

Camera access requires a secure context (HTTPS, or localhost). Native detection requires BarcodeDetector (Safari 17.4+, Chrome/Edge 83+); everything else uses the WASM fallback automatically, so the component works on any browser that supports getUserMedia.

Development

npm install
npm run build      # bundle to dist/ (ESM + CJS + .d.ts + style.css)
npm run typecheck

Publishing

npm login
npm publish

License

MIT