Files
JKVideo/app/_layout.tsx
Developer 8f733b6c34 feat: 深色模式完善 + UP主主页 + 缓存管理
- 深色模式:补全 settings 页选项按钮、退出登录按钮主题色
- UP主主页:新增 /creator/[mid] 路由,展示 UP 主信息、粉丝数、视频列表
  - bilibili.ts 新增 getUploaderInfo / getUploaderVideos API
  - 视频详情页 UP 主行可点击跳转主页
- 缓存管理:settings 页新增「存储」分区,显示缓存大小并支持一键清除
  - 新增 utils/cache.ts(计算大小 + 清除 expo-image/文件系统缓存)
2026-03-26 01:16:20 +08:00

106 lines
3.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Text, View } from 'react-native';
import { useEffect } from 'react';
import { useAuthStore } from '../store/authStore';
import { useDownloadStore } from '../store/downloadStore';
import { useSettingsStore } from '../store/settingsStore';
import { useTheme } from '../utils/theme';
import { MiniPlayer } from '../components/MiniPlayer';
import { LiveMiniPlayer } from '../components/LiveMiniPlayer';
import * as Sentry from '@sentry/react-native';
import { ErrorBoundary } from '@sentry/react-native';
import { useFonts } from 'expo-font';
import { Ionicons } from '@expo/vector-icons';
Sentry.init({
dsn: process.env.EXPO_PUBLIC_SENTRY_DSN ?? '',
enabled: !__DEV__,
tracesSampleRate: 0.05,
environment: process.env.EXPO_PUBLIC_APP_ENV ?? 'production',
});
function RootLayout() {
const restore = useAuthStore(s => s.restore);
const loadDownloads = useDownloadStore(s => s.loadFromStorage);
const restoreSettings = useSettingsStore(s => s.restore);
const darkMode = useSettingsStore(s => s.darkMode);
const [fontsLoaded] = useFonts({
...Ionicons.font,
});
useEffect(() => {
restore();
loadDownloads();
restoreSettings();
}, []);
if (!fontsLoaded) return null;
return (
<SafeAreaProvider>
<StatusBar style={darkMode ? 'light' : 'dark'} />
<View style={{ flex: 1 }}>
<ErrorBoundary fallback={<Text style={{ padding: 32, textAlign: 'center' }}> App</Text>}>
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" />
<Stack.Screen
name="video"
options={{
animation: "slide_from_right",
gestureEnabled: true,
gestureDirection: "horizontal",
}}
/>
<Stack.Screen
name="live"
options={{
animation: "slide_from_right",
gestureEnabled: true,
gestureDirection: "horizontal",
}}
/>
<Stack.Screen
name="search"
options={{
animation: "slide_from_right",
gestureEnabled: true,
}}
/>
<Stack.Screen
name="downloads"
options={{
animation: "slide_from_right",
gestureEnabled: true,
gestureDirection: "horizontal",
}}
/>
<Stack.Screen
name="settings"
options={{
animation: "slide_from_right",
gestureEnabled: true,
gestureDirection: "horizontal",
}}
/>
<Stack.Screen
name="creator"
options={{
animation: "slide_from_right",
gestureEnabled: true,
gestureDirection: "horizontal",
}}
/>
</Stack>
</ErrorBoundary>
<MiniPlayer />
<LiveMiniPlayer />
</View>
</SafeAreaProvider>
);
}
export default Sentry.wrap(RootLayout);