router
router copied to clipboard
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