Community程式設計與開發github.com

expo/expo-examples

框架(開源)。Expo 官方範例專案,收錄約 70 個 `with-*` 整合範例(Stripe、Clerk、Supabase、OpenAI、地圖、Reanimated、SQLite、Skia、NativeWind 等)。適用於將第三方函式庫或服務整合到現有 Expo 應用程式時,尋找正規、版本對應的模式來進行改寫,或使用 `npx create-expo --example` 從範例快速建立新專案。

expo-examples 是什麼?

Expo Examples 是 Expo 官方維護的範例庫,包含約 70 個以 `with-<函式庫>` 格式命名的整合範例,例如 `with-stripe`、`with-maps` 等。這些是精簡的受管專案(無 `ios/` 或 `android/` 目錄),通常僅含單一畫面,約 100–200 行程式碼,專為展示某個函式庫或服務的**正規整合模式**而設計,而非完整的應用程式架構。開發者或 AI 代理可以從中提取依賴組合、`app.json` 設定外掛以及最小可運作的整合程式碼,作為整合的參考藍圖。 該技能支援兩種主要使用模式: 1. **靈感改寫模式**(最常見):使用者已有專案,AI 代理尋找對應範例,閱讀其關鍵檔案(README、`package.json`、`app.json`、整合程式碼、`.env`),並將模式手動應用到使用者專案中,避免覆蓋現有設定。 2. **建立新專案模式**:從零開始,直接使用 `npx create-expo --example <範例名稱>` 建立基於範例的新專案。 技能強調非破壞性整合:必須版本對齊(使用 `npx expo install` 而非拷貝版本號碼)、合併設定外掛而非取代、以及還原環境變數。範例庫的預設分支為 `master`,若範例已棄用或重新命名,可查閱相關的 `meta.json` 檔案。此技能廣泛支援 Cursor、Claude Code、Codex 等常見的 AI 代理平台,協助開發者快速學習並導入 Expo SDK 支援的第三方整合最佳實作。

相容平台~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/expo/skills/tree/main/plugins/expo/skills/expo-examples

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Expo 範例

