refactor(App, navigation): migrate to Expo Router and clean up navigation structure
All checks were successful
Frontend CI / build-and-push-web (push) Successful in 4m27s
Frontend CI / ota-android (push) Successful in 11m6s
Frontend CI / build-android-apk (push) Successful in 1h16m45s

- Updated App entry point to utilize Expo Router, simplifying the navigation setup.
- Removed legacy navigation components and services to streamline the codebase.
- Adjusted package.json to reflect the new entry point and updated dependencies for compatibility.
- Enhanced overall application structure by consolidating navigation logic and improving maintainability.
This commit is contained in:
lafay
2026-03-24 14:21:31 +08:00
parent b91e78c921
commit 2ddb9cadd8
111 changed files with 1829 additions and 3214 deletions

View File

@@ -22,25 +22,23 @@ import {
StatusBar,
} from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { useNavigation } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { useRouter } from 'expo-router';
import { MaterialCommunityIcons } from '@expo/vector-icons';
import { LinearGradient } from 'expo-linear-gradient';
import { colors, spacing, borderRadius, shadows, fontSizes } from '../../theme';
import { authService, resolveAuthApiError } from '../../services/authService';
import { useAuthStore } from '../../stores';
import { RootStackParamList } from '../../navigation/types';
import * as hrefs from '../../navigation/hrefs';
import { useResponsive, useResponsiveValue } from '../../hooks';
import { showPrompt } from '../../services/promptService';
type RegisterNavigationProp = NativeStackNavigationProp<RootStackParamList, 'Auth'>;
// 分栏布局断点
const SPLIT_BREAKPOINT = 768;
export const RegisterScreen: React.FC = () => {
const navigation = useNavigation<RegisterNavigationProp>();
const router = useRouter();
const register = useAuthStore((state) => state.register);
const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
// 响应式布局
const { isLandscape, width } = useResponsive();
@@ -48,6 +46,12 @@ export const RegisterScreen: React.FC = () => {
// 是否使用分栏布局
const isSplitLayout = width >= SPLIT_BREAKPOINT;
useEffect(() => {
if (isAuthenticated) {
router.replace(hrefs.hrefHome());
}
}, [isAuthenticated, router]);
const [username, setUsername] = useState('');
const [nickname, setNickname] = useState('');
const [email, setEmail] = useState('');
@@ -238,7 +242,7 @@ export const RegisterScreen: React.FC = () => {
// 跳转到登录页
const handleGoToLogin = () => {
navigation.navigate('Login' as any);
router.push(hrefs.hrefAuthLogin());
};
// 渲染左侧面板Logo和品牌信息- 优化大屏布局