/** * Tab 导航器 * 处理底部标签导航(移动端) */ import React from 'react'; import { View } from 'react-native'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { MaterialCommunityIcons } from '@expo/vector-icons'; import type { MainTabParamList } from './types'; import { colors, shadows } from '../theme'; import { HomeNavigator } from './HomeNavigator'; import { MessageNavigator } from './MessageNavigator'; import { ScheduleNavigator } from './ScheduleNavigator'; import { ProfileNavigator } from './ProfileNavigator'; const Tab = createBottomTabNavigator(); // 常量 const MOBILE_TAB_FLOATING_MARGIN = 12; interface TabNavigatorProps { unreadCount: number; } export function TabNavigator({ unreadCount }: TabNavigatorProps) { const insets = useSafeAreaInsets(); return ( ( ), }} /> 0 ? (unreadCount > 99 ? '99+' : unreadCount) : undefined, tabBarIcon: ({ color, size, focused }) => ( ), }} /> ( ), }} /> ( ), }} /> ); } import { StyleSheet } from 'react-native'; const styles = StyleSheet.create({ tabIconContainer: { alignItems: 'center', justifyContent: 'center', width: 38, height: 30, borderRadius: 15, }, tabIconActive: { backgroundColor: `${colors.primary.main}20`, transform: [{ translateY: -1 }], }, });