Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A react-native component to generate [QRcode](http://en.wikipedia.org/wiki/QR_co

## Installation
```sh
npm install react-native-qrcode --save
npm install react-native-webview react-native-qrcode --save
```
## Usage
```jsx
Expand Down
14 changes: 13 additions & 1 deletion lib/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@ var createReactClass = require('create-react-class');

var {
View,
WebView,
Platform
} = require('react-native');

var {WebView} = require('react-native-webview');

// Fixed QRCode not filling the whole screen
var AutoSetScale = `
setTimeout(() => {
const meta = document.createElement('meta');
meta.setAttribute('content', 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0');
meta.setAttribute('name', 'viewport');
document.getElementsByTagName('head')[0].appendChild(meta);
}, 100)
`

var Canvas = createReactClass({
propTypes: {
style: PropTypes.object,
Expand All @@ -25,6 +36,7 @@ var Canvas = createReactClass({
return (
<View style={this.props.style}>
<WebView
injectedJavaScript={AutoSetScale}
automaticallyAdjustContentInsets={false}
scalesPageToFit={Platform.OS === 'android'}
contentInset={{top: 0, right: 0, bottom: 0, left: 0}}
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-qrcode",
"version": "0.2.7",
"version": "0.2.9",
"description": "react-native qrocode generator",
"main": "index.js",
"repository": {
Expand All @@ -21,5 +21,8 @@
"create-react-class": "^15.6.0",
"prop-types": "^15.5.10",
"qr.js": "0.0.0"
},
"peerDependencies": {
"react-native-webview": "*"
}
}