feat: 引入路由常量并更新相关页面导航
- 新增 ROUTES 常量文件,集中管理应用路由 - 更新多个页面的导航逻辑,使用 ROUTES 常量替代硬编码路径 - 修改教练页面和今日训练页面的路由,提升代码可维护性 - 优化标签页和登录页面的导航,确保一致性和易用性
This commit is contained in:
@@ -2,6 +2,7 @@ import dayjs from 'dayjs';
|
||||
import { useRouter } from 'expo-router';
|
||||
import React from 'react';
|
||||
import { Image, Pressable, StyleSheet, Text, View } from 'react-native';
|
||||
import { ROUTES } from '@/constants/Routes';
|
||||
|
||||
type Props = {
|
||||
id: string;
|
||||
@@ -14,7 +15,7 @@ type Props = {
|
||||
export function ArticleCard({ id, title, coverImage, publishedAt, readCount }: Props) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<Pressable onPress={() => router.push(`/article/${id}`)} style={styles.card}>
|
||||
<Pressable onPress={() => router.push(`${ROUTES.ARTICLE}/${id}`)} style={styles.card}>
|
||||
<Image source={{ uri: coverImage }} style={styles.cover} />
|
||||
<View style={styles.meta}>
|
||||
<Text style={styles.title} numberOfLines={2}>{title}</Text>
|
||||
|
||||
Reference in New Issue
Block a user