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

@t-mrtgu/react-native-vision-camera-barcode-scanner

v5.2.0-camera-coords.0

Published

Barcode scanning plugin for react-native-vision-camera powered by ML Kit.

Readme

@t-mrtgu/react-native-vision-camera-barcode-scanner

This is VisionCamera Barcode Scanner. Install it through npm:

npm install @t-mrtgu/react-native-vision-camera-barcode-scanner@camera-coords react-native-nitro-image

VisionCamera Barcode Scanner depends on VisionCamera Core and Nitro Image. Do not install it together with the unscoped react-native-vision-camera-barcode-scanner package.

# Make sure VisionCamera Core is installed as well.

You can scan live camera frames, attach a Barcode Scanner output, or scan an existing Nitro Image with BarcodeScanner.scanCodesInImageAsync(...).

Barcode coordinates

Every Barcode keeps ML Kit's existing input-image coordinates and, when a Camera context exists, also exposes coordinates in VisionCamera's Camera sensor coordinate system:

| Property | Coordinate system | Availability | | --- | --- | --- | | cornerPoints, boundingBox | Input Frame or Image (existing behavior) | All scan APIs | | cameraCornerPoints, cameraBoundingBox | Opaque Camera sensor coordinates accepted by VisionCamera | CameraOutput, scanCodes(frame), and scanCodesAsync(frame) |

cameraBoundingBox is the axis-aligned box enclosing all transformed corner points. If ML Kit does not return corner points, the scanner transforms all four corners of boundingBox as a fallback.

The extra Camera coordinates are especially useful with useBarcodeScannerOutput(...): its callback receives barcodes but no Frame, so application code cannot call frame.convertFramePointToCameraPoint(...). The scanner performs that native conversion while the camera buffer is valid and stores only the resulting point values.

Treat Camera sensor coordinates as opaque. Do not normalize them or manually apply screen dimensions, orientation, mirroring, safe-area insets, or resizeMode="cover" cropping. VisionCamera's Preview View owns those transforms.

import { useRef } from 'react'
import { View } from 'react-native'
import {
  Camera,
  type CameraRef,
  useCameraDevice,
} from 'react-native-vision-camera'
import { useBarcodeScannerOutput } from '@t-mrtgu/react-native-vision-camera-barcode-scanner'

function BarcodeCamera() {
  const cameraRef = useRef<CameraRef>(null)
  const device = useCameraDevice('back')

  const scannerOutput = useBarcodeScannerOutput({
    barcodeFormats: ['all-formats'],
    onBarcodeScanned(barcodes) {
      const camera = cameraRef.current
      if (camera == null) return

      for (const barcode of barcodes) {
        const viewCornerPoints = barcode.cameraCornerPoints?.map((point) =>
          camera.convertCameraPointToViewPoint(point),
        )

        // Draw an overlay using viewCornerPoints.
      }
    },
    onError(error) {
      console.error(error)
    },
  })

  if (device == null) return null

  return (
    <View style={{ flex: 1 }}>
      <Camera
        ref={cameraRef}
        style={{ flex: 1 }}
        device={device}
        isActive={true}
        outputs={[scannerOutput]}
      />
      {/* Keep the overlay in this same local parent View coordinate system. */}
    </View>
  )
}

The Camera and overlay must share the same local parent View coordinate system; the converted points are relative to the Camera Preview View, not the whole screen. In particular, do not add safe-area or window offsets unless your own layout places the overlay in a different coordinate system.

scanCodesInImageAsync(image) has no Camera context, so cameraCornerPoints and cameraBoundingBox are undefined for static images.

Minimum Requirements

The GoogleMLKit/BarcodeScanning dependency (version 9.0.0) requires a minimum iOS target version of 15.5. Adjust it in your Podfile if needed.

Then, update your native project:

npx pod-install

And rebuild your app.