Replies: 6 comments 11 replies
-
Could please elaborate on what you're trying to build and perhaps include some info on how you'd obtain this same behavior with React Navigation. There are a number of issues with the repro:
The following modifications work for me:
I have some naive example in import { Tabs } from "expo-router";
import React from "react";
export default function Layout({ segment }) {
let children = [
<Tabs.Screen
name="agenda"
options={{
title: "agenda",
}}
/>,
<Tabs.Screen
name="help"
options={{
title: "help",
}}
/>,
];
if (segment === "(one)") {
children = children.reverse();
}
return (
<Tabs>
<Tabs.Screen
name="index"
options={{
href: null,
}}
/>
{children}
</Tabs>
);
} Clone syntax |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help (and this library!) In the end I was able to create the drawer I want with a custom drawer component in a app/_layout, and all the tabs in a subdirectory: function CustomDrawerContent(props) {
return (
<DrawerContentScrollView {...props}>
<DrawerItem label="Website" onPress={() => Linking.openURL('https://www.expo.dev/')} />
<Link href={'/alpha'} onPress={() => props.navigation.closeDrawer()}>Alpha</Link>
<Link href={'/beta'} onPress={() => props.navigation.closeDrawer()}>Beta</Link>
<Link href={'/charlie'} onPress={() => props.navigation.closeDrawer()}>Charlie</Link>
</DrawerContentScrollView>
);
}
export default function Layout() {
return (
<Drawer drawerContent={(props) => <CustomDrawerContent {...props} />}>
{/* All other screens should be hidden */}
</Drawer>
);
}; (I have pushed the code for this). Thanks again! |
Beta Was this translation helpful? Give feedback.
-
Hi, how do i change the order of the list in drawer? right now i have i want the settings to be the last |
Beta Was this translation helpful? Give feedback.
-
@EvanBacon @jonsamp Hi. I have scenario which I was able to create it with React Navigation. But have no idea how to do that here. If the user is not authenticated, they shall see the login page. There they should be able to navigate to SignUp page too. Now here in the main page, I need to have some tabs which they have to be present in all pages. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
@Jeroen-G What you have done is close to what I need. Just need to show the drawer conditionally. And also the tabs be present in all pages. Even when you click on the links in drawer. |
Beta Was this translation helpful? Give feedback.
-
m working on an app of two parts, client and store each part has its own layout . client has drawer and store has tabs |
Beta Was this translation helpful? Give feedback.
-
Summary
I would like to create an app that has a tab bar with a few buttons and a drawer that has other links (and at least one of the links goes to the same page as a tab button). Since both navigations need to be present at all times I think I need to nest navigators (although which one goes in which is still a mystery to me).
I tried nesting navigators and using shared routes and I tried to understand this thread from the RFC. But the proposed solution of shared routes does not seem to work for me.
Minimal reproducible example
Attempt with nesting: https://github.com/Jeroen-G/expo-router-repro
(see this commit for where I try to link to another page in another stack)
Attempt with shared routes: https://github.com/Jeroen-G/expo-router-repro/tree/shared-routes
Beta Was this translation helpful? Give feedback.
All reactions