{"id":19311998,"url":"https://github.com/weblineindia/reactjs-qrcode-scanner","last_synced_at":"2025-04-22T15:31:36.910Z","repository":{"id":57347631,"uuid":"281886117","full_name":"weblineindia/ReactJS-QRCode-Scanner","owner":"weblineindia","description":"ReactJS based QR Code Scanner component, allowing you to detect and decode QR codes.","archived":false,"fork":false,"pushed_at":"2024-03-30T11:44:11.000Z","size":67,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-05T16:09:17.522Z","etag":null,"topics":["barcode-scanner","decode-qr-codes","javascript-qrcode","qr-code-decoder","qr-code-reader","qrcode-scanner","react-components","react-demo","react-libraries","react-qr-reader","react-qr-scanner","reactjs","reactjs-barcode-scanner","reactjs-components","reactjs-demo","reactjs-library","reactjs-qrcode-scanner","reusable-components","scanner-component","webrtc"],"latest_commit_sha":null,"homepage":"https://www.weblineindia.com/software-development-resources.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weblineindia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-23T07:46:21.000Z","updated_at":"2024-07-24T03:42:26.000Z","dependencies_parsed_at":"2022-08-28T03:01:40.292Z","dependency_job_id":null,"html_url":"https://github.com/weblineindia/ReactJS-QRCode-Scanner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weblineindia%2FReactJS-QRCode-Scanner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weblineindia%2FReactJS-QRCode-Scanner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weblineindia%2FReactJS-QRCode-Scanner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weblineindia%2FReactJS-QRCode-Scanner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weblineindia","download_url":"https://codeload.github.com/weblineindia/ReactJS-QRCode-Scanner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223900372,"owners_count":17222028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barcode-scanner","decode-qr-codes","javascript-qrcode","qr-code-decoder","qr-code-reader","qrcode-scanner","react-components","react-demo","react-libraries","react-qr-reader","react-qr-scanner","reactjs","reactjs-barcode-scanner","reactjs-components","reactjs-demo","reactjs-library","reactjs-qrcode-scanner","reusable-components","scanner-component","webrtc"],"created_at":"2024-11-10T00:32:04.357Z","updated_at":"2024-11-10T00:32:18.975Z","avatar_url":"https://github.com/weblineindia.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReactJS - QR Code / Barcode Scanner Component\n\nReactJS based QR Code Scanner component, allowing you to detect and decode QR codes.\n\n## Table of contents\n\n- [Browser Support](#browser-support)\n- [Getting started](#getting-started)\n- [Usage](#usage)\n- [Available Props](#available-props)\n- [Methods](#methods)\n- [Want to Contribute?](#want-to-contribute)\n- [Collection of Components](#collection-of-components)\n- [Changelog](#changelog)\n- [Credits](#credits)\n- [License](#license)\n- [Keywords](#Keywords)\n\n## Browser Support\n\n| ![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |\n| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| 83.0 ✔                                                                                   | 77.0 ✔                                                                                      | 13.1.1 ✔                                                                                 | 83.0 ✔                                                                             | Not supported                                                                                                                       |\n\n\n## Getting started\n\nInstall the npm package:\n\n``` bash\nnpm install react-weblineindia-qrcode-scanner\n#OR\nyarn add react-weblineindia-qrcode-scanner\n```\n\n## Usage\n\nUse the `\u003creact-weblineindia-qrcode-scanner\u003e` component:\n\n```js\nimport React, { Component } from 'react'\nimport QrReader from 'react-weblineindia-qrcode-scanner'\n\nclass Test extends Component {\n  constructor(props){\n    super(props)\n    this.state = {\n      delay: 100,\n      result: 'No result',\n    }\n\n    this.handleScan = this.handleScan.bind(this)\n  }\n  handleScan(data){\n    this.setState({\n      result: data,\n    })\n  }\n  handleError(err){\n    console.error(err)\n  }\n  render(){\n    const previewStyle = {\n      height: 240,\n      width: 320,\n    }\n\n    return(\n      \u003cdiv\u003e\n        \u003cQrReader\n          delay={this.state.delay}\n          style={previewStyle}\n          onError={this.handleError}\n          onScan={this.handleScan}\n          /\u003e\n        \u003cp\u003e{this.state.result}\u003c/p\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n\n```\nFor Next.js Use dynamic import instead of usual import.\n\n```js\n\nimport dynamic from 'next/dynamic'\nconst QrReader = dynamic(() =\u003e import('react-weblineindia-qrcode-scanner').then((a) =\u003e a.QrReader), {ssr: false});\n\n```\n\n\n## Available Props\n\n| Prop | Type | default | Description |\n| --- | --- | --- | --- |\n| delay | number | 500  |The delay between scans in milliseconds. To disable the interval pass in `false`. |\n| facingMode | string |   |Specify which camera direction should be used (if available). Options: `front` and `rear`. |\n| legacyMode | boolean |false | If the device does not allow camera access (e.g. IOS Browsers, Safari) you can enable legacyMode to allow the user to take a picture (On a mobile device) or use an existing one. To trigger the image dialog just call the method `openImageDialog` from the parent component. **Warning** You must call the method from a user action (eg. click event on some element).|\n| maxImageSize | number | 1500   |  If `legacyMode` is active then the image will be downscaled to the given value while keepings its aspect ratio. Allowing larger images will increase the accuracy but it will also slow down the processing time.|\n| style | object |   | Styling for the preview element. This will be a `video` or an `img` when `legacymode` is `true`. **Warning** The preview will keep its aspect ratio, to disable this set the CSS property [objectFit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) to `fill`.|\n| className | string |   | ClassName for the container element.  |\n| chooseDeviceId | function |   | Called when choosing which device to use for scanning. By default chooses the first video device matching `facingMode`, if no devices match the first video device found is choosen. |\n\n\n## Methods\n\n| Name | Description |\n| --- | --- |\n| onScan | Scan event handler. Called every scan with the decoded value or `null` if no QR code was found. |\n| onError | Function to call when an error occurs such as:- Not supported platform -The lack of available devices |\n| onLoad | Called when the component is ready for use. |\n| onImageLoad | Called when the image in legacyMode is loaded. |\n\n\n## Want to Contribute?\n\n- Created something awesome, made this code better, added some functionality, or whatever (this is the hardest part).\n- [Fork it](http://help.github.com/forking/).\n- Create new branch to contribute your changes.\n- Commit all your changes to your branch.\n- Submit a [pull request](http://help.github.com/pull-requests/).\n\n---\n\n## Collection of Components\n\nWe have built many other components and free resources for software development in various programming languages. Kindly click here to view our [Free Resources for Software Development](https://www.weblineindia.com/software-development-resources.html)\n\n------\n\n## Changelog\n\nDetailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).\n\n## Credits\n\nreact-weblineindia-qrcode-scanner  is inspired by [react-qr-scanner](https://www.npmjs.com/package/react-qr-scanner).\n\n## License\n\n[MIT](LICENSE)\n\n[mit]: https://github.com/weblineindia/ReactJS-QRCode-Scanner/blob/master/LICENSE\n\n## Keywords\n\nreact-weblineindia-qrcode-scanner, qrcode, qrcode-reader, qrcode-scanner, webrtc, react-qrcode-scanner, barcode-scanner, react-barcode, reactjs-qr-code, reactjs-barcode\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweblineindia%2Freactjs-qrcode-scanner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweblineindia%2Freactjs-qrcode-scanner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweblineindia%2Freactjs-qrcode-scanner/lists"}