diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx index 2f5e889..324e9f3 100644 --- a/app/(tabs)/_layout.tsx +++ b/app/(tabs)/_layout.tsx @@ -1,4 +1,5 @@ import { HapticTab } from '@/components/HapticTab'; +import { TabBarIcon } from '@/components/navigation/TabBarIcon'; import TabBarBackground from '@/components/ui/TabBarBackground'; import { Colors } from '@/constants/Colors'; import { useColorScheme } from '@/hooks/useColorScheme'; @@ -279,6 +280,19 @@ export default function TabLayout() { tabBarStyle: { display: 'none' } // 确保在标签栏中不显示 }} /> - + + {/* Debug Screen - only in development */} + {process.env.NODE_ENV === 'development' && ( + ( + + ), + }} + /> + )} + ); } diff --git a/app/(tabs)/debug.tsx b/app/(tabs)/debug.tsx new file mode 100644 index 0000000..315ce75 --- /dev/null +++ b/app/(tabs)/debug.tsx @@ -0,0 +1,132 @@ +import React, { useState } from 'react'; +import { View, TextInput, Button, Text, StyleSheet, ScrollView, SafeAreaView, ActivityIndicator, KeyboardAvoidingView, Platform } from 'react-native'; +import { executeSql } from '@/lib/db'; +import { ThemedView } from '@/components/ThemedView'; +import { ThemedText } from '@/components/ThemedText'; + +const DebugScreen = () => { + const [sql, setSql] = useState('SELECT * FROM upload_tasks;'); + const [results, setResults] = useState(null); + const [loading, setLoading] = useState(false); + + const handleExecuteSql = async (query: string) => { + if (!query) return; + setLoading(true); + setResults(null); + try { + const result = await executeSql(query); + setResults(result); + } catch (error) { + setResults({ error: (error as Error).message }); + } finally { + setLoading(false); + } + }; + + const presetQueries = [ + { title: 'All Uploads', query: 'SELECT * FROM upload_tasks;' }, + { title: 'Delete All Uploads', query: 'DELETE FROM upload_tasks;' }, + { title: 'Show Tables', query: "SELECT name FROM sqlite_master WHERE type='table';" }, + ]; + + return ( + + + + SQL Debugger + + +