I am learning and newbie Expo Router and trying to implement the Tabs but i am getting following error.
Project Directory
app/
(tabs)/
users/
[id].jsx
_layout.jsx
index.jsx
index.jsx
What is the solution of this error. ?
_layout
under (tabs)
import React from "react"
import {Tabs} from "expo-router"
const TabLayout = ({params}) => {
return (
<Tabs>
<Tabs.Screen name='/index' options={{headerTitle: "Home"}} />
<Tabs.Screen name='/users/[id]' options={{headerTitle: "Users"}} />
</Tabs>
)
}
export default TabLayout
I have tried updating codebase but i doesn't work. I should not get error.
Thanks
I have a found a solution by removing /
in _layout.jsx
from name worked for me.
Updated _layout.jsx
import React from "react" import {Tabs} from "expo-router"
const TabLayout = ({params}) => {
return (
<Tabs>
<Tabs.Screen name='index' options={{headerTitle: "Home"}} />
<Tabs.Screen name='users/[id]' options={{headerTitle: "Users"}} />
</Tabs>
)
}
export default TabLayout
Hope it will help someone.
Thank you