agentsclimarketplace

Expo router

Skill ComeOnOliver/skillshub/skills/TerminalSkills/skills/expo-router

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.From the repository description

Install
npx -y skills add ComeOnOliver/skillshub --skill expo-router

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

5.7 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it

Expo Router

Overview

Expo Router brings file-based routing to React Native β€” the same pattern as Next.js but for mobile apps. Drop a file in app/, get a screen. Folder structure defines navigation hierarchy: stacks, tabs, drawers, and modals. Deep linking works automatically β€” every route has a URL. Build iOS, Android, and web from one codebase with the same routing system.

When to Use

  • Building a React Native / Expo app that needs navigation
  • Want file-based routing instead of manual React Navigation config
  • Need deep linking and universal links without extra setup
  • Building a universal app (iOS + Android + Web)
  • Migrating from React Navigation to a simpler routing model

Instructions

Setup

npx create-expo-app@latest my-app --template tabs
cd my-app
npx expo start

File-Based Routes

app/
β”œβ”€β”€ _layout.tsx          # Root layout (wraps all screens)
β”œβ”€β”€ index.tsx            # / (home screen)
β”œβ”€β”€ about.tsx            # /about
β”œβ”€β”€ (tabs)/              # Tab navigation group
β”‚   β”œβ”€β”€ _layout.tsx      # Tab bar configuration
β”‚   β”œβ”€β”€ index.tsx        # First tab (home)
β”‚   β”œβ”€β”€ explore.tsx      # Second tab
β”‚   └── profile.tsx      # Third tab
β”œβ”€β”€ settings/
β”‚   β”œβ”€β”€ _layout.tsx      # Stack layout for settings
β”‚   β”œβ”€β”€ index.tsx        # /settings
β”‚   β”œβ”€β”€ account.tsx      # /settings/account
β”‚   └── notifications.tsx # /settings/notifications
β”œβ”€β”€ [id].tsx             # /123 (dynamic route)
β”œβ”€β”€ post/
β”‚   └── [slug].tsx       # /post/my-first-post
└── +not-found.tsx       # 404 screen

Root Layout

// app/_layout.tsx β€” Root layout with stack navigation
import { Stack } from "expo-router";

export default function RootLayout() {
  return (
    <Stack>
      <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
      <Stack.Screen name="settings" options={{ title: "Settings" }} />
      <Stack.Screen
        name="modal"
        options={{ presentation: "modal", title: "Info" }}
      />
    </Stack>
  );
}

Tab Navigation

// app/(tabs)/_layout.tsx β€” Bottom tab bar
import { Tabs } from "expo-router";
import { Ionicons } from "@expo/vector-icons";

export default function TabLayout() {
  return (
    <Tabs screenOptions={{ tabBarActiveTintColor: "#007AFF" }}>
      <Tabs.Screen
        name="index"
        options={{
          title: "Home",
          tabBarIcon: ({ color }) => <Ionicons name="home" size={24} color={color} />,
        }}
      />
      <Tabs.Screen
        name="explore"
        options={{
          title: "Explore",
          tabBarIcon: ({ color }) => <Ionicons name="compass" size={24} color={color} />,
        }}
      />
      <Tabs.Screen
        name="profile"
        options={{
          title: "Profile",
          tabBarIcon: ({ color }) => <Ionicons name="person" size={24} color={color} />,
        }}
      />
    </Tabs>
  );
}

Navigation and Dynamic Routes

// app/(tabs)/index.tsx β€” Home screen with navigation
import { Link, router } from "expo-router";
import { View, Text, Pressable, FlatList } from "react-native";

export default function HomeScreen() {
  const posts = usePosts();

  return (
    <View>
      {/* Declarative navigation */}
      <Link href="/about">About</Link>
      <Link href="/settings">Settings</Link>
      <Link href="/post/hello-world">My Post</Link>

      {/* Programmatic navigation */}
      <Pressable onPress={() => router.push("/settings/account")}>
        <Text>Go to Account</Text>
      </Pressable>

      {/* Dynamic routes */}
      <FlatList
        data={posts}
        renderItem={({ item }) => (
          <Link href={`/post/${item.slug}`}>
            <Text>{item.title}</Text>
          </Link>
        )}
      />
    </View>
  );
}
// app/post/[slug].tsx β€” Dynamic route screen
import { useLocalSearchParams } from "expo-router";

export default function PostScreen() {
  const { slug } = useLocalSearchParams<{ slug: string }>();
  const post = usePost(slug);

  return (
    <View>
      <Text style={{ fontSize: 24 }}>{post?.title}</Text>
      <Text>{post?.content}</Text>
    </View>
  );
}

Deep Linking (Automatic)

// app.json β€” Deep linking just works
{
  "expo": {
    "scheme": "myapp",
    "web": { "bundler": "metro" }
  }
}

Every route automatically gets a URL:

  • myapp:// β†’ Home screen
  • myapp://post/hello-world β†’ Post screen
  • https://myapp.com/post/hello-world β†’ Same screen (universal links)

Examples

Example 1: Build a social media app navigation

User prompt: "Set up navigation for a social app β€” tabs for feed/search/profile, stack for post details, and modal for creating posts."

The agent will create tab layout, nested stack routes, and a modal route with proper animations and deep linking.

Example 2: Add authentication flow

User prompt: "Add login/signup screens that show before the main app tabs."

The agent will create a route group for auth screens, use layout redirection based on auth state, and protect tab routes.

Guidelines

  • File = route β€” app/about.tsx = /about screen
  • _layout.tsx for navigation containers β€” Stack, Tabs, Drawer
  • (group) for route groups β€” organize without affecting URL
  • [param] for dynamic routes β€” access via useLocalSearchParams
  • Deep linking is automatic β€” every route has a URL
  • Link for declarative, router for programmatic β€” navigation
  • +not-found.tsx for 404 β€” catches unmatched routes
  • Typed routes β€” href autocompletes with TypeScript
  • Web support β€” same routes work on web with expo-router
  • presentation: "modal" in options β€” for modal screens

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.