Communityコーディング&開発github.com

expo/expo-router

オープンソースのナビゲーションとルーティングフレームワーク。Expo Router のファイルベースルート、グループ、動的ルート、フォルダ構成、プレビュー付き Link、ネイティブ Stack、ページタイトル、モーダル、フォームシート、NativeTabs、ヘッダー、ツールバー、ヘッダー検索バーをカバーします。

expo-router とは?

このスキルは、Expo Router アプリケーションにおけるナビゲーションとルーティングの実装を支援するための包括的なガイドです。ファイルベースのルーティング、動的ルート、グループルート、フォルダ構成といった基本的な概念から、ネイティブな Stack ナビゲーション、モーダルやフォームシートの表示、NativeTabs の設定、ヘッダーやツールバーのカスタマイズ、検索バーの追加まで、幅広いトピックをカバーします。特に iOS プラットフォームの機能に重点を置いており、Link コンポーネントによるプレビューやコンテキストメニューの追加、iOS 18+ の Zoom トランジションなど、プラットフォームのネイティブ体験を最大限に活用する方法を提供します。このスキルは Expo Router を使用するすべての開発者にとって有益であり、コードスタイルのベストプラクティスや、SDK 56 以降での @react-navigation のインポートルールなど、プロジェクトの品質を高めるための具体的な指針も含まれています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/expo/skills/tree/main/plugins/expo/skills/expo-router

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Expo Router ナビゲーション

Expo Router アプリケーションのナビゲーションとルーティング。画面のスタイリング、色、コントロール、メディア、視覚効果については expo-native-ui スキルを、モーションとジェスチャーについては expo-animation スキルを参照してください。

参考文献

必要に応じて以下のリソースを参照してください。

references/
  route-structure.md     ルート規則、動的ルート、グループ、フォルダ構成
  tabs.md                NativeTabs、JS タブからの移行、iOS 26 の機能
  toolbar-and-headers.md Stack ヘッダーとツールバーボタン、メニュー、検索 (iOS のみ)
  form-sheet.md          expo-router でのフォームシート: 設定、フッター、背景のインタラクション
  search.md              ヘッダー付き検索バー、useSearch フック、フィルタリングパターン
  zoom-transitions.md    Apple Zoom: Link.AppleZoom を使用した流れるような Zoom トランジション (iOS 18+)

コードスタイル

  • ファイル名には常にケバブケースを使用します(例: comment-card.tsx)
  • ナビゲーションを移動または再構成する場合は、古いルートファイルを必ず削除します。
  • ファイル名に特殊文字を使用しないでください。
  • tsconfig.json でパスエイリアスを設定し、リファクタリング時には相対インポートよりもエイリアスを優先します。

ルート

詳細なルート規則については ./references/route-structure.md を参照してください。

  • ルートは app ディレクトリに配置します。
  • コンポーネント、型、ユーティリティを app ディレクトリに同居させないでください。これはアンチパターンです。
  • アプリには常に "/" にマッチするルートが存在することを確認してください。グループルート内にあっても構いません。

