Fix JS exceptions crashing the app instantly
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
@@ -66,6 +66,7 @@ export default function AdminScreen({ currentSettings, onSave, onClose }: AdminS
|
||||
const [printerIp, setPrinterIp] = useState<string>(currentSettings.printerIp);
|
||||
const [password, setPassword] = useState<string>(currentSettings.adminPassword);
|
||||
const [logs, setLogs] = useState<string | null>(null);
|
||||
const scrollViewRef = useRef<ScrollView>(null);
|
||||
|
||||
const [kioskActive, setKioskActive] = useState<boolean>(false);
|
||||
const [isDeviceOwner, setIsDeviceOwner] = useState<boolean>(false);
|
||||
@@ -509,8 +510,8 @@ export default function AdminScreen({ currentSettings, onSave, onClose }: AdminS
|
||||
</View>
|
||||
<ScrollView
|
||||
style={{ flex: 1, backgroundColor: '#000', padding: 10, borderRadius: 5 }}
|
||||
ref={ref => { this.scrollView = ref }}
|
||||
onContentSizeChange={() => this.scrollView?.scrollToEnd({animated: true})}
|
||||
ref={scrollViewRef}
|
||||
onContentSizeChange={() => scrollViewRef.current?.scrollToEnd({animated: true})}
|
||||
>
|
||||
<Text style={{ color: '#0f0', fontFamily: 'monospace' }}>{logs}</Text>
|
||||
</ScrollView>
|
||||
|
||||
@@ -160,7 +160,7 @@ export default function CameraScreen({
|
||||
|
||||
// Cancel capture process
|
||||
const handleLocalCancel = () => {
|
||||
if (countdownTimerRef.current) clearInterval(countdownTimerRef.current);
|
||||
if (countdownTimerRef.current) clearTimeout(countdownTimerRef.current);
|
||||
if (burstTimerRef.current) clearTimeout(burstTimerRef.current);
|
||||
setCountdown(countdownDuration);
|
||||
setIsCapturing(false);
|
||||
|
||||
Reference in New Issue
Block a user