{"id":15639832,"url":"https://github.com/kybarg/react-barcode-reader","last_synced_at":"2025-04-06T09:11:25.922Z","repository":{"id":33385197,"uuid":"157989139","full_name":"kybarg/react-barcode-reader","owner":"kybarg","description":"React component for reading barcode an QR codes from devices that are represented as keyboard to the system.","archived":false,"fork":false,"pushed_at":"2024-04-30T11:09:59.000Z","size":3865,"stargazers_count":86,"open_issues_count":23,"forks_count":34,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T08:08:46.861Z","etag":null,"topics":["barcode","barcode-reader","barcode-scanner","qr-reader","qr-scanner","qrcode","qrcode-reader","qrcode-scanner","react"],"latest_commit_sha":null,"homepage":"","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/kybarg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-17T13:52:31.000Z","updated_at":"2025-03-13T16:14:32.000Z","dependencies_parsed_at":"2024-06-18T15:29:22.314Z","dependency_job_id":"869324ef-82a7-44fd-9f96-775967b52566","html_url":"https://github.com/kybarg/react-barcode-reader","commit_stats":{"total_commits":7,"total_committers":3,"mean_commits":"2.3333333333333335","dds":0.2857142857142857,"last_synced_commit":"ec45ef5ce7f388aa9914d7e5854cb3d964839676"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kybarg%2Freact-barcode-reader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kybarg%2Freact-barcode-reader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kybarg%2Freact-barcode-reader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kybarg%2Freact-barcode-reader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kybarg","download_url":"https://codeload.github.com/kybarg/react-barcode-reader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457803,"owners_count":20941906,"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","barcode-reader","barcode-scanner","qr-reader","qr-scanner","qrcode","qrcode-reader","qrcode-scanner","react"],"created_at":"2024-10-03T11:27:35.546Z","updated_at":"2025-04-06T09:11:25.901Z","avatar_url":"https://github.com/kybarg.png","language":"JavaScript","readme":"[![npm version](https://badge.fury.io/js/react-barcode-reader.svg)](https://badge.fury.io/js/react-barcode-reader)\n\n## Introduction\nA [React](https://facebook.github.io/react/) component for reading barcode and QR codes from devices that are represent as keyboard to the system.\n\n## Demo\n[kybarg.github.io/react-barcode-reader/](https://kybarg.github.io/react-barcode-reader/)\n\n## Install\n`npm install --save react-barcode-reader`\n\n## Example\n\n```js\nimport React, { Component } from 'react'\nimport BarcodeReader from 'react-barcode-reader'\n\nclass Test extends Component {\n  constructor(props){\n    super(props)\n    this.state = {\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\n    return(\n      \u003cdiv\u003e\n        \u003cBarcodeReader\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\n## Props\n| Prop | Type | Default Value | Description |\n|---|---|---|---|\n| onScan | func |  | Callback after detection of a successfull scanning (scanned string in parameter) |\n| onError | func |  | Callback after detection of a unsuccessfull scanning (scanned string in parameter) |\n| HonReceive | func |  | Callback after receiving and processing a char (scanned char in parameter)\n| onKeyDetect | func |  | Callback after detecting a keyDown (key char in parameter) - in contrast to onReceive, this fires for non-character keys like tab, arrows, etc. too!\n| timeBeforeScanTest | number | 100 | Wait duration (ms) after keypress event to check if scanning is finished\n| avgTimeByChar | number | 30 | Average time (ms) between 2 chars. Used to do difference between keyboard typing and scanning\n| minLength | number | 6 | Minimum length for a scanning\n| endChar | [number] | [9, 13] | Chars to remove and means end of scanning\n| startChar | [number] | [] | Chars to remove and means start of scanning\n| scanButtonKeyCode | number |  | Key code of the scanner hardware button (if the scanner button a acts as a key itself)\n| scanButtonLongPressThreshold | number | 3 | How many times the hardware button should issue a pressed event before a barcode is read to detect a longpress\n| onScanButtonLongPressed | func |  | Callback after detection of a successfull scan while the scan button was pressed and held down\n| stopPropagation | bool | false | Stop immediate propagation on keypress event\n| preventDefault | bool | false | Prevent default action on keypress event\n| testCode | string |  | Test string for simulating\n\n## Dev\n\n### Install dependencies\n`npm install`\n\n### Build\n`npm run build`\n\n### Demo\n`npm run storybook`\n\n### Test\n`npm test`\n\n### Linting\n`npm run lint`\n\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2017 Thomas Billiet\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkybarg%2Freact-barcode-reader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkybarg%2Freact-barcode-reader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkybarg%2Freact-barcode-reader/lists"}