react-native-qr-gallery
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

react-native-qr-gallery

Library to select an image from image gallery and read QR code from it

Getting started

$ npm install react-native-qr-gallery --save

Mostly automatic installation

$ react-native link react-native-qr-gallery

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-qr-gallery and add RNQrGallery.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNQrGallery.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RNQrGalleryPackage; to the imports at the top of the file
  • Add new RNQrGalleryPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-qr-gallery'
    project(':react-native-qr-gallery').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-qr-gallery/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-qr-gallery')
    

Usage

import RNQrGallery from 'react-native-qr-gallery';
 
try {
    const data = await RNQrGallery.readQRCode();
    if (data === 'CANCEL') {
        return;
    }
    alert(data);
} catch (e) {
    console.log('onError', e);
}
 

Readme

Keywords

Package Sidebar

Install

npm i react-native-qr-gallery

Weekly Downloads

3

Version

1.0.11

License

none

Unpacked Size

740 kB

Total Files

58

Last publish

Collaborators

  • aaron_ta