Skip to content

Save QR code as png #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions react-native-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"inquirer": "^3.0.1",
"match-require": "^2.0.0",
"path-exists": "^3.0.0",
"qr-image":"^3.2.0",
"qrcode-terminal": "^0.11.0",
"xdl": "^36.0.0"
},
Expand Down
9 changes: 9 additions & 0 deletions react-native-scripts/src/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Config, ProjectSettings, UrlUtils } from 'xdl';
import chalk from 'chalk';
import indent from 'indent-string';
import qr from 'qrcode-terminal';
import qrImage from 'qr-image';

import packager from '../util/packager';

Expand Down Expand Up @@ -39,5 +40,13 @@ For links to install the Expo app, please visit ${chalk.underline(chalk.cyan('ht
Logs from serving your app will appear here. Press Ctrl+C at any time to stop.
`
);

var qrCodeImage = qrImage.image(address, { type: 'png' });

qrCodeImage.pipe(require('fs').createWriteStream('qrCodeImage.png'));

console.log(
`If the above QR code doesn't work, an image of the same has been saved to your project's root.`
);
});
}