Upgrade log view UI with share button and auto-scroll
This commit is contained in:
@@ -491,19 +491,38 @@ export default function AdminScreen({ currentSettings, onSave, onClose }: AdminS
|
|||||||
<Modal visible={logs !== null} transparent animationType="slide">
|
<Modal visible={logs !== null} transparent animationType="slide">
|
||||||
<View style={{ flex: 1, backgroundColor: 'rgba(0,0,0,0.8)', justifyContent: 'center', alignItems: 'center' }}>
|
<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 }}>
|
<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>
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 10 }}>
|
||||||
<ScrollView style={{ flex: 1, backgroundColor: '#000', padding: 10, borderRadius: 5 }}>
|
<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>
|
<Text style={{ color: '#0f0', fontFamily: 'monospace' }}>{logs}</Text>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginTop: 15 }}>
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginTop: 15 }}>
|
||||||
<TouchableOpacity
|
<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)}
|
onPress={() => setLogs(null)}
|
||||||
>
|
>
|
||||||
<Text style={{ color: '#fff', fontWeight: 'bold' }}>Schließen</Text>
|
<Text style={{ color: '#fff', fontWeight: 'bold' }}>Schließen</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<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()); }}
|
onPress={async () => { await logger.clearLogs(); setLogs(await logger.readLogs()); }}
|
||||||
>
|
>
|
||||||
<Text style={{ color: '#fff', fontWeight: 'bold' }}>Leeren</Text>
|
<Text style={{ color: '#fff', fontWeight: 'bold' }}>Leeren</Text>
|
||||||
|
|||||||
@@ -72,7 +72,12 @@ export default function PreviewScreen({
|
|||||||
const [showStickerTray, setShowStickerTray] = useState<boolean>(false);
|
const [showStickerTray, setShowStickerTray] = useState<boolean>(false);
|
||||||
|
|
||||||
React.useEffect(() => {
|
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 () => {
|
return () => {
|
||||||
logger.log('PreviewScreen unmounting.');
|
logger.log('PreviewScreen unmounting.');
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user