{"_id":"@amrshbib/react-native-barcode-laser","_rev":"2-8ca51ebaa4a82e20ab656be76ae553d0","name":"@amrshbib/react-native-barcode-laser","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@amrshbib/react-native-barcode-laser","version":"0.1.0","keywords":["react-native","android","barcode","scanner","laser","sunmi","zebra","datawedge","honeywell","chainway","urovo","pda","handheld","broadcast","intent","keyboard-wedge"],"author":{"name":"Amr Shbib","email":"amr.shbib@mythings.app"},"license":"MIT","_id":"@amrshbib/react-native-barcode-laser@0.1.0","maintainers":[{"name":"amrshbib","email":"amr.shbib@gmail.com"}],"homepage":"https://github.com/amrshbib/react-native-barcode-laser#readme","bugs":{"url":"https://github.com/amrshbib/react-native-barcode-laser/issues"},"dist":{"shasum":"f0271077900ee6446a7ed96aa9b5b91f4ac99ad2","tarball":"https://registry.npmjs.org/@amrshbib/react-native-barcode-laser/-/react-native-barcode-laser-0.1.0.tgz","fileCount":11,"integrity":"sha512-ZGfVSmUPeSiGL53uVoBS8hkW8vzjbrBbSZz/WpMvgUMBPcOoS/hQdYw3TY5fxHppFbDO4fLXej5/UnYyDrBTzw==","signatures":[{"sig":"MEQCIEBkwyO3AWmdTEE5wQk2NcnlCUUrQ6kfYeUV1cdncGEgAiA8eejr/+O138ES021YlmA3k4nX1xL+3sFZdgoL+t2xpA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35050},"main":"index.js","types":"src/types.d.ts","gitHead":"907f8d5d5d3525023635ddd262ffc418d1c455a2","_npmUser":{"name":"amrshbib","email":"amr.shbib@gmail.com"},"repository":{"url":"git+https://github.com/amrshbib/react-native-barcode-laser.git","type":"git"},"_npmVersion":"11.6.2","description":"React Native bridge for Android handheld laser/infrared barcode scanners (Sunmi L2s Pro, L3, Zebra, Honeywell, Chainway, Urovo, Generic). Broadcast Intent + Keyboard Wedge support, no camera.","directories":{},"_nodeVersion":"25.2.1","react-native":"index.js","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"react":">=18.0.0","react-native":">=0.70.0"},"_npmOperationalInternal":{"tmp":"tmp/react-native-barcode-laser_0.1.0_1777167344028_0.5397722763974075","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@amrshbib/react-native-barcode-laser","version":"0.1.1","description":"React Native bridge for Android handheld laser/infrared barcode scanners (Sunmi L2s Pro, L3, Zebra, Honeywell, Chainway, Urovo, Generic). Broadcast Intent + Keyboard Wedge support, no camera.","main":"index.js","types":"src/types.d.ts","keywords":["react-native","android","barcode","scanner","laser","sunmi","zebra","datawedge","honeywell","chainway","urovo","pda","handheld","broadcast","intent","keyboard-wedge"],"author":{"name":"Amr Shbib","email":"amr.shbib@mythings.app"},"license":"MIT","peerDependencies":{"react":">=18.0.0","react-native":">=0.70.0"},"react-native":"index.js","repository":{"type":"git","url":"git+https://github.com/amrshbib/react-native-barcode-laser.git"},"publishConfig":{"access":"public"},"gitHead":"272647e146b21af482b4ffc1f7df09e31f2dce9d","_id":"@amrshbib/react-native-barcode-laser@0.1.1","bugs":{"url":"https://github.com/amrshbib/react-native-barcode-laser/issues"},"homepage":"https://github.com/amrshbib/react-native-barcode-laser#readme","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-HkXJ5mQny+Wwijo5JMH1hd/N/NuHpwfShRepmoGc7qnTSpGEOlEDXQuXm2MUqkLI2OQQqEc+x0ETnRkUKd+/VQ==","shasum":"e83b598b0447590ffcee864bc3ad2781562ad856","tarball":"https://registry.npmjs.org/@amrshbib/react-native-barcode-laser/-/react-native-barcode-laser-0.1.1.tgz","fileCount":12,"unpackedSize":48153,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCe2l4BflrZQWhD4SH8PV8CKkyU8kHVGCL/aI4JyanmgQIhALalmp/Hvf9l0xBz6I1dEo7qtkk6Iwe0YuMXi3W8UuGw"}]},"_npmUser":{"name":"amrshbib","email":"amr.shbib@gmail.com"},"directories":{},"maintainers":[{"name":"amrshbib","email":"amr.shbib@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-native-barcode-laser_0.1.1_1777285913914_0.8892511567837975"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-26T01:35:43.751Z","modified":"2026-04-27T10:31:54.203Z","0.1.0":"2026-04-26T01:35:44.181Z","0.1.1":"2026-04-27T10:31:54.077Z"},"bugs":{"url":"https://github.com/amrshbib/react-native-barcode-laser/issues"},"author":{"name":"Amr Shbib","email":"amr.shbib@mythings.app"},"license":"MIT","homepage":"https://github.com/amrshbib/react-native-barcode-laser#readme","keywords":["react-native","android","barcode","scanner","laser","sunmi","zebra","datawedge","honeywell","chainway","urovo","pda","handheld","broadcast","intent","keyboard-wedge"],"repository":{"type":"git","url":"git+https://github.com/amrshbib/react-native-barcode-laser.git"},"description":"React Native bridge for Android handheld laser/infrared barcode scanners (Sunmi L2s Pro, L3, Zebra, Honeywell, Chainway, Urovo, Generic). Broadcast Intent + Keyboard Wedge support, no camera.","maintainers":[{"name":"amrshbib","email":"amr.shbib@gmail.com"}],"readme":"# React Native Barcode Laser\n\n[![npm downloads](https://img.shields.io/npm/dm/@amrshbib/react-native-barcode-laser.svg)](https://www.npmjs.com/package/@amrshbib/react-native-barcode-laser)\n[![npm downloads](https://img.shields.io/npm/dw/@amrshbib/react-native-barcode-laser.svg)](https://www.npmjs.com/package/@amrshbib/react-native-barcode-laser)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![React Native](https://img.shields.io/badge/React%20Native-0.70%2B-blue.svg)](https://reactnative.dev/)\n\nA high-performance React Native bridge for **Android handheld laser/infrared barcode scanners**. This package integrates directly with physical scan engines (not cameras) for enterprise PDA devices like Sunmi, Zebra, Honeywell, Chainway, and Urovo.\n\n## ✨ Features\n\n- 🚀 **Hardware Native**: Zero-latency capture via native Android Broadcast Intents.\n- 📡 **OEM Support**: Pre-configured for Sunmi, Zebra (DataWedge), Honeywell, Newland, Chainway, and more.\n- 🏗️ **Dual Mode**: Supports both **Broadcast Intent** (API) and **Keyboard Wedge** modes.\n- 🎣 **Power Hook**: `useBarcodeLaser` hook with state management and promise-based one-shot scanning.\n- 🔔 **Feedback Control**: Native support for hardware beeps and vibrations.\n- 🛠️ **Developer Friendly**: Inject fake scans for testing, debounce, length filtering, and device info.\n- 📝 **TypeScript First**: Complete type definitions for a better development experience.\n\n## 📦 Installation\n\n```bash\nnpm install @amrshbib/react-native-barcode-laser\n# or\nyarn add @amrshbib/react-native-barcode-laser\n```\n\n### Android Configuration\n\nAndroid autolinking handles the setup. After installation, rebuild your project:\n\n```bash\ncd android && ./gradlew clean && cd ..\nnpx react-native run-android\n```\n\n> **Note**: This package is Android-only as it targets handheld hardware scanners. iOS calls will return safe defaults (e.g., `isAvailable() -> false`).\n\n## 🚀 Quick Start\n\n### 1. Using the Hook (Recommended)\n\n```javascript\nimport { useBarcodeLaser } from \"@amrshbib/react-native-barcode-laser\";\n\nconst ScannerScreen = () => {\n  const { lastScan, started, available, scan } = useBarcodeLaser({\n    autoStart: true,\n    onScan: (event) => {\n      console.log(\"Scanned:\", event.data);\n    }\n  });\n\n  // Example of capturing a single scan programmatically\n  const scanOne = async () => {\n    const result = await scan();\n    alert(`Captured: ${result.data}`);\n  };\n\n  if (available === false) return <Text>Hardware scanner not found</Text>;\n\n  return (\n    <View>\n      <Text>Status: {started ? \"Active\" : \"Stopped\"}</Text>\n      <Text>Last Barcode: {lastScan?.data}</Text>\n      <Button title=\"One-shot Scan\" onPress={scanOne} />\n    </View>\n  );\n};\n```\n\n### 2. Imperative API\n\n```javascript\nimport BarcodeLaser from \"@amrshbib/react-native-barcode-laser\";\n\n// Start the listener\nconst initScanner = async () => {\n  await BarcodeLaser.configure({ \n    mode: 'broadcast',\n    beepOnSuccess: true \n  });\n  await BarcodeLaser.start();\n  \n  const sub = BarcodeLaser.addListener((event) => {\n    console.log(`Scanned: ${event.data} via ${event.source}`);\n  });\n};\n```\n\n## 📖 API Reference\n\n### `BarcodeLaser.configure(options)`\n\nSets global configuration for the scanner hardware.\n\n| Property | Type | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `mode` | `string` | `'broadcast'` | `'broadcast'`, `'wedge'`, or `'auto'` |\n| `beepOnSuccess` | `boolean` | `true` | Play system beep on successful scan |\n| `vibrateOnSuccess`| `boolean` | `false` | Vibrate on successful scan |\n| `vibrateDurationMs` | `number` | `60` | Duration of the success vibration |\n| `debounceMs` | `number` | `50` | Prevents rapid-fire duplicate scans |\n| `minLength` | `number` | `1` | Ignore barcodes shorter than this |\n| `maxLength` | `number` | `0` | Ignore barcodes longer than this (0 = no limit) |\n| `stripWhitespace` | `boolean` | `true` | Trims results automatically |\n| `actions` | `string[]` | (Defaults) | Custom intent actions to listen for |\n| `extras` | `string[]` | (Defaults) | Custom intent extra keys for data |\n\n### `BarcodeLaser.start()` / `stop()`\nEnables or disables the hardware listener. Returns `Promise<boolean>`.\n\n### `BarcodeLaser.trigger()` / `stopTrigger()`\nProgrammatically toggles the physical laser beam (on supported hardware).\n\n### `BarcodeLaser.beep()` / `vibrate(ms)`\nManually trigger the handheld's feedback systems.\n\n### `BarcodeLaser.injectScan(data, type)`\nInject a mock scan event into the listener. Great for development on emulators.\n\n### `BarcodeLaser.getDeviceInfo()`\nReturns `Promise<{ manufacturer: string, model: string, isSunmi: boolean, ... }>` with detailed OEM info.\n\n## 🎣 useBarcodeLaser Hook\n\nExposes the full power of the scanner as a React state.\n\n| Return Key | Type | Description |\n| :--- | :--- | :--- |\n| `available` | `boolean \\| null` | `null` while detecting, then `true` if hardware found |\n| `started` | `boolean` | Current status of the listener |\n| `lastScan` | `ScanEvent` | The most recently captured barcode object |\n| `error` | `ScanError` | Last error event |\n| `scan()` | `() => Promise` | Triggers laser and resolves with the **next** scan |\n| `trigger()` | `Function` | Fire the laser manually |\n| `beep()` | `Function` | Play system beep |\n\n## 🔧 Platform Setup & OEM Config\n\n### Sunmi Devices (L2s Pro, L3, etc.)\n1. Open **Scanner Settings** on the device.\n2. Output Mode: **Output via API** (or Broadcast).\n3. Intent Action: `com.sunmi.scanner.ACTION_DATA_CODE_RECEIVED`.\n4. Intent Extra: `data`.\n\n### Zebra (DataWedge)\n1. Open **DataWedge** app.\n2. Select your profile (e.g., `Profile0`).\n3. Intent Output: **Enabled**.\n4. Intent Action: `com.symbol.datawedge.api.RESULT_ACTION`.\n5. Intent Delivery: **Broadcast Intent**.\n\n## 🤝 Contributing & Support\n\nIf you have a specific handheld device that requires a new default intent action, please submit a PR or open an issue!\n\n## 📄 License\n\nThe MIT License - Copyright (c) 2024 Amr Shbib\n","readmeFilename":"README.md"}