summaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2016-08-15 19:15:17 +0300
committerYuval Adam <_@yuv.al>2016-08-15 19:15:17 +0300
commitaff137fd2ebc552a56eb18a4195cbdb54d67d851 (patch)
tree415ec6f616fe7f36c7d88b4a4f64a0aa8e25106a /index.js
parent7527cf9b7114c3c60e17259e1e880ca88c38f1b5 (diff)
parentb6349468230377eabbe31877f751167413ad01a7 (diff)
Merge branch 'master' into gh-pages
Diffstat (limited to 'index.js')
-rw-r--r--index.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/index.js b/index.js
index bea4da8..306a819 100644
--- a/index.js
+++ b/index.js
@@ -20,11 +20,14 @@ class Qrgen extends React.Component {
value: this.state.text,
size: this.state.size
})
+ this.refs.qrimg.src = this.qr.toDataURL()
}
+
componentDidUpdate (prevProps, prevState) {
this.qr.value = this.state.text
this.qr.size = this.state.size
+ this.refs.qrimg.src = this.qr.toDataURL()
}
render () {
@@ -36,7 +39,9 @@ class Qrgen extends React.Component {
<input type='text' value={this.state.size} onChange={(e) => {
this.setState(Object.assign({}, this.state, { size: e.target.value }))
}}></input>
+ <p className='save'>To save the QR code, right-click the image and 'Save Image As', or touch and hold the image on your mobile browser.</p>
<canvas ref='qr' id='qr'></canvas>
+ <img ref='qrimg' id='qrimg'></img>
<footer>
<p>Created by <a href="https://yuv.al">Yuval Adam</a>. Source available on <a href="https://github.com/yuvadm/qrgen.xyz">Github</a>.</p>
</footer>