Community编程与开发github.com

expo/expo-brownfield

将 Expo 和 React Native 集成到现有的原生 iOS 或 Android 应用中。适用于用户提到棕地开发、在原生应用中嵌入 React Native、AAR/XCFramework,或向现有 Kotlin/Swift 项目添加 Expo 的场景。涵盖隔离方法和集成方法。

expo-brownfield 是什么?

这个技能为已有的原生 iOS 或 Android 应用逐步集成 Expo 和 React Native 提供指导。它支持两种主要方案:隔离方法(将 React Native 视图嵌入独立的原生 Activity/ViewController 中)和集成方法(在多个现有原生屏幕之间共享 React Native 环境)。该技能详细描述了集成步骤,包括配置 Gradle 和 CocoaPods、管理依赖,以及使用 'expo prebuild' 命令生成所需的原生代码。它还涵盖了在开发和生产环境中运行应用的注意事项。支持平台包括 iOS 和 Android,并提供了常见问题的故障排除提示,例如处理最小 SDK 版本冲突和解决 Metro bundler 的连接问题。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/expo/skills/tree/main/skills/expo-brownfield

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

expo-brownfield 是做什么的?

将 Expo 和 React Native 集成到现有的原生 iOS 或 Android 应用中。适用于用户提到棕地开发、在原生应用中嵌入 React Native、AAR/XCFramework,或向现有 Kotlin/Swift 项目添加 Expo 的场景。涵盖隔离方法和集成方法。

前提条件

  • 一个现有的原生 iOS 或 Android 应用。
  • 安装 Node.js 和 npm/yarn。
  • 根据需要安装 Expo CLI 或 npx expo 命令。

集成方法

隔离方法

此方法将 React Native 内容加载到专用的原生 Activity 或 ViewController 中。

步骤

  1. 在项目根目录运行 npx create-expo-app --template blank 创建 Expo 项目。
  2. 运行 npx expo prebuild 生成 ios/ 和 android/ 目录。
  3. 将生成的 ios/ 和 android/ 目录中的相关文件复制到现有原生项目中。
  4. 更新原生项目设置(例如,iOS 中的 Podfile,Android 中的 build.gradle)以包含 Expo 依赖。
  5. 创建原生 Activity 或 ViewController 以渲染 React Native 视图。

集成方法

此方法将 React Native 嵌入到现有原生应用中的多个屏幕和功能中。

步骤

  1. 遵循隔离方法中的第 1 步和第 2 步。
  2. 配置 expo-dev-client 以支持自定义原生模块:运行 npx expo install expo-dev-client。
  3. 设置共享的 RCTBridge(iOS)或 ReactInstanceManager(Android)以管理 React Native 环境。
  4. 在现有原生界面中使用 RCTRootView(iOS)或 ReactRootView(Android)加载 React Native 组件。
  5. 实现依赖注入模式以在原生和 React Native 模块之间共享数据和事件。

常见问题

  • 包冲突:确保 Gradle 和 CocoaPods 中 Expo 依赖的版本与原生项目要求兼容。
  • Metro bundler 连接:检查 expo start 是否正确运行,并且移动设备或模拟器可以通过正确的端口访问 bundler。
  • 最小 SDK 版本:确认原生项目的最低 SDK 版本满足 Expo 的要求(例如,Android 的 minSdkVersion 至少为 21)。

相关资源

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-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-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.

相关技能