react-native-qr-img-scanner
v0.1.1
Published
A lightweight React Native library to scan and decode QR codes from static images. Currently supported on Android only.
Readme
react-native-qr-img-scanner
A lightweight and easy-to-use QR code scanner for React Native that detects QR codes from image files using ML Kit.
✨ Features
- 📷 Scan QR codes directly from image files
- 🔍 Accurate and fast detection powered by ML Kit
- ⚙️ Seamless integration with minimal setup
- 📦 Clean async API
📦 Installation
npm install react-native-qr-img-scanner
# or
yarn add react-native-qr-img-scannerAll required native dependencies are managed internally. No additional configuration is needed.
🚀 Usage
import { scanFromPath } from 'react-native-qr-img-scanner';
const scanImage = async () => {
const uri = '/path/to/image.jpg';
const codes = await scanFromPath(uri);
console.log('Detected QR Codes:', codes);
};📘 API
scanFromPath(uri: string): Promise<string[]>
Scans and extracts QR code data from a given image file path.
Parameters
uri— A local image file path.
Returns
- A
Promisethat resolves to an array of detected QR code strings.
📱 Platform Support
- Android only
Utilizes
com.google.mlkit:barcode-scanning:17.3.0under the hood for QR code detection.
📝 Notes
- Ensure the image path is valid and accessible by the app.
- Currently supports Android only
📄 License
MIT License
Made with ❤️ by Mohd Ali Ansari
