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

qr-scanner-react

v2.0.4

Published

An improved QR code scanner for React.

Downloads

104

Readme

qr-scanner-react

Install

npm install --save qr-scanner-react

Usage

Without props

<QrScanner />

With props

<QrScanner {...props} />

Props

Type

{
  viewFinderConfig: ViewFinderConfig | undefined;
  onResult: ResultHandler | undefined;
  onError: ErrorHandler | undefined;
  styles: QrScannerStyles | undefined;
  scanConfig: ScanConfig | undefined;
  'full-width': boolean | undefined;
}

| Prop | Description | | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | viewFinderConfig | Configure the appearance of the viewFinder. | | onResult | Called when a QR code is read. | | onError | Called when an error occurred or a QR Code cannot be read. | | styles | Configure the CSS of the rendered elements. | | scanConfig | Configure the scanning behavior. | | full-width | A boolean describing whether the camera should be cropped to square, or not. By default, full-width is false, and so it is cropped to a square. |

viewFinderConfig

An object used to configure the appearance of the view finder.

Type

{
  visible: boolean | undefined;
  outerColor: string | undefined;
  strokeWidth: string | undefined;
  strokeColor: string | undefined;
  radius: string | undefined;
  strokeLength: string | undefined;
  custom: React.ReactElement<undefined> | undefined;
}

Explanation

| Attribute | Description | Default | Examples | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | --------------------------------------------------------------------- | | visible | Whether the view finder should be visible. | false | visible : true | | outerColor | Background color outside the scanning region. | #00000000 | outerColor: "black" outerColor: "#FFFFFFAA", | | strokeWidth | Width of the lines constituting the view finder. | 3px | strokeWidth: "10px" strokeWidth: "1.2em" | | strokeColor | Color of the lines constituting the view finder. | #000000 | strokeColor: "black" strokeColor: "#FFFFFFAA" | | radius | Radius of the corners of the view finder. | 5px | radius: "10px" radius: "1.2em" radius: "15%" | | strokeLength | Length of the lines constituting the view finder. | 40px | strokeLength: "100px" strokeLength: "1.2em" strokeLength: "55%" | | custom | Instead of using the built-in view finder with the customizations, you can provide your own, in which case, your view finder will be used. | undefined | custom : <CustomViewFinder /> |

onResult

A function called when a QR code is read.

Type

(result: ScanResult) => void

ScanResult

{
  data: string;
  cornerPoints: ({ x: number; y: number; }[]);
}

| Attribute | Description | | ------------ | --------------------------------------------------- | | data | The data read from the QR code. | | cornerPoints | The location of the corners of the QR code scanned. |

Default

(result) => {
  console.log(result);
};

onError

A function called when an error occurred or a QR Code cannot be read.

Type

(error: Error | string) => void;

Default

(error) => {
  console.log(error);
};

styles

An object used to configure the CSS of the rendered elements.

Type

{
  video: CSSProperties | undefined;
  videoContainer: CSSProperties | undefined;
  container: CSSProperties | undefined;
}

scanConfig

An object used to configure the scanning behavior.

Type

{
  qrColor: 'dark' | 'light' | 'both' | undefined;
  maxScansPerSecond: number | undefined;
  cameraPreference: 'environment' | 'user' | DeviceId: string | undefined;
}

Explanation

| Attribute | Description | Default | | ----------------- | ------------------------------------------------------------------ | --------------- | | qrColor | The colors of the QR codes that should be scanned. | "both" | | maxScansPerSecond | Limit the number of scans made a second. | 5 | | cameraPreference | Which camera should be used, if there are multiple camera options. | "environment" |

License

MIT © jakub-ucinski