react-native-qr-image-scanner
v0.1.2
Published
A React Native module to scan QR codes and barcodes from images on iOS
Readme
react-native-qr-image-scanner
A React Native module to scan QR codes and barcodes from images on iOS (Swift, Vision framework).
Installation
npm install react-native-qr-image-scanner react-native-nitro-modules
react-native-nitro-modulesis required as this library relies on Nitro Modules.
Usage
Scan barcodes/QR codes from an image (iOS only):
import { scanFromPath } from 'react-native-qr-image-scanner';
// You can use any method to obtain an image URI or file path (camera, gallery, file system, etc.)
const scanImage = async (uri) => {
if (!uri) return;
const codes = await scanFromPath(uri);
// codes is an array of { payload, symbology }
console.log(codes);
};Note: This module does not require or depend on any specific image picker. You are free to use any method to obtain the image path/URI.
API
scanFromPath(path: string): Promise<{ payload: string; symbology: string }[]>- Scans the image at the given path/URI for barcodes and QR codes.
- Returns an array of results with the decoded payload and symbology type.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library
