Skip to content

Commit

Permalink
[iOS] Custom navigation vanishes after camera was opened #220
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Sep 10, 2019
1 parent d9d6dbb commit bca8e6d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/barcodescanner.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class BarcodeScanner {
private _audioSession: AVAudioSession;
private _closeCallback: any;
private _device: AVCaptureDevice;
private _lastScanOptions: ScanOptions;

constructor() {
if (typeof AVAudioSession.sharedInstance().setCategoryModeOptionsError === "function") {
Expand Down Expand Up @@ -191,7 +192,7 @@ export class BarcodeScanner {
public stop(): Promise<any> {
return new Promise((resolve, reject) => {
try {
this.getViewControllerToPresentFrom().dismissViewControllerAnimatedCompletion(true, null);
this.getViewControllerToPresentFrom(this._lastScanOptions ? this._lastScanOptions.presentInRootViewController : false).dismissViewControllerAnimatedCompletion(true, null);
this._removeVolumeObserver();
this._closeCallback && this._closeCallback();
resolve();
Expand All @@ -216,6 +217,8 @@ export class BarcodeScanner {
this._addVolumeObserver();

arg = arg || {};
this._lastScanOptions = arg;

let closeButtonLabel = arg.cancelLabel || "Close";
let isContinuous = typeof arg.continuousScanCallback === "function";

Expand Down

0 comments on commit bca8e6d

Please sign in to comment.