Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
@yudiel/react-qr-scanner
Advanced tools
A library to scan qr codes in react.
Weekly downloads
Readme
Checkout the Demo.
yarn add @yudiel/react-qr-scanner
npm install @yudiel/react-qr-scanner
import { Scanner } from '@yudiel/react-qr-scanner';
const App = () => {
return (
<Scanner
onResult={(text, result) => console.log(text, result)}
onError={(error) => console.log(error?.message)}
/>
);
}
useContinuousScanner
hook and implement your own UI.useDeviceList
.1D product | 1D industrial | 2D |
---|---|---|
UPC-A | Code 39 | QR Code |
UPC-E | Code 93 | Data Matrix |
EAN-8 | Code 128 | Aztec |
EAN-13 | Codabar | PDF 417 |
ITF | ||
RSS-14 | ||
RSS-Expanded |
Property | Type | Description | Required |
---|---|---|---|
onResult | (text: string, result: Result) => void | Callback function that is called with the scanned text and result. | Yes |
onError | (error: Error) => void | Optional callback function that is called when an error occurs. | No |
enabled | boolean | Optional flag to enable or disable the scanner. | No |
styles | IScannerStyles | Optional styles to apply to the scanner and its components. | No |
options | IScannerOptions | Optional configuration options for the browser scanner. | No |
components | IScannerComponents | Optional components to include or exclude in the scanner. | No |
Property | Type | Description |
---|---|---|
ref | RefObject<HTMLVideoElement> | A reference to the video element used for scanning. |
startScanning | () => void | A function to initiate the scanning process. |
stopScanning | () => void | A function to stop the scanning process. |
loading | boolean | Indicates whether the scanner is in the process of initializing. |
scanning | boolean | Indicates whether the scanner is currently active and scanning. |
switchTorch | (value: boolean) => void | undefined | An optional function to toggle the device's torch (flashlight) feature. |
getSettings | () => MediaTrackSettings | undefined | An optional function to get the current settings of the media track. |
Property | Type | Description |
---|---|---|
name | string | The name of the error. |
message | string | The error message. |
stack | string | Optional stack trace of the error. |
Property | Type | Description | Required |
---|---|---|---|
container | CSSProperties | Optional styles for the scanner container. | No |
video | CSSProperties | Optional styles for the video element. | No |
finderBorder | number | Optional border size for the finder. | No |
Property | Type | Description | Required | Default |
---|---|---|---|---|
deviceId | string | Optional ID of the device to use for scanning. | No | undefined |
hints | Map< DecodeHintType, any> | Optional hints to fine-tune scanning. | No | undefined |
constraints | DecodeHintType | Optional constraints for the media track. | No | {...} |
delayBetweenScanSuccess | number | Optional delay between successful scans. | No | 500 |
delayBetweenScanAttempts | number | Optional delay between scan attempts. | No | 500 |
tryPlayVideoTimeout | number | Optional timeout for trying to play the video. | No | 500 |
Property | Type | Description | Required | Default |
---|---|---|---|---|
audio | boolean | Optional inclusion of an audio component. | No | true |
torch | boolean | Optional inclusion of a torch component. | No | true |
count | boolean | Optional inclusion of a count component. | No | false |
onOff | boolean | Optional inclusion of an on/off component. | No | false |
tracker | boolean | Optional inclusion of a tracker component. | No | false |
FAQs
A library to scan qr codes in react.
The npm package @yudiel/react-qr-scanner receives a total of 6,910 weekly downloads. As such, @yudiel/react-qr-scanner popularity was classified as popular.
We found that @yudiel/react-qr-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
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.