内容简介:Linking is not needed anymore.
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. react-native@0.60.0+
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-generatorand addRNQrGenerator.xcodeproj -
In XCode, in the project navigator, select your project. Add
libRNQrGenerator.ato 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));
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
深入理解计算机系统(英文版·第2版)
[美] Randal E. Bryant、[美] David R. O'Hallaron / 机械工业出版社 / 2011-1 / 128.00元
本书是一本将计算机软件和硬件理论结合讲述的经典教程,内容覆盖计算机导论、体系结构和处理器设计等多门课程。本书的最大优点是为程序员描述计算机系统的实现细节,通过描述程序是如何映射到系统上,以及程序是如何执行的,使读者更好地理解程序的行为为什么是这样的,以及造成效率低下的原因。 相对于第1版,本版主要是反映了过去十年间硬件技术和编译器的变化,具体更新如下: 1. 对系统的介绍(特别是实际使......一起来看看 《深入理解计算机系统(英文版·第2版)》 这本书的介绍吧!