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

@@ -19,8 +19,7 @@ import {
Dimensions,
} from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { useNavigation, useRoute, RouteProp } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { useLocalSearchParams } from 'expo-router';
import { MaterialCommunityIcons } from '@expo/vector-icons';
import { colors, spacing, fontSizes, borderRadius } from '../../theme';
import { useAuthStore } from '../../stores';
@@ -38,8 +37,7 @@ import {
GroupMemberResponse,
GroupRole,
} from '../../types/dto';
import { RootStackParamList } from '../../navigation/types';
import { firstRouteParam } from '../../navigation/paramUtils';
const { width: SCREEN_WIDTH } = Dimensions.get('window');
const GROUP_MEMBER_REMOTE_LIST_KIND: GroupMemberListSourceKind = 'cursor';
@@ -50,9 +48,6 @@ const GRID_CONFIG = {
desktop: { columns: 3, itemWidth: '31%' },
};
type NavigationProp = NativeStackNavigationProp<RootStackParamList>;
type GroupMembersRouteProp = RouteProp<RootStackParamList, 'GroupMembers'>;
// 成员分组
interface MemberGroup {
title: string;
@@ -60,9 +55,8 @@ interface MemberGroup {
}
const GroupMembersScreen: React.FC = () => {
const navigation = useNavigation<NavigationProp>();
const route = useRoute<GroupMembersRouteProp>();
const { groupId } = route.params;
const { groupId: groupIdParam } = useLocalSearchParams<{ groupId?: string | string[] }>();
const groupId = firstRouteParam(groupIdParam) ?? '';
const { currentUser } = useAuthStore();
// 响应式布局
@@ -155,8 +149,9 @@ const GroupMembersScreen: React.FC = () => {
// 初始加载
useEffect(() => {
if (!groupId) return;
refresh();
}, [groupId]);
}, [groupId, refresh]);
// 按角色分组
const groupMembers = useCallback((): MemberGroup[] => {