A simple library for generating and scanning QR codes natively.
import QRCode from 'ti.qrcode';
const win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
win.add(Ti.UI.createImageView({
width: 200,
height: 200,
top: 30,
image: QRCode.fromString('https://google.com')
}));
const btn = Ti.UI.createButton({
title: 'Start scan',
top: 250
});
btn.addEventListener('click', () => {
QRCode.scan({
callback: event => {
alert('SUCCESS: ' + event.success + ', TEXT: ' + event.text || 'n/a');
}
});
// iOS-only: Use "hideActiveScanner()" to hide the active scanner manually
});
win.add(btn);
win.open();
MIT
Hans Knöchel