Fix cancel logic and disable New Architecture to prevent ViewShot crash

This commit is contained in:
2026-05-31 15:21:55 +02:00
parent d80b6df2fa
commit e5af94fea1
2 changed files with 15 additions and 11 deletions
+1
View File
@@ -1,5 +1,6 @@
{ {
"expo": { "expo": {
"newArchEnabled": false,
"name": "Schnappix", "name": "Schnappix",
"slug": "Schnappix", "slug": "Schnappix",
"version": "1.0.0", "version": "1.0.0",
+14 -11
View File
@@ -158,6 +158,18 @@ export default function CameraScreen({
}; };
}, []); }, []);
// Cancel capture process
const handleLocalCancel = () => {
if (countdownTimerRef.current) clearInterval(countdownTimerRef.current);
if (burstTimerRef.current) clearTimeout(burstTimerRef.current);
setCountdown(countdownDuration);
setIsCapturing(false);
setBurstIndex(0);
setBurstUris([]);
setShowBurstIndicator('');
onCancel();
};
// 3. Start the countdown on screen load (only when NOT idle) // 3. Start the countdown on screen load (only when NOT idle)
useEffect(() => { useEffect(() => {
if (isIdle) { if (isIdle) {
@@ -353,15 +365,6 @@ export default function CameraScreen({
} }
}; };
const handleCancel = useCallback(() => {
if (burstTimerRef.current) {
clearTimeout(burstTimerRef.current);
}
setHasStarted(false);
setIsCapturing(false);
onCancel();
}, [onCancel]);
const handleSettingsTap = () => { const handleSettingsTap = () => {
setEnteredPassword(''); setEnteredPassword('');
setErrorText(''); setErrorText('');
@@ -395,7 +398,7 @@ export default function CameraScreen({
<TouchableOpacity style={styles.btn} onPress={requestPermission}> <TouchableOpacity style={styles.btn} onPress={requestPermission}>
<Text style={styles.btnText}>Erlaubnis erteilen</Text> <Text style={styles.btnText}>Erlaubnis erteilen</Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity style={[styles.btn, styles.cancelBtn]} onPress={onCancel}> <TouchableOpacity style={[styles.btn, styles.cancelBtn]} onPress={handleLocalCancel}>
<Text style={styles.btnText}>Zurück</Text> <Text style={styles.btnText}>Zurück</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
@@ -538,7 +541,7 @@ export default function CameraScreen({
{/* Cancel Button */} {/* Cancel Button */}
{!isCapturing && !isBurstWaiting && ( {!isCapturing && !isBurstWaiting && (
<TouchableOpacity style={styles.backButton} onPress={handleCancel}> <TouchableOpacity style={styles.backButton} onPress={handleLocalCancel}>
<FontAwesomeIcon icon={faXmark} size={16} color={THEME.colors.text} style={{ marginRight: 6 }} /> <FontAwesomeIcon icon={faXmark} size={16} color={THEME.colors.text} style={{ marginRight: 6 }} />
<Text style={styles.backButtonText}>ABBRECHEN</Text> <Text style={styles.backButtonText}>ABBRECHEN</Text>
</TouchableOpacity> </TouchableOpacity>