
Expo Router
Apply Expo Router file-based routing, Stack defaults, per-screen options, and native tab patterns without misconfiguring auto-discovered routes.
Install
npx skills add https://github.com/jchaselubitz/drill-app --skill expo-routerWhat is this skill?
- Root Stack uses screenOptions defaults; routes auto-discover from file structure—do not enumerate every screen in root l
- Per-screen <Stack.Screen> options inside route components for titles, headers, and back labels
- Dynamic route patterns such as app/lesson/[id].tsx with localized header configuration
- Native tabs and file-based routing best practices for Expo Router
- Allowed tools: Read, Edit, Write, Grep, Glob for navigation refactors
Adoption & trust: 1 installs on skills.sh; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Vercel React Native Skillsvercel-labs/agent-skills
Firebase Basicsfirebase/agent-skills
Building Native Uiexpo/skills
Firebase Ai Logic Basicsfirebase/agent-skills
Native Data Fetchingexpo/skills
Firebase Firestorefirebase/agent-skills
Journey fit
Common Questions / FAQ
Is Expo Router safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Expo Router
slug: expo-router name: expo-router description: Patterns for Expo Router including Stack configuration, native tabs, and file-based routing best practices. Apply when working with navigation, routing, or screen configuration. tags: [] compat: [] sha256: 202b315c374ae6e07427c443e1c698459ede0a79ca2596d5551ee7d21854d0fe --- name: expo-router description: Patterns for Expo Router including Stack configuration, native tabs, and file-based routing best practices. Apply when working with navigation, routing, or screen configuration. allowed-tools: Read, Edit, Write, Grep, Glob --- # Expo Router Patterns ## Stack Navigator Configuration ### Root Layout Setup Use `screenOptions` on the Stack component to set defaults for all screens. Do NOT explicitly list every screen - routes are auto-discovered from the file structure. ```tsx // app/_layout.tsx import { Stack } from 'expo-router'; export default function RootLayout() { return ( <Stack screenOptions={{ headerShown: false }} /> ); } ``` ### Per-Screen Configuration Individual screens configure their own options using `<Stack.Screen>` within the component file: ```tsx // app/lesson/[id].tsx import { Stack } from 'expo-router'; export default function LessonScreen() { return ( <View> <Stack.Screen options={{ title: 'Lesson', headerShown: true, headerBackTitle: 'Back', }} /> {/* Screen content */} </View> ); } ``` ### Dynamic Header Configuration Use `useNavigation` with `setOptions` for dynamic header content like buttons: ```tsx import { useNavigation } from 'expo-router'; import { useLayoutEffect } from 'react'; export default function Screen() { const navigation = useNavigation(); useLayoutEffect(() => { navigation.setOptions({ headerRight: () => ( <Pressable onPress={handlePress}> <Ionicons name="add" size={28} /> </Pressable> ), }); }, [navigation]); return <View>{/* content */}</View>; } ``` ## Native Tabs (`expo-router/unstable-native-tabs`) Native tabs provide platform-native tab bar with SF Symbols on iOS: ```tsx // app/(tabs)/_layout.tsx import { Icon, Label, NativeTabs } from 'expo-router/unstable-native-tabs'; export default function TabLayout() { return ( <NativeTabs> <NativeTabs.Trigger name="index" options={{ title: 'Home' }}> <Icon sf="house.fill" drawable="custom_android_drawable" /> <Label>Home</Label> </NativeTabs.Trigger> </NativeTabs> ); } ``` ## Key Principles 1. **File-based routing**: Routes are auto-discovered from the `app/` directory structure 2. **Minimal configuration**: Only configure what you need to override 3. **Screen-level options**: Screens configure their own headers/options using `<Stack.Screen>` within the component 4. **Layout files**: `_layout.tsx` files define navigation structure for their directory 5. **Route groups**: Parentheses like `(tabs)` create route groups without affecting the URL path ## Common Mistakes to Avoid - Don't list every screen explicitly in Stack - they're auto-discovered - Don't use `screenOptions` for route-specific settings - use `<Stack.Screen>` in the route file - Don't nest navigators deeply - use file-based routing for cleaner structure