Skip to Content

React Barcode Scanner

基于 Barcode Detection API 的 React 组件与 Hooks 库,通过浏览器相机扫描条形码。支持原生 BarcodeDetector,也可使用 ZBar 或 ZXing Polyfill。

适合什么场景?

适用于 React 或 Next.js 应用中的相机扫码、条码格式配置、闪光灯控制和多扫码器场景。浏览器不支持 Barcode Detection API 时,引入 ZBar 或 ZXing Polyfill 即可。

核心能力

  • 可组合的扫码 Hooks,状态可直接读取与控制
  • 支持原生 BarcodeDetector
  • 内置 ZBar Polyfill,支持可选的 ZXing Polyfill
  • 通过 BarcodeScannerProvider 隔离多个扫码器状态

从这里开始

项目与支持

项目使用 MIT 许可证。可以访问 GitHub 查看源码和提交问题,或在 npm 查看 react-barcode-scanner

Last updated on