1.0.7 • Published 10 years ago
react-native-qr-decoder v1.0.7
react-native-qr-decoder
A QR decode module for React Native.
Getting started
npm install react-native-qr-decoder@latest --save- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-qr-decoderand addreact-native-qr-decoder.xcodeproj - In XCode, in the project navigator, select your project. Add
libreact-native-qr-decoder.ato your project'sBuild Phases➜Link Binary With Libraries - Click
react-native-qr-decoder.xcodeprojin the project navigator and go theBuild Settingstab. Make sure 'All' is toggled on (instead of 'Basic'). In theSearch Pathssection, look forHeader Search Pathsand make sure it contains both$(SRCROOT)/../../react-native/Reactand$(SRCROOT)/../../../React- mark both asrecursive. - Run your project (
Cmd+R)
Usage
All you need is to require the react-native-qr-decoder module
var QRDecoder = require('NativeModules').React_native_qr_decoder;
var path = "your qr code full path";
// From local File
QRDecoder.get(path, (error, qrcode) => {
console.log(qrcode);
if (error) {
console.log(error);
return
} else {
console.log(qrcode);
// this.setState({qrcode: qrcode});
}
});