feat: 更新标签页和新增统计页面
- 修改标签页的名称和图标,将“探索”改为“统计”,并更新相关逻辑 - 新增统计页面,展示用户健康数据和历史记录 - 优化首页布局,调整组件显示,提升用户体验 - 删除不再使用的代码,简化项目结构
This commit is contained in:
@@ -19,7 +19,7 @@ export default function TabLayout() {
|
||||
const routeName = route.name;
|
||||
const isSelected = (routeName === 'index' && pathname === '/') ||
|
||||
(routeName === 'coach' && pathname === '/coach') ||
|
||||
(routeName === 'explore' && pathname === '/explore') ||
|
||||
(routeName === 'statistics' && pathname === '/statistics') ||
|
||||
pathname.includes(routeName);
|
||||
|
||||
return {
|
||||
@@ -42,8 +42,8 @@ export default function TabLayout() {
|
||||
return { icon: 'house.fill', title: '首页' } as const;
|
||||
case 'coach':
|
||||
return { icon: 'person.3.fill', title: 'Bot' } as const;
|
||||
case 'explore':
|
||||
return { icon: 'paperplane.fill', title: '探索' } as const;
|
||||
case 'statistics':
|
||||
return { icon: 'chart.pie.fill', title: '统计' } as const;
|
||||
case 'personal':
|
||||
return { icon: 'person.fill', title: '个人' } as const;
|
||||
default:
|
||||
@@ -125,34 +125,7 @@ export default function TabLayout() {
|
||||
tabBarShowLabel: false,
|
||||
};
|
||||
}}>
|
||||
<Tabs.Screen
|
||||
name="index"
|
||||
options={{
|
||||
title: '首页',
|
||||
tabBarIcon: ({ color }) => {
|
||||
const isHomeSelected = pathname === '/' || pathname === '/index';
|
||||
return (
|
||||
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
||||
<IconSymbol size={22} name="house.fill" color={color} />
|
||||
{isHomeSelected && (
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
style={{
|
||||
color: color,
|
||||
fontSize: 12,
|
||||
fontWeight: '600',
|
||||
marginLeft: 6,
|
||||
textAlign: 'center',
|
||||
flexShrink: 0,
|
||||
}}>
|
||||
首页
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
<Tabs.Screen
|
||||
name="coach"
|
||||
options={{
|
||||
@@ -182,15 +155,15 @@ export default function TabLayout() {
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="explore"
|
||||
name="index"
|
||||
options={{
|
||||
title: '探索',
|
||||
title: '首页',
|
||||
tabBarIcon: ({ color }) => {
|
||||
const isExploreSelected = pathname === '/explore';
|
||||
const isHomeSelected = pathname === '/' || pathname === '/index';
|
||||
return (
|
||||
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
||||
<IconSymbol size={22} name="paperplane.fill" color={color} />
|
||||
{isExploreSelected && (
|
||||
<IconSymbol size={22} name="house.fill" color={color} />
|
||||
{isHomeSelected && (
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
style={{
|
||||
@@ -201,7 +174,35 @@ export default function TabLayout() {
|
||||
textAlign: 'center',
|
||||
flexShrink: 0,
|
||||
}}>
|
||||
探索
|
||||
首页
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="statistics"
|
||||
options={{
|
||||
title: '统计',
|
||||
tabBarIcon: ({ color }) => {
|
||||
const isStatisticsSelected = pathname === '/statistics';
|
||||
return (
|
||||
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
||||
<IconSymbol size={22} name="chart.pie.fill" color={color} />
|
||||
{isStatisticsSelected && (
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
style={{
|
||||
color: color,
|
||||
fontSize: 12,
|
||||
fontWeight: '600',
|
||||
marginLeft: 6,
|
||||
textAlign: 'center',
|
||||
flexShrink: 0,
|
||||
}}>
|
||||
统计
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user