From 9532d410a55c2c80f6f7d72648f34a356aa6670d Mon Sep 17 00:00:00 2001 From: Randall Stillwell Date: Tue, 22 Jul 2025 09:57:56 -0500 Subject: [PATCH] Fix camera UI issue - always render video element MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 Root Cause Fixed: - Video element was conditionally rendered based on isStreaming - When user clicks 'Start Camera', video element doesn't exist yet - This makes videoRef.current null, causing 'Video element not available' error ✅ Solution: - Always render video element in DOM - Show placeholder when not streaming - Show scan guide overlay only when streaming - Video ref is now always available for camera initialization This fixes the core issue where camera works but UI doesn't show! --- src/components/CameraScanner.tsx | 54 +++++++++++++++----------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/src/components/CameraScanner.tsx b/src/components/CameraScanner.tsx index 37ef9dd..e770342 100644 --- a/src/components/CameraScanner.tsx +++ b/src/components/CameraScanner.tsx @@ -239,18 +239,19 @@ const CameraScanner: React.FC = ({ onCardScanned, onError }) )} - {/* Camera Preview */} - {(isStreaming || streamRef.current) && ( -
-