From 9b1168a7452d6cf91d26d59ad14f65935a03c543 Mon Sep 17 00:00:00 2001 From: Kresna Date: Fri, 31 Jul 2026 11:11:02 +0700 Subject: [PATCH] fix(camera): always offer 'Use device camera', not just on error The native option was only rendered inside the error branch, so once the live camera worked it disappeared. Mount the native input always and add a 'Use device camera' button to the live-view controls too (opens the OS camera app on phones). Stop the live stream when the native path is used. Co-Authored-By: Claude Opus 4.8 --- src/islands/image/CameraCapture.tsx | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/islands/image/CameraCapture.tsx b/src/islands/image/CameraCapture.tsx index 3f946fb..2fcbaed 100644 --- a/src/islands/image/CameraCapture.tsx +++ b/src/islands/image/CameraCapture.tsx @@ -39,26 +39,20 @@ export default function CameraCapture({ const onFallbackFile = (e: React.ChangeEvent) => { const file = e.target.files?.[0]; - if (file) onCapture(file); + if (file) { stop(); onCapture(file); } }; + const useDeviceCamera = () => fileInputRef.current?.click(); + return (
{error ? (
{error.message}
- +
-
) : (
@@ -66,10 +60,22 @@ export default function CameraCapture({
{hasMultiple && } + {/* Always available — opens the OS camera app on phones. */} +
)} + + {/* Native capture input, always mounted so it works in either state. */} +
); }