ライブラリの優先順位

  • ネイティブのセマンティックカラーには expo-router の Color を使用し、生の PlatformColor は使用しないでください(型安全で、ライト/ダークに自動適応します)。完全なカラーパレットパターンについては expo-native-ui を参照してください。
  • SDK 56 以降では、@react-navigation/* から直接インポートしないでください。代わりに expo-router/react-navigation を使用してください(@react-navigation/native、/core、/elements、/routers をカバーします)。

動作

  • 画面に検索バーを追加するには Stack.SearchBar を優先してください。

ナビゲーション

Link

ルート間のナビゲーションには expo-router から <Link href="/path" /> を使用します。

import { Link } from 'expo-router';

// 基本的なリンク
<Link href="/path" />

// カスタムコンポーネントのラップ
<Link href="/path" asChild>
  <Pressable>...</Pressable>
</Link>

可能な限り、iOS の慣例に従って <Link.Preview> を含めてください。ナビゲーションを強化するために、コンテキストメニューとプレビューを頻繁に追加してください。

Stack

  • Stack を定義するには、常に _layout.tsx ファイルを使用します。
  • ネイティブなナビゲーションスタックには、expo-router/stack の Stack を使用します。

ページタイトル

Stack.Title でページタイトルを設定します。

<Stack.Title>ホーム</Stack.Title>

コンテキストメニュー

Link コンポーネントに長押しコンテキストメニューを追加します。

import { Link } from "expo-router";

<Link href="/settings" asChild>
  <Link.Trigger>
    <Pressable>
      <Card />
    </Pressable>
  </Link.Trigger>
  <Link.Menu>
    <Link.MenuAction
      title="共有"
      icon="square.and.arrow.up"
      onPress={handleSharePress}
    />
    <Link.MenuAction
      title="ブロック"
      icon="nosign"
      destructive
      onPress={handleBlockPress}
    />
    <Link.Menu title="その他" icon="ellipsis">
      <Link.MenuAction title="コピー" icon="doc.on.doc" onPress={() => {}} />
      <Link.MenuAction
        title="削除"
        icon="trash"
        destructive
        onPress={() => {}}
      />
    </Link.Menu>
  </Link.Menu>
</Link>;

Link プレビュー

ナビゲーションを強化するために、リンクプレビューを頻繁に使用します。

<Link href="/settings">
  <Link.Trigger>
    <Pressable>
      <Card />
    </Pressable>
  </Link.Trigger>
  <Link.Preview />
</Link>

Link プレビューはコンテキストメニューと組み合わせて使用できます。

モーダル

画面をモーダルとして表示します。

<Stack.Screen name="modal" options={{ presentation: "modal" }} />

カスタムモーダルコンポーネントを構築するよりも、こちらを優先してください。

シート

画面を動的なフォームシートとして表示します。

<Stack.Screen
  name="sheet"
  options={{
    presentation: "formSheet",
    sheetGrabberVisible: true,
    sheetAllowedDetents: [0.5, 1.0],
    contentStyle: { backgroundColor: "transparent" },
  }}
/>
  • contentStyle: { backgroundColor: "transparent" } を使用すると、iOS 26 以降で背景がリキッドガラスになります。

一般的なルート構成

各タブ内にタブとスタックを持つ標準的なアプリレイアウト:

app/
  _layout.tsx — <NativeTabs />
  (index,search)/
    _layout.tsx — <Stack />
    index.tsx — メインリスト
    search.tsx — 検索ビュー
// app/_layout.tsx
import { NativeTabs } from "expo-router/unstable-native-tabs";
import { ThemeProvider, DarkTheme, DefaultTheme } from "expo-router/react-navigation";
import { useColorScheme } from "react-native";

export default function Layout() {
  const colorScheme = useColorScheme();
  return (
    <ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}>
      <NativeTabs>
        <NativeTabs.Trigger name="(index)">
          <NativeTabs.Trigger.Icon sf="list.dash" md="list" />
          <NativeTabs.Trigger.Label>アイテム</NativeTabs.Trigger.Label>
        </NativeTabs.Trigger>
        <NativeTabs.Trigger name="(search)" role="search" />
      </NativeTabs>
    </ThemeProvider>
  );
}

両方のタブが共通の画面をプッシュできるように、共有グループルートを作成します。

// app/(index,search)/_layout.tsx
import { Stack } from "expo-router/stack";
import { colors } from "@/theme/colors";

export default function Layout({ segment }) {
  const screen = segment.match(/\((.*)\)/)?.[1]!;
  const titles: Record<string, string> = { index: "アイテム", search: "検索" };

  return (
    <Stack
      screenOptions={{
        headerTransparent: true,
        headerShadowVisible: false,
        headerLargeTitleShadowVisible: false,
        headerLargeStyle: { backgroundColor: "transparent" },
        headerTitleStyle: { color: colors.label },
        headerLargeTitleEnabled: true,
        headerBlurEffect: "none",
        headerBackButtonDisplayMode: "minimal",
      }}
    >
      <Stack.Screen name={screen} options={{ title: titles[screen] }} />
      <Stack.Screen name="i/[id]" options={{ headerLargeTitleEnabled: false }} />
    </Stack>
  );
}

headerLargeTitleEnabled は SDK 56 以降のオプション名です。古い SDK では headerLargeTitle を使用しますが、これは上流で非推奨です。

フィードバックの送信

エラーや誤解を招く情報、またはこのスキル内の古い情報に遭遇した場合は、Expo が改善できるように報告してください。

npx --yes submit-expo-feedback@latest --category skills --subject "expo-router" "<アクション可能なフィードバック>"

具体的でアクション可能な報告がある場合にのみ送信してください。可能な限り多くの関連コンテキストを含めてください。 AI エージェントが繰り返し失敗した場合、またはユーザーが Expo タスクを引き継がなければならなかった場合は、代わりに expo-skill-feedback スキルを読み込み、その評価候補フローに従ってください。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

expo/add-app-clip

Add an iOS App Clip target to an Expo app. Use when the user mentions App Clip, AASA, apple-app-site-association, appclips, smart app banner, or wants to ship a lightweight iOS Clip invoked from a URL alongside their parent app.

expo/building-native-ui

Complete guide for building beautiful apps with Expo Router. Covers fundamentals, styling, components, navigation, animations, patterns, and native tabs.

expo/eas-update-insights

Check the health of published EAS Updates: crash rates, install/launch counts, unique users, payload size, and the split between embedded and OTA users per channel. Use when the user asks how an update is performing, whether a rollout is healthy, how many users are on the embedded build vs OTA, or wants to gate CI on update health.

expo/expo-api-routes

Guidelines for creating API routes in Expo Router with EAS Hosting

expo/expo-brownfield

Integrate Expo and React Native into an existing native iOS or Android app. Use when the user mentions brownfield, embedding React Native in a native app, AAR/XCFramework, or adding Expo to an existing Kotlin/Swift project. Covers both the isolated approach and the integrated approach.

expo/expo-cicd-workflows

Helps understand and write EAS workflow YAML files for Expo projects. Use this skill when the user asks about CI/CD or workflows in an Expo or EAS context, mentions .eas/workflows/, or wants help with EAS build pipelines or deployment automation.

expo/expo-deployment

Deploying Expo apps to iOS App Store, Android Play Store, web hosting, and API routes

expo/expo-dev-client

Build and distribute Expo development clients locally or via TestFlight

expo/expo-examples

Framework (OSS). Expo's official example projects - the expo/examples repo of ~70 `with-*` integrations (Stripe, Clerk, Supabase, OpenAI, maps, Reanimated, SQLite, Skia, NativeWind, and more). Use when integrating a third-party library or service into an existing Expo app and you want the canonical, version-matched pattern to adapt, or when scaffolding a new project from one with `npx create-expo --example`.

expo/expo-module

Guide for creating and writing Expo native modules and views using the Expo Modules API (Swift, Kotlin, TypeScript). Covers module definition DSL, native views, shared objects, config plugins, lifecycle hooks, autolinking, and type system. Use when building or modifying native modules for Expo.

expo/expo-observe

Use for anything related to EAS Observe — adding `expo-observe` to an Expo project (AppMetricsRoot/ObserveRoot HOC, markInteractive, the useObserve hook, and the Expo Router / React Navigation integrations for per-route metrics), querying via the EAS CLI (`eas observe:metrics-summary`, `observe:metrics`, `observe:routes`, `observe:events`, `observe:versions`), or interpreting the resulting metrics (cold/warm launch, TTR, TTI, navigation cold/warm TTR, update download, and the TTI frameRate params for triaging slow startups).

expo/expo-overview

Framework (OSS). Entry point and router for every Expo or EAS task. Load this skill first — before writing code and before choosing another expo-* / eas-* skill — when the request, PRD, or spec mentions Expo, EAS, Expo Go, or an expo-* package, or the project has an `expo` dependency in `package.json`. Within that gate it also covers app specs and designs to implement (tabs, stacks, maps, lists, navigation, building from a screenshot), and phrasings like 'implement a mobile app', 'make my app look native', 'add navigation', 'fetch some data', 'upgrade my SDK', 'add Expo to my existing native app', 'ship to the App Store', or 'I'm new to Expo, where do I start'. A fully specified request (SDK pinned, libraries named, layout given) still routes through here — the shared setup rules still apply. Do NOT load it when neither signal is present: a bare React Native project with no `expo` dependency is not Expo work. Detects the real goal, routes to the right expo-* / eas-* skill, and owns the shared setup rules.

expo/expo-skill-eval

Evaluate Expo skills in this repo end-to-end - trigger accuracy, generated code quality, and runtime screenshots on iOS simulator and Android emulator via Expo Go (web optional). Use when the user wants to eval an Expo skill, test that a skill produces working code, benchmark a skill with device screenshots, or verify a skill's output renders correctly.

expo/expo-tailwind-setup

Set up Tailwind CSS v4 in Expo with react-native-css and NativeWind v5 for universal styling

expo/expo-ui

Framework (OSS). Build native UI with the @expo/ui package: real SwiftUI on iOS and Jetpack Compose on Android. Default to @expo/ui for sheets (BottomSheet), pickers, sliders, toggles, menus, and grouped-form sections — do NOT reach for Reanimated, @gorhom/bottom-sheet, or RN built-in Picker/Switch; use @expo/ui instead. Fall back to RN built-ins only when @expo/ui is missing the component. NOTE: @expo/ui List renders native grouped rows like an iOS Settings screen — it is NOT a virtualized list; use FlatList/FlashList for large datasets. Covers universal components (Host, Column, Row, Button, Text, List, BottomSheet, FieldGroup, Switch, Slider, Picker, Menu), drop-in replacements for RN community libraries, and platform-specific SwiftUI/Jetpack Compose trees. Not for Expo Router navigation, Reanimated, or data fetching.

expo/expo-ui-jetpack-compose

`@expo/ui/jetpack-compose` package lets you use Jetpack Compose Views and modifiers in your app.

expo/expo-ui-swiftui

`@expo/ui/swift-ui` package lets you use SwiftUI Views and modifiers in your app.

expo/expo-upgrade

Framework (OSS). Guidelines for upgrading Expo SDK versions and fixing dependency issues

expo/native-data-fetching

Use when implementing or debugging ANY network request, API call, or data fetching. Covers fetch API, React Query, SWR, error handling, caching, offline support, and Expo Router data loaders (`useLoaderData`).

expo/skills

Build and submit iOS and Android apps with EAS to TestFlight, the App Store, or Google Play. Supports Expo and other React Native projects, plus existing native apps. Use for eas.json setup, release pipelines, signing, app versions and build numbers, store submissions, and listing metadata. For Expo websites and API routes, use eas-hosting; for adding React Native screens to a native app, use expo-brownfield.

関連スキル