From f5ccda360803d5305e04cf81bbb84cb3b91e5571 Mon Sep 17 00:00:00 2001 From: orfelorfel23 Date: Thu, 11 Jun 2026 21:13:18 +0200 Subject: [PATCH] fix: camera flash rendering and timing --- app-release.apk | 4 ++-- src/screens/CameraScreen.tsx | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app-release.apk b/app-release.apk index 7100b688..263c44dc 100644 --- a/app-release.apk +++ b/app-release.apk @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:362e1caef00d01de4c9123f6216c7cba40db466558d331b861d6e658d328ec48 -size 122750553 +oid sha256:5369bf32f42908619ff404a3aeb49acb0e20ffd3a6cd511cb736994cd15b5090 +size 122750577 diff --git a/src/screens/CameraScreen.tsx b/src/screens/CameraScreen.tsx index 688d2158..e3bbb046 100644 --- a/src/screens/CameraScreen.tsx +++ b/src/screens/CameraScreen.tsx @@ -126,12 +126,14 @@ export default function CameraScreen({ opacity: flashOpacity.value, })); - // Trigger white flash effect - const triggerFlash = useCallback(() => { - flashOpacity.value = withSequence( - withTiming(1, { duration: 80 }), - withTiming(0, { duration: 400 }) - ); + // Turn on white flash effect + const turnFlashOn = useCallback(() => { + flashOpacity.value = withTiming(1, { duration: 50 }); + }, []); + + // Turn off white flash effect + const turnFlashOff = useCallback(() => { + flashOpacity.value = withTiming(0, { duration: 400 }); }, []); // 1. Request built-in camera permission on mount (just in case we fallback) @@ -314,7 +316,7 @@ export default function CameraScreen({ const tempUri = tempFile.uri; try { - triggerFlash(); + turnFlashOn(); let capturedUri: string; @@ -338,6 +340,8 @@ export default function CameraScreen({ } } + turnFlashOff(); + // If user cancelled while the camera promise was processing, abort before side-effects if (isCancelledRef.current) { console.log('Capture cancelled by user during processing.'); @@ -403,6 +407,7 @@ export default function CameraScreen({ }, 400); } } catch (error: any) { + turnFlashOff(); console.error('Capture failed:', error); alert('Fehler beim Aufnehmen des Fotos: ' + error.message); onCancel(); @@ -674,6 +679,9 @@ export default function CameraScreen({ {/* Render UI controls/overlays on top */} {renderContent()} + + {/* Flash overlay */} + ); }