

React Native module for generating QR codes
source link: https://github.com/gevorg94/rn-qr-generator
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

rn-qr-generator
Getting started
$ npm install rn-qr-generator --save
Mostly automatic installation
$ react-native link rn-qr-generator
Important:
Linking is not needed anymore. [email protected]+
supports dependencies auto linking.
For iOS you also need additional step to install auto linked Pods (Cocoapods should be installed):
cd ios && pod install && cd ../
Manual installation
iOS
-
In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
-
Go to
node_modules
➜rn-qr-generator
and addRNQrGenerator.xcodeproj
-
In XCode, in the project navigator, select your project. Add
libRNQrGenerator.a
to your project'sBuild Phases
➜Link Binary With Libraries
-
Run your project (
Cmd+R
)<
Android
-
Open up
android/app/src/main/java/[...]/MainActivity.java
-
Add
import com.gevorg.reactlibrary.RNQrGeneratorPackage;
to the imports at the top of the file -
Add
new RNQrGeneratorPackage()
to the list returned by thegetPackages()
method
-
Append the following lines to
android/settings.gradle
:include ':rn-qr-generator' project(':rn-qr-generator').projectDir = new File(rootProject.projectDir, '../node_modules/rn-qr-generator/android')
-
Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':rn-qr-generator')
Usage
import RNQRGenerator from 'rn-qr-generator'; RNQRGenerator.generate({ value: 'https://github.com/gevorg94/rn-qr-generator', // required height: 100, width: 100, base64: false, // default 'false' backgroundColor: 'black', // default 'white' color: 'white', // default 'black' }) .then(response => { const { uri, width, height, base64 } = response; this.setState({ imageUri: uri }); }) .catch(error => console.log('Cannot create QR code', error));
Recommend
-
15
This simple piece of code probably prints one of the most misunderstood outputs in Java: System.out.println(new Object()); And that output would be: ...
-
10
Why Grubhub uses crypto when generating coupon codes at scale
-
4
react-native-dbr This is a sample that shows how to implement barcode scanning in React Native using Dynamsoft Barcode Reader SDK.
-
9
react-native-pdf-thumbnail A react native module for generating thumbnail for PDF files. A wrapper for: PDFKit on iOS (requires iOS 11+) PdfRenderer on Android (requires API level 21 - LOLLIPOP) ...
-
15
Useful RGB color codesPosted on January 8th, 2020I collect many RGB color code that alway use over and over. think your guy need to bookmark cheer Color Name #RRGGBB (Hex Code)...
-
4
-
15
Announcement React Native IAP hook is out. You can see medium post on how to use it. The react-native-iap module hasn't bee...
-
9
react-native-webrtc A WebRTC module for React Native. Support iOS / macOS / Android. Support Video / Audio / Data Channels. NOTE for Expo users: this plugin doesn't work unless you e...
-
6
Sign up With App Center to use CodePush React Native Module for CodePush Note: This README is only relevant to the latest version of our...
-
5
react-native-qrcode-styled Fully customizable QR Codes generator for React Native using react-native-svg Installation npm i react-native-svg react-native-qrcode-styled or with yarn ya...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK