Навигация в Expo Router

Раскладывает маршруты по соглашениям Expo Router и подключает нативную навигацию: Stack, NativeTabs, превью ссылок, контекстные меню, модальные окна, шторки, поиск в шапке. Для случаев, когда нужно выстроить навигацию в приложении на Expo Router.

РазработкаПак: Скиллы Expo239 строкexpo-router
Автор
Источник
expo/skills/plugins/expo/skills/expo-router @ 88d9bd7
Лицензия
MIT · Copyright (c) 2025-present 650 Industries, Inc. (aka Expo)

Об этом скилле

Что делает

Скилл задаёт агенту соглашения Expo Router и нативные элементы навигации, которые рекомендует Expo. Маршруты лежат только в app/, имена файлов — в kebab-case, компоненты и утилиты — в других папках, на / обязательно должен отвечать какой-то маршрут, а стеки описываются в _layout.tsx. Для переходов скилл предпочитает Link с Link.Preview и контекстными меню Link.Menu по долгому нажатию, нативный Stack с Stack.Title, модальные окна и form sheet через опцию presentation, а для поиска — Stack.SearchBar. В примере раскладки NativeTabs стоят в корне, а под ними общий стек группы (index,search), чтобы две вкладки открывали одни и те же экраны. На SDK 56+ прямой импорт из @react-navigation/* запрещён, вместо него — expo-router/react-navigation.

Подробности — в шести справочных файлах:

  • route-structure.md: динамические и catch-all маршруты, группы, маршруты-массивы, страница «не найдено».
  • tabs.md: NativeTabs, синтаксис SDK 54 и 55, liquid glass и сворачивание при прокрутке на iOS 26, переход с JS-вкладок, частые проблемы.
  • toolbar-and-headers.md: панели инструментов в шапке и внизу экрана, только iOS, SDK 55+.
  • form-sheet.md: высоты шторки, футеры, работа с контентом под ней.
  • search.md: поиск в шапке, useSearch, фильтрация.
  • zoom-transitions.md: зум-переходы Apple, iOS 18+, SDK 55+.

Когда включать и когда не надо

Когда нужно разложить маршруты или добавить вкладки, стеки, модальные окна, шторки, шапки и поиск в приложении на Expo Router. Многое здесь заточено под iOS (панели инструментов и зум-переходы есть только там), а NativeTabs по-прежнему импортируются из expo-router/unstable-native-tabs.

Стили и цвета — к скиллу Нативные экраны в Expo, анимация — к expo-animation, которого в нашем каталоге нет. Приложению на чистом React Navigation без Expo Router скилл почти ничего не даст.

Как поставить и вызвать

Команда установки ниже скачивает всю папку. Агент сам подхватывает скилл по описанию, когда речь идёт о навигации. Вызвать вручную:

  • Claude Code: /expo-router или попросить скилл по имени.
  • Codex: $expo-router.
  • Cursor: наберите / в чате Agent и выберите expo-router.

Пример: /expo-router Добавь нативные вкладки «Лента», «Поиск» и «Профиль», у каждой свой стек, и шторку с настройками.

Если стоит Обзор Expo и EAS, он обычно сам загружает этот скилл.

Чем отличается от похожих

В Лучших практиках React Native от Vercel Labs про навигацию одно правило: нативные стеки и вкладки вместо JS-навигаторов. В его примерах @react-navigation/native-stack импортируется напрямую, а этот скилл на SDK 56+ такое запрещает, так что на свежих SDK советы расходятся. Обновление Expo SDK касается навигации только в рамках обновления: изменения NativeTabs в SDK 55 и кодмод для SDK 56, который переводит импорты @react-navigation/* на точки входа expo-router. Больше в каталоге мобильной навигацией не занимается никто.

Установка

Выполните одну команду — она сохранит SKILL.md и файлы, которые он использует, в папку скиллов агента. Claude Code и Codex подхватывают новый скилл без перезапуска; если скилл не появился, перезапустите агента.

Скилл написан на английском — агент поймёт его и ответит вам по-русски.

Claude Code — macOS, Linux
curl -fsSL --create-dirs -o ~/.claude/skills/expo-router/SKILL.md https://anymodel.org/en/skills/expo/expo-router/SKILL.md -o ~/.claude/skills/expo-router/LICENSE https://anymodel.org/en/skills/expo/expo-router/LICENSE -o ~/.claude/skills/expo-router/agents/openai.yaml https://anymodel.org/en/skills/expo/expo-router/agents/openai.yaml -o ~/.claude/skills/expo-router/references/form-sheet.md https://anymodel.org/en/skills/expo/expo-router/references/form-sheet.md -o ~/.claude/skills/expo-router/references/route-structure.md https://anymodel.org/en/skills/expo/expo-router/references/route-structure.md -o ~/.claude/skills/expo-router/references/search.md https://anymodel.org/en/skills/expo/expo-router/references/search.md -o ~/.claude/skills/expo-router/references/tabs.md https://anymodel.org/en/skills/expo/expo-router/references/tabs.md -o ~/.claude/skills/expo-router/references/toolbar-and-headers.md https://anymodel.org/en/skills/expo/expo-router/references/toolbar-and-headers.md -o ~/.claude/skills/expo-router/references/zoom-transitions.md https://anymodel.org/en/skills/expo/expo-router/references/zoom-transitions.md
Codex, Cursor — macOS, Linux
curl -fsSL --create-dirs -o ~/.agents/skills/expo-router/SKILL.md https://anymodel.org/en/skills/expo/expo-router/SKILL.md -o ~/.agents/skills/expo-router/LICENSE https://anymodel.org/en/skills/expo/expo-router/LICENSE -o ~/.agents/skills/expo-router/agents/openai.yaml https://anymodel.org/en/skills/expo/expo-router/agents/openai.yaml -o ~/.agents/skills/expo-router/references/form-sheet.md https://anymodel.org/en/skills/expo/expo-router/references/form-sheet.md -o ~/.agents/skills/expo-router/references/route-structure.md https://anymodel.org/en/skills/expo/expo-router/references/route-structure.md -o ~/.agents/skills/expo-router/references/search.md https://anymodel.org/en/skills/expo/expo-router/references/search.md -o ~/.agents/skills/expo-router/references/tabs.md https://anymodel.org/en/skills/expo/expo-router/references/tabs.md -o ~/.agents/skills/expo-router/references/toolbar-and-headers.md https://anymodel.org/en/skills/expo/expo-router/references/toolbar-and-headers.md -o ~/.agents/skills/expo-router/references/zoom-transitions.md https://anymodel.org/en/skills/expo/expo-router/references/zoom-transitions.md
Claude Code — Windows PowerShell
foreach ($f in 'SKILL.md','LICENSE','agents/openai.yaml','references/form-sheet.md','references/route-structure.md','references/search.md','references/tabs.md','references/toolbar-and-headers.md','references/zoom-transitions.md') { $p = Join-Path "$HOME\.claude\skills\expo-router" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/expo/expo-router/$f" -UseBasicParsing -OutFile $p }
Codex, Cursor — Windows PowerShell
foreach ($f in 'SKILL.md','LICENSE','agents/openai.yaml','references/form-sheet.md','references/route-structure.md','references/search.md','references/tabs.md','references/toolbar-and-headers.md','references/zoom-transitions.md') { $p = Join-Path "$HOME\.agents\skills\expo-router" $f; New-Item -ItemType Directory -Force (Split-Path $p) | Out-Null; Invoke-WebRequest "https://anymodel.org/en/skills/expo/expo-router/$f" -UseBasicParsing -OutFile $p }

Другой агент: сохраните файл в его папку скиллов или дайте ему ссылку на файл: https://anymodel.org/en/skills/expo/expo-router/SKILL.md

SKILL.md

Исходник

Expo Router Navigation

Navigation and routing for Expo Router apps. For screen styling, colors, controls, media, and visual effects, use the expo-native-ui skill; for motion and gestures, use expo-animation.

References

Consult these resources as needed:

references/
  route-structure.md     Route conventions, dynamic routes, groups, folder organization
  tabs.md                NativeTabs, migration from JS tabs, iOS 26 features
  toolbar-and-headers.md Stack headers and toolbar buttons, menus, search (iOS only)
  form-sheet.md          Form sheets in expo-router: configuration, footers and background interaction.
  search.md              Search bar with headers, useSearch hook, filtering patterns
  zoom-transitions.md    Apple Zoom: fluid zoom transitions with Link.AppleZoom (iOS 18+)

Code Style

  • Always use kebab-case for file names, e.g. comment-card.tsx
  • Always remove old route files when moving or restructuring navigation
  • Never use special characters in file names
  • Configure tsconfig.json with path aliases, and prefer aliases over relative imports for refactors.

Routes

See ./references/route-structure.md for detailed route conventions.

  • Routes belong in the app directory.
  • Never co-locate components, types, or utilities in the app directory. This is an anti-pattern.
  • Ensure the app always has a route that matches "/", it may be inside a group route.

Library Preferences

  • Color from expo-router for native semantic colors, not raw PlatformColor (type-safe, auto-adapts to light/dark). See expo-native-ui for the full color palette pattern.
  • In SDK 56+, never import from @react-navigation/* directly — use expo-router/react-navigation instead (covers @react-navigation/native, /core, /elements, /routers)

Behavior

  • Prefer Stack.SearchBar to add a search bar to a screen

Navigation

Use <Link href="/path" /> from 'expo-router' for navigation between routes.

import { Link } from 'expo-router';

// Basic link
<Link href="/path" />

// Wrapping custom components
<Link href="/path" asChild>
  <Pressable>...</Pressable>
</Link>

Whenever possible, include a <Link.Preview> to follow iOS conventions. Add context menus and previews frequently to enhance navigation.

Stack

  • ALWAYS use _layout.tsx files to define stacks
  • Use Stack from 'expo-router/stack' for native navigation stacks

Page Title

Set the page title with Stack.Title:

<Stack.Title>Home</Stack.Title>

Context Menus

Add long press context menus to Link components:

import { Link } from "expo-router";

<Link href="/settings" asChild>
  <Link.Trigger>
    <Pressable>
      <Card />
    </Pressable>
  </Link.Trigger>
  <Link.Menu>
    <Link.MenuAction
      title="Share"
      icon="square.and.arrow.up"
      onPress={handleSharePress}
    />
    <Link.MenuAction
      title="Block"
      icon="nosign"
      destructive
      onPress={handleBlockPress}
    />
    <Link.Menu title="More" icon="ellipsis">
      <Link.MenuAction title="Copy" icon="doc.on.doc" onPress={() => {}} />
      <Link.MenuAction
        title="Delete"
        icon="trash"
        destructive
        onPress={() => {}}
      />
    </Link.Menu>
  </Link.Menu>
</Link>;

Use link previews frequently to enhance navigation:

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

Link preview can be used with context menus.

Modal

Present a screen as a modal:

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

Prefer this to building a custom modal component.

Sheet

Present a screen as a dynamic form sheet:

<Stack.Screen
  name="sheet"
  options={{
    presentation: "formSheet",
    sheetGrabberVisible: true,
    sheetAllowedDetents: [0.5, 1.0],
    contentStyle: { backgroundColor: "transparent" },
  }}
/>
  • Using contentStyle: { backgroundColor: "transparent" } makes the background liquid glass on iOS 26+.

Common route structure

A standard app layout with tabs and stacks inside each tab:

app/
  _layout.tsx — <NativeTabs />
  (index,search)/
    _layout.tsx — <Stack />
    index.tsx — Main list
    search.tsx — Search view
// 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>Items</NativeTabs.Trigger.Label>
        </NativeTabs.Trigger>
        <NativeTabs.Trigger name="(search)" role="search" />
      </NativeTabs>
    </ThemeProvider>
  );
}

Create a shared group route so both tabs can push common screens:

// 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: "Items", search: "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 is the SDK 56+ option name; older SDKs use headerLargeTitle, which is deprecated upstream.

Submitting Feedback

You can voluntarily report errors, misleading or outdated information in this skill, so Expo can improve it:

npx --yes @expo/agent-cli@latest feedback --category skills --subject "expo-router" --message "<actionable feedback>"

Use --category agent-cli for a problem with the agent CLI, and --category evals when an agent repeatedly fails at an Expo task. Run feedback --help for subjects and the data that the command sends. Each report goes to Expo with project and environment details. Show the user the message, and send it only if the user agrees. If you cannot ask the user, do not send it. Do not include secrets or personal data.

Подключить через AnyModel API

Скилл работает на той модели, которую использует агент. Подключите Claude Code, Codex или Cursor к AnyModel и запускайте его на Claude, GPT, Gemini и других моделях по одному ключу — оплата за токены, без подписки.

Ещё из пака Скиллы Expo

Обзор Expo и EAS

Направляет задачи по Expo и EAS в нужный скилл Expo и задаёт общие правила: агентский CLI, определение SDK, документация своей версии, установка пакетов под SDK, проверка входа в EAS. Для случаев, когда в задаче есть Expo или EAS или проект зависит от expo.

Нативные экраны в Expo

Оформляет экраны Expo по правилам iOS и Android: выбор библиотек, безопасные зоны, системные цвета через Color, SF Symbols, контролы, медиа, хранилище и эффекты, сначала Expo Go. Для случаев, когда вы делаете или переделываете экраны в приложении на Expo.

Обновление Expo SDK

Переводит приложение на новый Expo SDK: expo install --fix, expo-doctor, prebuild и чистка кешей только при нативных папках, замена устаревших пакетов, заметки по SDK. Для случаев, когда нужно поднять SDK или разобрать конфликты зависимостей после него.

Сборки EAS для App Store и Google Play

Собирает и отправляет приложения для iOS и Android через EAS в TestFlight, App Store и Google Play: только проверенные сборки по ID, учётные данные остаются у владельца. Для случаев, когда нужно настроить сборки, подпись, версии, отправку или метаданные.

EAS Update: обновления по воздуху

Настраивает и публикует обновления по воздуху через EAS Update, сверяет канал, ветку и runtime version и разбирает, почему сборка показывает старый код. Для случаев, когда исправление JS или ассетов нужно доставить без новой сборки.