Routing
File-based routing powered by Expo Router.
File-Based Routing
Files in the app directory automatically become routes in your application. This project uses Expo Router, which brings the best routing concepts from the web to native apps.
For complete documentation, check out the Expo Router docs.
File Structure
- app/index.tsx → /
- app/profile.tsx → /profile
- app/user/[id].tsx → /user/123
- app/(tabs)/_layout.tsx → Layout for tabs
Dynamic Routes
Create dynamic routes by wrapping the filename in square brackets. The segment name becomes a parameter accessible in the page component.
1// app/user/[id].tsx2import { useLocalSearchParams } from 'expo-router';3import { View, Text } from 'react-native';45export default function User() {6 const { id } = useLocalSearchParams();78 return (9 <View>10 <Text>User ID: {id}</Text>11 </View>12 );13}
Layouts & Groups
Layouts (_layout.tsx) allow you to share UI (like headers or tab bars) across multiple routes.Groups (folders with parentheses, e.g., (tabs)) allow you to organize routes without affecting the URL path.
1// app/_layout.tsx2import { Stack } from 'expo-router';34export default function RootLayout() {5 return (6 <Stack>7 <Stack.Screen name="(tabs)" options={{ headerShown: false }} />8 <Stack.Screen name="modal" options={{ presentation: 'modal' }} />9 </Stack>10 );11}
Navigation
Use the Link component or router object to navigate between screens.
1import { Link, router } from 'expo-router';23export function Home() {4 return (5 <View>6 <Link href="/profile" asChild>7 <Button>Go to Profile</Button>8 </Link>910 <Button onPress={() => router.push('/settings')}>11 Settings12 </Button>13 </View>14 );15}
Deep Linking
Deep linking allows users to open your app from a URL. This project is pre-configured to handle deep links using Expo Router.
Configuration
The URL scheme is defined in your environment configuration. By default, it is set to reactnativestarter.
To change it, update the APP_SCHEME variable in your .env file:
1APP_SCHEME=my-cool-app
This is loaded in app.config.ts and passed to the Expo config.
Testing Deep Links
You can test deep links using the CLI or simulator commands.
Using uri-scheme CLI
1# Install the CLI if you haven't2npm install -g uri-scheme34# Test on iOS Simulator5npx uri-scheme open "reactnativestarter://profile" --ios67# Test on Android Emulator8npx uri-scheme open "reactnativestarter://profile" --android
Native Commands
1# iOS (xcrun)2xcrun simctl openurl booted "reactnativestarter://profile"34# Android (adb)5adb shell am start -W -a android.intent.action.VIEW -d "reactnativestarter://profile" com.development.reactnativestarter
Note: The Android package name might differ based on your build profile (e.g., com.development.reactnativestarter).
Universal Links & App Links
For standard web URLs (like https://myapp.com/profile) to open your app, you need to configure Universal Links (iOS) and App Links (Android).
- iOS: Requires an Associated Domains entitlement and an
apple-app-site-associationfile on your website. - Android: Requires
assetlinks.jsonverification.
Refer to the Expo Deep Linking Guide for full setup instructions.
Last updated on 2/10/2026
Edit this page on GitHub