Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to render drawer page #604

Open
xydian opened this issue May 23, 2023 · 1 comment
Open

Unable to render drawer page #604

xydian opened this issue May 23, 2023 · 1 comment

Comments

@xydian
Copy link

xydian commented May 23, 2023

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

@xydian
Copy link
Author

xydian commented May 23, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant