fix(scanner): camera restarts automatically after a scan (paused-driven lifecycle)
The camera stopped after decoding one code (by design, one scan at a time) but was only ever started on mount, so it stayed dead until staff navigated away and back. The parent now owns the lifecycle via a paused prop: Scan pauses while busy or any sheet is open (camera re-arms when the sheet closes), Login pauses while busy (re-arms after a failed scan). scannedRef guards duplicate callbacks between decode and stop. Co-authored-by: Stephan Charles <[email protected]> Co-authored-by: Amelia Hernandez <[email protected]> Co-authored-by: Markus Franz <[email protected]> Co-authored-by: Sabrina Hota <[email protected]> Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
1 parent
383a80f5ec
commit
d3531e1fac
4 files changed
+59
-6
No files matched your search
@@ -118,6 +118,7 @@ export function Login() {
|
||||
<div className="h1">Welcome back 👋</div>
|
||||
<Scanner
|
||||
onResult={handleScan}
|
||||
paused={busy}
|
||||
label="Point your camera at your lanyard QR"
|
||||
entryLabel="QR Code"
|
||||
placeholder="QR Code"
|
||||
|
||||
@@ -169,7 +169,7 @@ export function Scan() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Scanner onResult={handleScan} label={activeStaff ? 'Point at an attendee’s lanyard' : 'Point at a peer’s lanyard'} />
|
||||
<Scanner onResult={handleScan} paused={busy || !!connectTarget || !!checkin || !!pendingWelcome || !!welcome} label={activeStaff ? 'Point at an attendee’s lanyard' : 'Point at a peer’s lanyard'} />
|
||||
{busy && <div className="center"><Spinner /></div>}
|
||||
{activeStaff && !welcomeMode && selSession && (
|
||||
<div className="muted small" style={{ textAlign: 'center', opacity: 0.6 }}>
|
||||
|
||||
Reference in new issue
Block a user