AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The expo-brownfield skill provides a structured methodology for adopting React Native incrementally within established native mobile applications. It outlines two primary integration strategies: the isolated approach, which packages React Native code as a prebuilt library (AAR or XCFramework) for teams that want to avoid Node.js dependencies in the host app, and the integrated approach, which incorporates React Native directly into the native build system (Gradle or CocoaPods) for unified development. The skill emphasizes careful host inspection, version compatibility, and feature validation to ensure seamless interoperability between native and React Native components.
What it does
- Guides the integration of React Native features into existing native iOS and Android codebases.
- Defines the isolated approach for consuming React Native as a prebuilt library dependency.
- Defines the integrated approach for embedding React Native directly into native build pipelines.
- Provides criteria for selecting the appropriate integration strategy based on team structure and build requirements.
- Outlines prerequisites for environment setup, including Node.js and native build toolchains.
- Details verification steps to ensure feature functionality and lifecycle management within the host app.
When to use it
- When adding new features to an existing native app using React Native.
- When native and React Native teams operate on different release cadences.
- When you need to minimize the footprint of React Native on the native build pipeline.
- When a single team owns both native and React Native code and prefers a unified build.
Advantages
- Supports incremental adoption of React Native in legacy native applications.
- Offers flexibility to choose between isolated and integrated build workflows.
- Enables native teams to consume React Native features without requiring Node.js tooling.
- Maintains compatibility with existing native navigation and UI patterns.
- Supports standard development workflows like Metro and Fast Refresh.
Usage examples
- “How do I add a React Native screen to an existing native Android app without requiring the Android team to install Node.js?”
- The agent will guide you through the isolated approach, creating an Expo project and building it as an AAR artifact that the native Android team can consume as a standard dependency.
- “We want to integrate Expo into our iOS app and manage everything in one repository. Which approach should I use?”
- The agent will recommend the integrated approach, providing steps to add React Native and Expo directly to your CocoaPods setup while preserving your existing native project structure.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/expo/expo-brownfield/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip expo-brownfield.zip -d .agents/skills
Documentation by Expo
Expo Brownfield
A brownfield app is an existing native iOS or Android app that adopts React Native incrementally, as opposed to a greenfield app that is React Native from day one.
Inspect the host first
Identify the existing app entry point, navigation owner, native build system, deployment targets, and any React Native runtime already linked. Record the installed Expo, React Native, and brownfield package versions from the lockfile. Adding EAS Build or Submit to a Swift app alone does not require React Native; route that task to eas-app-stores.
Preserve the host's SwiftUI App / UIKit window and native screens when embedding a feature. Do not run prebuild in a manually maintained native host, including during troubleshooting. An isolated Expo producer may use CNG; keep its generated ios/ and android/ separate from the consuming app.
Expo supports two distinct ways to add React Native to a brownfield project:
| Approach | What ships to the native app | When to choose |
|---|---|---|
| Isolated | Prebuilt AAR / XCFramework | Native team doesn't need Node or RN tooling; RN code can live in a separate repo |
| Integrated | React Native sources added to the existing Gradle / CocoaPods build | One team owns everything; comfortable with RN tooling; wants a single build |
For the full decision matrix, see ./references/comparison.md.
Pick an approach
Use these quick rules — fall through to comparison.md for anything ambiguous.
Choose isolated if the iOS/Android team must consume RN as a regular library dependency (AAR or XCFramework), without installing Node, Yarn, or the React Native build toolchain.
Choose isolated if RN code and native code live in separate repositories or release on independent cadences.
Choose integrated if a single team owns both the native and RN code and is willing to add React Native + Expo to the native project's Gradle and CocoaPods setup.
Both approaches support Metro and Fast Refresh in Debug. Choose integrated for shared build ownership, not because isolated lacks live JS iteration.
References
./references/brownfield-isolated.md -- Build RN as AAR/XCFramework and consume from the native app (BrownfieldActivity, ReactNativeViewController, ReactNativeView)
./references/brownfield-integrated.md -- Add RN and Expo directly to existing Gradle and CocoaPods builds, preserving the native app shell
./references/feature-integration.md -- Pass input, return results, dismiss, clean up listeners, and forward lifecycle events; includes a SwiftUI host example
./references/comparison.md -- Decision criteria, trade-offs, and scenario mapping for choosing an approach
./references/troubleshooting.md -- Metro connection, build, signing, and module-resolution issues common to both approaches
More information available at https://docs.expo.dev/brownfield/overview/
Shared prerequisites
Both approaches require, in the environment that builds the React Native side:
Node.js (LTS) — runs the Expo CLI and JavaScript code.
The project's package manager and lockfile — npm, Yarn, pnpm, or Bun. Do not switch package managers just to follow an example.
The iOS build environment needs Xcode and CocoaPods (use the project's Gemfile/Bundler setup when present). The isolated consuming app needs Xcode but no CocoaPods or RN tooling just to consume the artifacts.
Select compatible versions
For an existing Expo/RN project, keep its selected SDK and use npx expo install to align dependencies. Do not upgrade it just to follow this skill. For a new producer, use the current stable SDK compatible with the host's OS support, dependencies, and build toolchain; confirm the release is stable before selecting it.
Before native setup, read ./references/version-compatibility.md for matching native templates, toolchain/OS requirements, and build defaults across SDK versions. A purely native consumer has no Expo SDK version to pin, but must satisfy the artifact's requirements.
Verify the feature in the host
Open the RN screen with input, return a result to native, dismiss, and reopen with fresh input. Check listener cleanup and the host's original navigation. Then build the host in Release with a Release artifact and Metro stopped. Rendering only in Expo Go or the producer's example app does not validate the integration. See ./references/feature-integration.md for the complete acceptance scenario.
Submitting Feedback
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:
npx --yes @expo/agent-cli@latest feedback --category skills --subject "expo-brownfield" "<actionable feedback>"Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
If an agent repeatedly fails at an Expo task or the user has to step in, submit a brief report of the task, expected result, and what went wrong using --category evals and the relevant Expo package or command as --subject.
Files
- ATTRIBUTION.mdAdded by AutoGineer869 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md5.7 KiB
- agents/openai.yaml420 B
- references/brownfield-integrated.md22.2 KiB
- references/brownfield-isolated.md21.8 KiB
- references/comparison.md6.6 KiB
- references/feature-integration.md9.9 KiB
- references/troubleshooting.md8.2 KiB
- references/version-compatibility.md4.4 KiB
references/feature-integration.md
Integrate a complete native-hosted feature
Read after choosing the build approach. Packaging a framework and displaying its first view are only part of integration: the host also owns presentation, input, results, and lifecycle events.
Define the boundary
Use initial props for a presentation's input, including a fresh
requestIdto correlate replies. Use JSON-compatible values rather than Swift objects or JS callbacks.Use messages for events such as context requests, completed, and cancelled. Subscribe before mounting the feature. Keep required startup data in initial props; a message sent during mounting is not a durable inbox or an acknowledgement that the receiving native emitter is ready. Correlate and acknowledge later updates if delivery matters.
Keep long-lived business state in its existing owner. If both sides must observe mutable state, inspect the installed
expo-brownfieldshared-state APIs (useSharedState,setSharedStateValue, anddeleteSharedState) and native facade. Namespace per-feature keys and clear session data when its owner ends the session. Messages alone do not provide persistent state or delivery guarantees.
Register the component that receives input
For a small standalone producer, set package.json's main to index.ts and register a component explicitly. If the scaffold has no TypeScript setup, first run npx expo install typescript @types/react:
import { registerRootComponent } from 'expo';
import Feature from './Feature';
registerRootComponent(Feature); // Registers "main", matching the native examples.Do not overwrite an existing app entry point blindly. A Router-based producer needs an explicit adapter to carry root props into the feature; native initialProps are not automatically route parameters.
Feature.tsx:
import { useEffect, useState } from 'react';
import { Button, Text, View } from 'react-native';
import * as Brownfield from 'expo-brownfield';
export default function Feature({ requestId, userId, greeting: initialGreeting }: {
requestId: string; userId: string; greeting: string;
}) {
const [greeting, setGreeting] = useState(initialGreeting);
useEffect(() => {
const subscription = Brownfield.addMessageListener((event) => {
if (event.requestId === requestId && event.type === 'feature.context') {
setGreeting(String(event.greeting));
}
});
return () => subscription.remove();
}, [requestId]);
return (
<View style={{ flex: 1, justifyContent: 'center', padding: 24 }}>
<Text>{greeting}: {userId}</Text>
<Button title="Refresh greeting" onPress={() => Brownfield.sendMessage({
type: 'feature.request-context', requestId,
})} />
<Button title="Done" onPress={() => Brownfield.sendMessage({
type: 'feature.completed', requestId, selectedId: 'item-42',
})} />
<Button title="Cancel" onPress={() => Brownfield.sendMessage({
type: 'feature.cancelled', requestId,
})} />
</View>
);
}SwiftUI host: receive the result and dismiss
This example uses Expo's isolated generated framework, configured as MyBrownfield, with ReactNativeHostManager.shared.initialize() already connected to the host's app delegate as in isolated setup. It adds a feature to the existing SwiftUI view hierarchy; it introduces no app entry point.
import SwiftUI
import MyBrownfield
private struct FeatureRequest: Identifiable {
let id = UUID().uuidString
let userId: String
}
struct FeatureLauncher: View {
@State private var request: FeatureRequest?
@State private var listenerId: String?
@State private var selectedId: String?
var body: some View {
VStack {
Text(selectedId ?? "No selection")
Button("Open feature") { openFeature(userId: "123") }
}
.sheet(item: $request, onDismiss: stopListening) { request in
ReactNativeView(
moduleName: "main",
initialProps: ["requestId": request.id, "userId": request.userId, "greeting": "Hello"]
)
}
}
private func openFeature(userId: String) {
guard request == nil else { return }
stopListening()
let next = FeatureRequest(userId: userId)
listenerId = BrownfieldMessaging.addListener { message in
// Messaging callbacks are not a promise of execution on the UI thread.
DispatchQueue.main.async {
guard request?.id == next.id,
message["requestId"] as? String == next.id,
let type = message["type"] as? String else { return }
switch type {
case "feature.request-context":
BrownfieldMessaging.sendMessage([
"type": "feature.context", "requestId": next.id, "greeting": "Updated hello"
])
case "feature.completed":
guard let value = message["selectedId"] as? String else { return }
selectedId = value
closeFeature()
case "feature.cancelled":
closeFeature()
default:
break
}
}
}
request = next
}
private func closeFeature() {
stopListening()
request = nil
}
private func stopListening() {
if let listenerId {
BrownfieldMessaging.removeListener(id: listenerId)
self.listenerId = nil
}
}
}The same message contract works with UIKit: the presenting coordinator owns the subscription, passes the request as initialProps, handles the result on the main thread, then pops or dismisses its controller. Remove the subscription on interactive cancellation and coordinator teardown too. Remove only the listener you own, not every feature's listeners.
For integrated builds, install/autolink expo-brownfield only if using these APIs. The isolated plugin's generated BrownfieldMessaging facade is not automatically present in the host. In expo-brownfield 55.0.28 and 57.0.18, internal import ExpoBrownfield (matching the generated module provider) exposes BrownfieldMessagingInternal.shared with instance addListener, sendMessage, and removeListener(id:) methods. Confirm the installed Swift interface before adapting the example, or keep a small host adapter around that SDK-specific surface. Use the integrated controller instead of the isolated ReactNativeView.
Navigation behavior depends on the native container. In the SDK 55 and 57 wrappers, the generated UIKit controller handles popToNative() by popping its navigation controller, while the generated SwiftUI ReactNativeView also listens for that event and calls SwiftUI dismiss(). A custom integrated controller does not acquire these handlers automatically. The example above lets the host consume a result before closing its sheet. Use either that result/close contract or the wrapper's navigation API for a given action; do not trigger both.
Forward lifecycle events
Some modules require launch, URL, notification, and application-state callbacks even when a basic RN view renders successfully.
iOS: use
ExpoAppDelegateforwarding when compatible with the host's delegate. The isolated generated framework exportsExpoBrownfieldAppDelegate; the integrated app usesExpoAppDelegatefromExpo. Preserve existing override behavior and call the superclass. With a required custom superclass, an isolated host can retain a generatedExpoBrownfieldAppDelegatehelper and forward the relevant delegate methods to it. An integrated host can useExpoAppDelegateSubscriberManagerfromExpoModulesCoredirectly, following the installed SDK's interface. Forward each event once. For scene-based URL handling, connect the existing scene/SwiftUI handler to the module's required callback; an app-delegate adaptor alone does not replace scene delivery.Android: preserve
ApplicationLifecycleDispatchercalls and the activity lifecycle/back handling from the chosen approach. Exercise configuration changes and native back navigation in the host.
Use the Expo lifecycle guide and the installed delegate source to choose callbacks. Test the actual modules in use, including warm/cold deep links or push registration where applicable; a first-screen render does not verify these paths.
Acceptance scenario
Build the existing host and record its native launch/navigation behavior before integration.
Build/select the matching Debug artifact (isolated), run Metro in the producer, and open the feature from the native host with identifiable input.
Confirm initial input on screen, then use Refresh greeting to verify a later native reply. Complete once: native receives one matching result and closes the feature.
Reopen with a fresh request ID and different input. Verify no stale result or duplicate callback. Cancel through both the RN button and native swipe/back dismissal; repeat.
Build/select the Release artifact and host Release configuration. Stop Metro, launch afresh, and repeat the interaction, including any bundled images/fonts. Check the original native screens and relevant lifecycle callbacks.
For runnable examples of both SwiftUI hosts, see the iOS brownfield playgrounds.
EAS Build/Submit can distribute the host after this integration works; they do not implement the runtime boundary. EAS Update requires an updates-enabled RN runtime and separate brownfield setup, not just an EAS project ID. Consult the existing-native-app Update guide if requested; use the chosen toolchain's setup for isolated artifacts. Updates cannot replace compiled Swift code or add a native module absent from the shipped binary.
Select the matching SDK/API using version compatibility. Current reference: Brownfield API; implementation: Expo SDK 57 brownfield.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Expo
- Publisher
- Expo (Official)
- Source
- expo/skills · plugins/expo/skills/expo-brownfield · commit a9e5bd3
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from plugins/expo/LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Expo or Expo.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download expo-brownfield.zip