Navigation & Routing
Learn how to create screens and navigate between them using Expo Router's file-based system.
VibeFast uses Expo Router for all navigation. If you're familiar with web development frameworks like Next.js, the concepts will feel very familiar. The file system itself defines the routes of your application.
Overview of the app Directory
All your app's routes are defined by the files and folders inside the src/app/ directory.
_layout.tsx: Defines a shared layout for a group of screens. The root layout inapp/_layout.tsxis where all your global providers (like Convex and Theme providers) are set up.()Folders (e.g.,(tabs)): These are called "groups" and are used to organize routes without affecting the URL path. This is perfect for defining different navigation sections, like your main tab bar.[...missing].tsx: This is a catch-all route that handles any path that doesn't match another file, effectively serving as your "Not Found" page.
How-To: Create a New Screen
Creating a new page is as simple as creating a new file.
1. Create a New File
Create a new file inside the src/app/(routes)/ directory. The name of the file will become the URL path.
For example, creating src/app/(routes)/settings/notifications.tsx will create a new screen accessible at the /settings/notifications path.
2. Add Your Component
The file should export a default React component.
import { Text, View } from '@/components/ui';
import { Stack } from 'expo-router';
export default function NotificationsScreen() {
return (
<>
<Stack.Screen options={{ title: 'Notifications' }} />
<View className="flex-1 items-center justify-center">
<Text>Notification Settings</Text>
</View>
</>
);
}Configuring the Header
You can configure the screen's header directly within the component by using <Stack.Screen options={{...}} />.
How-To: Link Between Screens
To navigate between screens, use the <Link> component from expo-router.
import { Link } from 'expo-router';
import { Button } from '@/components/ui';
// To navigate to our new screen:
<Link href="/settings/notifications" asChild>
<Button label="Go to Notification Settings" />
</Link>The asChild prop is important—it allows you to use your own custom components (like VibeFast's <Button>) as the pressable navigation element.
Dynamic Routes
Expo Router also supports dynamic routes for creating pages with parameters (e.g., a user profile page).
- A file named
app/(routes)/profile/[id].tsxwill match any path like/profile/123or/profile/user-abc. - Inside the component, you can get the
idparameter using theuseLocalSearchParamshook from Expo Router.
Found an issue or bug in the docs?
Help me improve! If you spot any errors, typos, or have suggestions, please let me know.
Reach out on X/Twitter @zafarbuildzz