我有这样的布局。
app/
(auth)
_layout.tsx
index.tsx
sign-in.tsx
_layout.tsx
dashboard.tsx
index.tsx
当我获得身份验证令牌时,从 Sign-in.tsx 中调用 router.replace("/") ,这会将我导航到(身份验证)内的索引而不是根索引。那么如何从 (auth)/signin.tsx 中导航到根索引?
因此,鉴于上述结构,当我未进行身份验证时路由到根 index.tsx 时,我会调用 router.replace("/(auth)"),然后当我导航回根索引时,它将无法工作。使用 router.push("/(auth)") 确实有效,所以我的感觉是 expo router 只能访问历史记录中的路由。