Unable to render drawer page
Which package manager are you using? (Yarn is recommended)
npm
Summary
I am unable to get drawer navigation to work with expo router.
The action 'REPLACE' with payload {"name":"dashboard"} was not handled by any navigator.
Do you have a screen named 'dashboard'?
This happens with the following strucutre
_layout.tsx
import { Drawer } from 'expo-router/drawer'
import { NavigationBar } from './components'
export const unstable_settings = {
// Ensure any route can link back to `/`
initialRouteName: 'index',
}
export default function Layout() {
return (
<Drawer
screenOptions={{
header: NavigationBar,
drawerStyle: {
width: 240,
},
drawerType: 'permanent',
}}
/>
)
}
dashboard.tsx
import React from 'react'
import { View } from 'react-native'
export default function Dashboard(){
return (
<View />
)
}
index.tsx
import { Redirect } from 'expo-router'
import { ReactElement } from 'react'
export default function Prosumer(): ReactElement {
return <Redirect href="./prosumer/dashboard" />
}
Minimal reproducible example
See above
Okay i figured it out after reading this comment in another issue. It seems that push seems to be working but <Redirect /> uses replace internally and hence is not working. If I navigate directly to /dashboard (and not to the index file) using router.push it works. Gonna keep this issue open regardless because I think this is still something that should work.
I'm having this same issue. I have a stack inside a drawer and I want to default redirect my root drawer index route to the nested stack. I am returning a redirect and also tried router.redirect to the route and it doesn't actually change the route.