expo 路由器索引内嵌套导航器的问题

问题描述 投票:0回答:1

我在 expo 路由器项目中有以下文件夹结构:

enter image description here

我收到以下错误:

Found screens with the same name nested inside one another. Check:
(tabs) > index, (tabs) > index > index

发生这种情况是因为我希望我的默认(索引)视图具有堆栈布局,该布局嵌套在选项卡布局内。当我的

index.tsx
视图只是一个文件而不是现在的
index/
文件夹时,一切都进展顺利。

在我看来,expo-router 团队似乎没有考虑这种命名冲突边缘情况,但我不确定。

有人知道如何在默认(索引)视图中嵌套导航器吗?

expo-router
1个回答
0
投票

我也有同样的警告。 如果您将

index
文件夹重命名为
(index)
,它会修复警告。 然后将您的
_layout.tsx
(tabs)
中的路线名称更改为
name="(index)"

© www.soinside.com 2019 - 2024. All rights reserved.