Skip to content

Commit 84dd8ec

Browse files
committed
fix: guard against duplicate resolve during destroy delay
Set isScanning = false immediately after resolve() to prevent metadataOutput from firing multiple times during the 300ms window before destroy() runs.
1 parent d06f0ac commit 84dd8ec

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

plugins/barcode-scanner/ios/Sources/BarcodeScannerPlugin.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ class BarcodeScannerPlugin: Plugin, AVCaptureMetadataOutputObjectsDelegate {
123123
}
124124

125125
invoke?.resolve(jsObject)
126+
// Stop processing further detections immediately to prevent
127+
// duplicate resolve calls during the delay window below.
128+
self.isScanning = false
126129
// Delay destroy so the IPC response reaches the JS layer before
127130
// the webview properties (isOpaque, backgroundColor) are restored.
128131
// Without this, the promise returned by scan() never resolves in

0 commit comments

Comments
 (0)