expo/examples 是 Expo 官方收錄約 70 個整合範例 的函式庫 — 目錄命名為 with-<函式庫>(例如 with-stripe、with-maps),每個範例圍繞 一個 函式庫或服務建置。這些並非完整應用程式:它們是 受管理的 專案(沒有 ios//android/ 目錄 — 原生設定透過設定外掛程式進行),且典型的範例是 單一畫面,約 100–200 行程式碼。從中挖掘出標準的整合 模式 — 依賴套件集、app.json 設定外掛程式,以及 Expo 針對當前 SDK 維護的最小接線 — 並將其調適到使用者的應用程式中。不要期望能從中直接複製應用程式架構。

在手動整合之前,應先查閱範例。(種類:全端、展示、起手範本 — 標示在 ./references/catalog.md 中。)

兩種模式

  1. 靈感啟發 / 調適(最常見)— 使用者已有專案。找到相符的範例,閱讀其關鍵檔案,並將 模式 套用到他們的程式碼中。
  2. 建置框架 — 全新專案。直接從範例開始一個新專案。

工作流程

1. 尋找正確的範例

將使用者的需求對應到範例名稱(例如付款 → with-stripe、驗證 → with-clerk)。./references/catalog.md 是一個分類的快照,可快速初步判斷 — 但它會過時,因此請對照即時清單確認:

# 即時範例名稱:
gh api repos/expo/examples/contents --jq '.[] | select(.type=="dir" and (.name|startswith(".")|not)) | .name'
# 別名(已重新命名)+ 已棄用(已刪除/移動)的範例 — 在推薦前檢查:
gh api repos/expo/examples/contents/meta.json --jq '.content' | base64 -d

meta.json 是判斷哪些範例已重新命名或已棄用(已棄用的範例會從儲存庫樹中移除,但仍列在此處,每個都附有 message)的真相來源。如果某個範例在其 deprecated 映射中,請不要推薦它 — 請依照 message 指引到現代路徑。如果它在 aliases 中,請使用 destination。

2a. 靈感模式 — 在不觸及使用者專案的情況下進行研究

常見情況:使用者已有應用程式,並想了解 Expo 如何處理某項功能。將範例作為參考來閱讀,並手動套用模式 — 切勿在他們的專案上直接建置框架。

首先,一次呼叫列出整個範例。 整合程式碼通常嵌套(例如 Stripe 的伺服器路由位於 app/api/ 中),因此僅列出第一層會遺漏重要的檔案:

gh api 'repos/expo/examples/git/trees/master?recursive=1' \
  --jq '.tree[].path | select(startswith("with-stripe/"))'

然後優先讀取高訊號的檔案: README.md(設定)→ package.json(依賴套件)→ app.json(設定外掛程式/權限)→ 清單揭示的整合程式碼 → .env(所需的機密)。每個檔案:

gh api repos/expo/examples/contents/with-stripe/utils/stripe-server.ts --jq '.content' | base64 -d
# 無 gh?原始 URL(分支是 master):
curl -s https://raw.githubusercontent.com/expo/examples/master/with-stripe/utils/stripe-server.ts

需要讀取超過兩個檔案? 許多整合分散在伺服器路由、客戶端提供者和設定(Stripe 就是如此)。跳過逐檔案呼叫 — 將整個範例拉取到一個可拋棄/被 .gitignore 忽略的目錄(不是使用者的專案),然後使用 Grep/Read 自由閱讀,再手動套用:

npx degit expo/examples/with-stripe /tmp/expo-ref/with-stripe   # 乾淨複本,無 git 歷史
# 無 degit 時的備用方案(稀疏檢出,無需完整 ~64 MB 複製):
git clone --depth 1 --filter=blob:none --sparse https://github.com/expo/examples.git /tmp/expo-ref/examples \
  && (cd /tmp/expo-ref/examples && git sparse-checkout set with-stripe)

從那裡使用 Grep/Read 讀取;完成後刪除暫存目錄。

2b. 建置框架模式 — 從範例開始新專案

npx create-expo --example with-stripe   # 簡寫:npx create-expo -e with-stripe
bun create expo --example with-stripe    # 使用 bun

3. 調適到使用者的應用程式中 — 非破壞性(關鍵)

當使用者已有應用程式時,僅添加範例引入的內容;切勿覆寫他們的設定。

  • 版本對齊 — 不要複製鎖定的版本。 範例追蹤最新的 SDK,因此它們的 package.json 鎖定版本無法匹配較舊的專案。僅使用 npx expo install <pkg> 添加缺少的依賴套件(它會解析 SDK 正確的版本),而不是複製確切的版本。
  • 合併設定,不要取代它。 僅添加使用者缺少的、範例引入的 app.json/app.config.* 外掛程式和權限 — 保持他們現有的設定區塊完整。
  • 移植整合程式碼。
  • 根據範例的 .env 形狀重新建立環境變數 — 它包含佔位符,而非運作中的機密。

完成條件:當整合程式碼已移植,且其所需的每個依賴套件、設定外掛程式、權限和環境變數都已在使用者的應用程式中妥善設定 — 而不是僅僅看起來已接線。

注意事項

  • 預設分支是 master, 不是 main(影響原始 URL 和稀疏檢出)。
  • 一鍵部署。 每個範例都有一個啟動 URL:https://launch.expo.dev/?github=https://github.com/expo/examples/tree/master/<範例>。

相關技能

  • 原生 UI 元件(@expo/ui 套件)→ expo-ui
  • 樣式設計與原生感受畫面 → expo-native-ui
  • 導航與路由 → expo-router
  • 編寫原生模組 → expo-module
  • 在採用最新 SDK 範例之前升級 SDK → expo-upgrade

參考資料

  • ./references/catalog.md — 範例函式庫的分類快照,供快速初步判斷。

提交回饋

如果您在此技能中發現錯誤、誤導或過時的資訊,請報告以便 Expo 改進:

npx --yes submit-expo-feedback@latest --category skills --subject "expo-examples" "<可操作的回饋>"

僅在您有具體且可操作的事項需要報告時才提交。請盡可能包含相關的上下文。 如果 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-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-router

Framework (OSS). Navigation and routing for Expo Router. Covers file-based routes, groups and dynamic routes, folder organization, Link with previews and context menus, native Stack, page titles, modals and form sheets, NativeTabs, headers and toolbars, and header search bars.

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.

相關技能