Skip to content

Commit

Permalink
iOS 13 fullscreen #225
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Nov 10, 2019
1 parent 9ea311e commit f671b00
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ Tip: during a scan you can use the volume up/down buttons to toggle the torch.
preferFrontCamera: false, // default false
showTorchButton: true, // default false
beepOnScan: true, // Play or Suppress beep on scan (default true)
fullScreen: true, // Currently only used on iOS; with iOS 13 modals are no longer shown fullScreen by default, which may be actually preferred. But to use the old fullScreen appearance, set this to 'true'. Default 'false'.
torchOn: false, // launch with the flashlight on (default false)
closeCallback: () => { console.log("Scanner closed")}, // invoked when the scanner was closed (success or abort)
resultDisplayDuration: 500, // Android only, default 1500 (ms), set to 0 to disable echoing the scanned text
Expand Down Expand Up @@ -221,6 +222,7 @@ Tip: during a scan you can use the volume up/down buttons to toggle the torch.
preferFrontCamera: false, // default false
showTorchButton: true, // default false
beepOnScan: true, // Play or Suppress beep on scan (default true)
fullScreen: true, // Currently only used on iOS; with iOS 13 modals are no longer shown fullScreen by default, which may be actually preferred. But to use the old fullScreen appearance, set this to 'true'. Default 'false'.
torchOn: false, // launch with the flashlight on (default false)
closeCallback: function () { console.log("Scanner closed"); }, // invoked when the scanner was closed (success or abort)
resultDisplayDuration: 500, // Android only, default 1500 (ms), set to 0 to disable echoing the scanned text
Expand Down
1 change: 1 addition & 0 deletions demo/app/main-view-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class HelloWorldModel extends Observable {
resultDisplayDuration: 500, // Android only, default 1500 (ms), set to 0 to disable echoing the scanned text
orientation: orientation, // Android only, default undefined (sensor-driven orientation), other options: portrait|landscape
beepOnScan: true, // Play or Suppress beep on scan (default true)
fullScreen: true, // iOS 13+ modal appearance changed so they can be swiped down when this is false (default false)
openSettingsIfPermissionWasPreviouslyDenied: true, // On iOS you can send the user to the settings app if access was previously denied
closeCallback: () => {
console.log("Scanner closed @ " + new Date().getTime());
Expand Down
7 changes: 7 additions & 0 deletions src/barcodescanner-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ export interface CommonScanOptions {
*/
showTorchButton?: boolean;

/**
* Currently only used on iOS; with iOS 13 modals are no longer shown fullScreen by default,
* which may be actually preferred. But to use the old fullScreen appearance, set this to 'true'.
* Default: false
*/
fullScreen?: boolean;

/**
* Launch the scanner with the flashlight turned on.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/barcodescanner.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class BarcodeScanner {
this._scanner = QRCodeReaderViewController.readerWithCancelButtonTitleCodeReaderStartScanningAtLoadShowSwitchCameraButtonShowTorchButtonCancelButtonBackgroundColor(
closeButtonLabel, reader, startScanningAtLoad, flip, torch, arg.cancelLabelBackgroundColor);

this._scanner.modalPresentationStyle = UIModalPresentationStyle.FormSheet;
this._scanner.modalPresentationStyle = arg.fullScreen ? UIModalPresentationStyle.FullScreen : UIModalPresentationStyle.FormSheet;

this._scanDelegate = QRCodeReaderDelegateImpl.initWithOwner(new WeakRef(this));
this._scanner.delegate = this._scanDelegate;
Expand Down

0 comments on commit f671b00

Please sign in to comment.