Skip to content
Open
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
13 changes: 12 additions & 1 deletion plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,19 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate {
jsObject["content"] = found.stringValue
}

// Stop scanning and clean up camera and webview state before
// resolving. In windowed mode, restoring webView.isOpaque after
// resolve() prevents the IPC response from reaching JavaScript.
self.isScanning = false
dismantleCamera()
if windowed {
let backgroundColor = previousBackgroundColor ?? UIColor.white
webView.isOpaque = true
webView.backgroundColor = backgroundColor
webView.scrollView.backgroundColor = backgroundColor
}
invoke?.resolve(jsObject)
destroy()
invoke = nil

}
}
Expand Down