From 870d9f55a1eef3b615ce7bba20c1e2a7e8abfe79 Mon Sep 17 00:00:00 2001 From: MonchiLin Date: Wed, 8 Jan 2020 10:24:16 +0800 Subject: [PATCH 1/3] fix: Use react-native-webview instead of reaction-native/webview --- lib/Canvas.js | 3 ++- package.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Canvas.js b/lib/Canvas.js index 3b1ab26..5d392b7 100644 --- a/lib/Canvas.js +++ b/lib/Canvas.js @@ -6,10 +6,11 @@ var createReactClass = require('create-react-class'); var { View, - WebView, Platform } = require('react-native'); +var { WebView } = require('react-native-webview') + var Canvas = createReactClass({ propTypes: { style: PropTypes.object, diff --git a/package.json b/package.json index c051fa9..ceedcce 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "dependencies": { "create-react-class": "^15.6.0", "prop-types": "^15.5.10", - "qr.js": "0.0.0" + "qr.js": "0.0.0", + "react-native-webview": "^8.0.3" } } From 7cddbc6484f40223446cfc0e5f67a1c636cd7ab0 Mon Sep 17 00:00:00 2001 From: MonchiLin Date: Wed, 8 Jan 2020 15:42:34 +0800 Subject: [PATCH 2/3] fix: Fixed QRCode not filling the whole screen --- lib/Canvas.js | 13 ++++++++++++- package.json | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Canvas.js b/lib/Canvas.js index 5d392b7..cfb5754 100644 --- a/lib/Canvas.js +++ b/lib/Canvas.js @@ -9,7 +9,17 @@ var { Platform } = require('react-native'); -var { WebView } = require('react-native-webview') +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: { @@ -26,6 +36,7 @@ var Canvas = createReactClass({ return ( Date: Wed, 8 Jan 2020 16:03:01 +0800 Subject: [PATCH 3/3] chore: Avoid multiple react native lib --- README.md | 2 +- package.json | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ae43768..a991646 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index 4dc61e3..15d2e81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-qrcode", - "version": "0.2.8", + "version": "0.2.9", "description": "react-native qrocode generator", "main": "index.js", "repository": { @@ -20,7 +20,9 @@ "dependencies": { "create-react-class": "^15.6.0", "prop-types": "^15.5.10", - "qr.js": "0.0.0", - "react-native-webview": "^8.0.3" + "qr.js": "0.0.0" + }, + "peerDependencies": { + "react-native-webview": "*" } }