Expo Router with authentication and nesting a stack within a drawer navigation

257 views Asked by At

I am using Expo Router and what I'm trying to do is to have 2 "sets" of navigation...

  1. User NOT logged in - this is a simple stack navigation a main screen and 2 buttons that point to 2 other screens
  2. User logged in - ideally, this is a drawer with several views (home, about, settings) and each of these views is a stack containing several views.

Here's a diagram to help visualize what I'm trying to do:

enter image description here

I think it would look similar to this, but I haven't got anything to work correctly

/app/
     _layout (stack)
     index.tsx (if logged in redirect to /(app)/index.tsx, else redirect to /(auth)/sign-in-sign-out.tsx)
     (app)/
           _layout (drawer)
           index.tsx
           about.tsx
           settings.tsx
           home/
                _layout (stack)
                view1.tsx
                view2.tsx
           about/
                _layout (stack)
                view1.tsx
                view2.tsx       
           settings/
                _layout (stack)
                view1.tsx
                view2.tsx
     (auth)/
            _layout (stack)
            sign-in-sign-out.tsx - buttons that link to sign-in and sign-out
            sign-in.tsx
            sign-out.tsx

All views within (app) should have the drawer visible and the drawer should only show the 3 top-level views.

Any ideas how I can make this work?

0

There are 0 answers