Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@thewirv/react-qr-code-scanner
Advanced tools
A React component for scanning QR codes via webcam
:rocket: React QR Code Scanner component.
You need a component for scanning QR codes from a web browser based app.
This component has been tested in the following browsers:
Since this library does internal use of hooks you need React >= 16.8.0
.
You can install this library via yarn or npm.
yarn add @thewirv/react-qr-code-scanner
npm i @thewirv/react-qr-code-scanner
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>
</>
);
};
The QrCodeScanner
component has the following props:
Properties | Types | Default Value | Description |
---|---|---|---|
constraints | MediaTrackConstraints | { facingMode: 'user' } | Specify which camera should be used (if available). |
onResult | function | none | Scan event handler |
videoId | string | video | The ID for the video element |
scanDelay | number | 500 | The scan period for the QR hook |
ViewFinder | component | none | ViewFinder component to rendering over the video element |
className | string | none | ClassName for the container element. |
containerStyle | object | none | Style object for the container element. |
videoContainerStyle | object | none | Style object for the video container element. |
videoStyle | object | none | Style object for the video element. |
If you need to support older browsers, checkout this guide in how to make it compatible with legacy ones
Please, open an issue following one of the issues templates. We will do our best to fix them.
If you want to contribute to this project see contributing for more information.
Distributed under the MIT license. See LICENSE for more information.
FAQs
A React component for scanning QR codes via webcam
The npm package @thewirv/react-qr-code-scanner receives a total of 0 weekly downloads. As such, @thewirv/react-qr-code-scanner popularity was classified as not popular.
We found that @thewirv/react-qr-code-scanner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.