The scannerLocked state was captured in handleQrScan's closure, so rapid native barcode scanner callbacks before React re-renders would all see false, bypassing the guard. Switching to a useRef ensures the lock value is read synchronously, reliably preventing duplicate scan processing.