Upgrade log view UI with share button and auto-scroll

This commit is contained in:
2026-05-31 15:26:06 +02:00
parent e5af94fea1
commit 8291d3f05b
2 changed files with 29 additions and 5 deletions
+23 -4
View File
@@ -491,19 +491,38 @@ export default function AdminScreen({ currentSettings, onSave, onClose }: AdminS
<Modal visible={logs !== null} transparent animationType="slide">
<View style={{ flex: 1, backgroundColor: 'rgba(0,0,0,0.8)', justifyContent: 'center', alignItems: 'center' }}>
<View style={{ width: '90%', height: '85%', backgroundColor: '#222', borderRadius: 10, padding: 20 }}>
<Text style={{ fontSize: 24, fontWeight: 'bold', color: '#fff', marginBottom: 10 }}>App Logs</Text>
<ScrollView style={{ flex: 1, backgroundColor: '#000', padding: 10, borderRadius: 5 }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 10 }}>
<Text style={{ fontSize: 24, fontWeight: 'bold', color: '#fff' }}>App Logs</Text>
<TouchableOpacity
style={{ backgroundColor: THEME.colors.accent, paddingVertical: 8, paddingHorizontal: 12, borderRadius: 8 }}
onPress={async () => {
try {
const { Share } = require('react-native');
await Share.share({ message: logs || '' });
} catch (e) {
console.log('Share error', e);
}
}}
>
<Text style={{ color: '#fff', fontWeight: 'bold' }}>Teilen / Kopieren</Text>
</TouchableOpacity>
</View>
<ScrollView
style={{ flex: 1, backgroundColor: '#000', padding: 10, borderRadius: 5 }}
ref={ref => { this.scrollView = ref }}
onContentSizeChange={() => this.scrollView?.scrollToEnd({animated: true})}
>
<Text style={{ color: '#0f0', fontFamily: 'monospace' }}>{logs}</Text>
</ScrollView>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginTop: 15 }}>
<TouchableOpacity
style={{ backgroundColor: THEME.colors.primary, padding: 15, borderRadius: 8 }}
style={{ backgroundColor: THEME.colors.primary, padding: 15, borderRadius: 8, flex: 0.48, alignItems: 'center' }}
onPress={() => setLogs(null)}
>
<Text style={{ color: '#fff', fontWeight: 'bold' }}>Schließen</Text>
</TouchableOpacity>
<TouchableOpacity
style={{ backgroundColor: THEME.colors.danger, padding: 15, borderRadius: 8 }}
style={{ backgroundColor: THEME.colors.danger, padding: 15, borderRadius: 8, flex: 0.48, alignItems: 'center' }}
onPress={async () => { await logger.clearLogs(); setLogs(await logger.readLogs()); }}
>
<Text style={{ color: '#fff', fontWeight: 'bold' }}>Leeren</Text>
+6 -1
View File
@@ -72,7 +72,12 @@ export default function PreviewScreen({
const [showStickerTray, setShowStickerTray] = useState<boolean>(false);
React.useEffect(() => {
logger.log(`PreviewScreen mounted with ${photoUris.length} photos. currentPhoto: ${photoUris[photoUris.length - 1]}`);
logger.log(`PreviewScreen mounted with ${photoUris.length} photos.`);
if (photoUris.length > 0) {
logger.log(`PreviewScreen currentPhoto: ${photoUris[photoUris.length - 1]}`);
} else {
logger.log(`[WARNING] PreviewScreen mounted but photoUris is empty!`);
}
return () => {
logger.log('PreviewScreen unmounting.');
};