diff --git a/src/components/business/TabBar.tsx b/src/components/business/TabBar.tsx index bcca877..d558ab0 100644 --- a/src/components/business/TabBar.tsx +++ b/src/components/business/TabBar.tsx @@ -9,6 +9,7 @@ import { View, TouchableOpacity, StyleSheet, ScrollView, Animated } from 'react- import { MaterialCommunityIcons } from '@expo/vector-icons'; import { colors, spacing, fontSizes, borderRadius } from '../../theme'; import Text from '../common/Text'; +import { useHover } from '../../hooks/useHover'; type TabBarVariant = 'default' | 'pill' | 'segmented' | 'modern'; @@ -22,6 +23,51 @@ interface TabBarProps { icons?: string[]; } +// Modern Tab 组件,支持悬停效果 +interface ModernTabProps { + tab: string; + index: number; + isActive: boolean; + icon?: string; + onPress: () => void; +} + +const ModernTab: React.FC = ({ tab, index, isActive, icon, onPress }) => { + const { isHovered, hoverProps } = useHover(); + + return ( + + + {icon && ( + + )} + + {tab} + + + {isActive && } + + ); +}; + const TabBar: React.FC = ({ tabs, activeIndex, @@ -38,31 +84,14 @@ const TabBar: React.FC = ({ if (variant === 'modern') { return ( - onTabChange(index)} - activeOpacity={0.85} - > - - {icon && ( - - )} - - {tab} - - - {isActive && } - + /> ); } @@ -317,7 +346,10 @@ const styles = StyleSheet.create({ position: 'relative', }, modernTabActive: { - backgroundColor: colors.primary.main + '15', // 10% opacity + backgroundColor: colors.primary.main + '20', // 12% opacity + }, + modernTabHovered: { + backgroundColor: colors.primary.main + '15', // 8% opacity }, modernTabContent: { flexDirection: 'row', diff --git a/src/navigation/DesktopNavigator.tsx b/src/navigation/DesktopNavigator.tsx index c4fbd37..9fa4bd4 100644 --- a/src/navigation/DesktopNavigator.tsx +++ b/src/navigation/DesktopNavigator.tsx @@ -241,10 +241,10 @@ const styles = StyleSheet.create({ borderRadius: 12, }, sidebarItemActive: { - backgroundColor: `${colors.primary.main}15`, + backgroundColor: `${colors.primary.main}20`, }, sidebarItemHovered: { - backgroundColor: `${colors.primary.main}08`, + backgroundColor: `${colors.primary.main}15`, }, sidebarItemCollapsed: { justifyContent: 'center',