我在 expo 路由器项目中有以下文件夹结构:
我收到以下错误:
Found screens with the same name nested inside one another. Check:
(tabs) > index, (tabs) > index > index
发生这种情况是因为我希望我的默认(索引)视图具有堆栈布局,该布局嵌套在选项卡布局内。当我的
index.tsx
视图只是一个文件而不是现在的 index/
文件夹时,一切都进展顺利。
在我看来,expo-router 团队似乎没有考虑这种命名冲突边缘情况,但我不确定。
有人知道如何在默认(索引)视图中嵌套导航器吗?
我也有同样的警告。 如果您将
index
文件夹重命名为 (index)
,它会修复警告。
然后将您的 _layout.tsx
的 (tabs)
中的路线名称更改为 name="(index)"
。