
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@thewirv/react-barcode-scanner
Advanced tools
A React component for scanning QR codes and other barcodes via webcam
:rocket: React Barcode Scanner component.
You need a component for scanning QR codes or other barcodes 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
.
This library utilizes the ZXing library and therefore supports all their supported formats of 1D and 2D barcodes.
You can install this library via yarn or npm.
yarn add @thewirv/react-barcode-scanner
npm i @thewirv/react-barcode-scanner
After reading and performing the previous steps, you should be able to import the library and use it like in this example:
import {useState} from 'react';
import {BarcodeScanner} from '@thewirv/react-barcode-scanner';
const Test = (props: Props) => {
const [data, setData] = useState('No result');
return (
<>
<BarcodeScanner
onSuccess={(text) => setData(text)}
onError={(error) => {
if (error) {
console.error(error.message);
}
}}
onLoad={() => console.log('Video feed has loaded!')}
containerStyle={{width: '100%'}}
/>
<p>{data}</p>
</>
);
};
The BarcodeScanner
component has the following props:
Properties | Types | Default Value | Required | Description |
---|---|---|---|---|
doScan | boolean | true | ☐ | Controls whether the scanner should be scanning or not |
constraints | MediaTrackConstraints | { facingMode: 'user' } | ☐ | Specify which camera should be used (if available) |
onSuccess | (text: string) => void | none | 🗹 | Callback for retrieving the result |
onError | (e?: Error) => void | none | ☐ | Callback for retrieving the error when one occurs |
onLoad | () => void | none | ☐ | Callback for when the video feed has been loaded |
videoId | string | 'video' | ☐ | The ID for the video element |
ViewFinder | React.ReactElement | none | ☐ | ViewFinder component to rendering over the video element |
containerStyle | React.CSSProperties | none | ☐ | Style object for the wrapping container element |
videoContainerStyle | React.CSSProperties | none | ☐ | Style object for the video container element |
videoStyle | React.CSSProperties | 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.
Distributed under the MIT license. See LICENSE for more information.
FAQs
A React component for scanning QR codes and other barcodes via webcam
The npm package @thewirv/react-barcode-scanner receives a total of 129 weekly downloads. As such, @thewirv/react-barcode-scanner popularity was classified as not popular.
We found that @thewirv/react-barcode-scanner demonstrated a healthy version release cadence and project activity because the last version was released less than 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.