Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thewirv/react-qr-code-scanner

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thewirv/react-qr-code-scanner

A React component for scanning QR codes via webcam

  • 3.1.0
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

React QR Code Scanner npm version License: MIT Known Vulnerabilities

:rocket: React QR Code Scanner component.

Table of contents

Use Case

You need a component for scanning QR codes from a web browser based app.

Compatibility

This component has been tested in the following browsers:

  • Chrome Mac OS & Android
  • Firefox Mac OS & Android
  • Safari Mac OS & iOS

Since this library does internal use of hooks you need React >= 16.8.0.

Installation

You can install this library via yarn or npm.

yarn

yarn add @thewirv/react-qr-code-scanner

npm

npm i @thewirv/react-qr-code-scanner

Example Usage

After reading and performing the previous steps, you should be able to import the library and use it like in this example:

import React, {useState} from 'react';
import {QrCodeScanner} from '@thewirv/react-qr-code-scanner';

const Test = (props) => {
  const [data, setData] = useState('No result');

  return (
    <>
      <QrCodeScanner
        onResult={(result, error) => {
          if (result) {
            setData(result.getText());
          } else if (error) {
            console.error(error.message);
          }
        }}
        style={{width: '100%'}}
      />
      <p>{data}</p>
    </>
  );
};

Component API

The QrCodeScanner component has the following props:

PropertiesTypesDefault ValueDescription
constraintsMediaTrackConstraints{ facingMode: 'user' }Specify which camera should be used (if available).
onResultfunctionnoneScan event handler
videoIdstringvideoThe ID for the video element
scanDelaynumber500The scan period for the QR hook
ViewFindercomponentnoneViewFinder component to rendering over the video element
classNamestringnoneClassName for the container element.
containerStyleobjectnoneStyle object for the container element.
videoContainerStyleobjectnoneStyle object for the video container element.
videoStyleobjectnoneStyle object for the video element.

Maintainers

Browser Support

If you need to support older browsers, checkout this guide in how to make it compatible with legacy ones

Issues

Please, open an issue following one of the issues templates. We will do our best to fix them.

Contributing

If you want to contribute to this project see contributing for more information.

License

Distributed under the MIT license. See LICENSE for more information.

Keywords

FAQs

Package last updated on 24 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc