- 新增训练计划页面,允许用户制定个性化的训练计划 - 集成打卡功能,用户可以记录每日的训练情况 - 更新 Redux 状态管理,添加训练计划相关的 reducer - 在首页中添加训练计划卡片,支持用户点击跳转 - 更新样式和布局,以适应新功能的展示和交互 - 添加日期选择器和相关依赖,支持用户选择训练日期
57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
|
|
import { useFonts } from 'expo-font';
|
|
import { Stack } from 'expo-router';
|
|
import { StatusBar } from 'expo-status-bar';
|
|
import 'react-native-reanimated';
|
|
|
|
import { useAppDispatch } from '@/hooks/redux';
|
|
import { useColorScheme } from '@/hooks/useColorScheme';
|
|
import { store } from '@/store';
|
|
import { rehydrateUser } from '@/store/userSlice';
|
|
import React from 'react';
|
|
import { Provider } from 'react-redux';
|
|
|
|
function Bootstrapper({ children }: { children: React.ReactNode }) {
|
|
const dispatch = useAppDispatch();
|
|
React.useEffect(() => {
|
|
dispatch(rehydrateUser());
|
|
}, [dispatch]);
|
|
return <>{children}</>;
|
|
}
|
|
|
|
export default function RootLayout() {
|
|
const colorScheme = useColorScheme();
|
|
const [loaded] = useFonts({
|
|
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
|
|
});
|
|
|
|
if (!loaded) {
|
|
// Async font loading only occurs in development.
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Provider store={store}>
|
|
<Bootstrapper>
|
|
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
|
|
<Stack screenOptions={{ headerShown: false }}>
|
|
<Stack.Screen name="onboarding" />
|
|
<Stack.Screen name="(tabs)" />
|
|
<Stack.Screen name="challenge" options={{ headerShown: false }} />
|
|
<Stack.Screen name="training-plan" options={{ headerShown: false }} />
|
|
<Stack.Screen name="profile/edit" />
|
|
<Stack.Screen name="profile/goals" options={{ headerShown: false }} />
|
|
<Stack.Screen name="ai-coach-chat" options={{ headerShown: false }} />
|
|
<Stack.Screen name="ai-posture-assessment" />
|
|
<Stack.Screen name="auth/login" options={{ headerShown: false }} />
|
|
<Stack.Screen name="legal/user-agreement" options={{ headerShown: true, title: '用户协议' }} />
|
|
<Stack.Screen name="legal/privacy-policy" options={{ headerShown: true, title: '隐私政策' }} />
|
|
<Stack.Screen name="+not-found" />
|
|
</Stack>
|
|
<StatusBar style="auto" />
|
|
</ThemeProvider>
|
|
</Bootstrapper>
|
|
</Provider>
|
|
);
|
|
}
|