@codyswann/lisa 2.111.0 → 2.113.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdk/package-lisa/package.lisa.json +1 -0
- package/dist/core/lisa.d.ts +42 -0
- package/dist/core/lisa.d.ts.map +1 -1
- package/dist/core/lisa.js +67 -0
- package/dist/core/lisa.js.map +1 -1
- package/expo/package-lisa/package.lisa.json +1 -0
- package/nestjs/package-lisa/package.lisa.json +1 -0
- package/package.json +1 -1
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.mcp.json +3 -3
- package/plugins/lisa-expo/THIRD-PARTY-NOTICES.md +57 -0
- package/plugins/lisa-expo/skills/add-app-clip/SKILL.md +280 -0
- package/plugins/lisa-expo/skills/add-app-clip/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/add-app-clip/references/native-module.md +96 -0
- package/plugins/lisa-expo/skills/building-native-ui/SKILL.md +321 -0
- package/plugins/lisa-expo/skills/building-native-ui/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/animations.md +220 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/controls.md +272 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/form-sheet.md +253 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/gradients.md +106 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/icons.md +213 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/media.md +198 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/route-structure.md +229 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/search.md +248 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/storage.md +121 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/tabs.md +433 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/toolbar-and-headers.md +284 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/visual-effects.md +197 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/webgpu-three.md +605 -0
- package/plugins/lisa-expo/skills/building-native-ui/references/zoom-transitions.md +158 -0
- package/plugins/lisa-expo/skills/eas-update-insights/SKILL.md +228 -0
- package/plugins/lisa-expo/skills/eas-update-insights/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/eas-update-insights/references/channel-insights-schema.md +47 -0
- package/plugins/lisa-expo/skills/eas-update-insights/references/update-insights-schema.md +69 -0
- package/plugins/lisa-expo/skills/expo-api-routes/SKILL.md +369 -0
- package/plugins/lisa-expo/skills/expo-api-routes/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-brownfield/SKILL.md +54 -0
- package/plugins/lisa-expo/skills/expo-brownfield/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-brownfield/references/brownfield-integrated.md +526 -0
- package/plugins/lisa-expo/skills/expo-brownfield/references/brownfield-isolated.md +402 -0
- package/plugins/lisa-expo/skills/expo-brownfield/references/comparison.md +63 -0
- package/plugins/lisa-expo/skills/expo-brownfield/references/troubleshooting.md +88 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/SKILL.md +92 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/scripts/fetch.js +113 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/scripts/package.json +11 -0
- package/plugins/lisa-expo/skills/expo-cicd-workflows/scripts/validate.js +85 -0
- package/plugins/lisa-expo/skills/expo-deployment/SKILL.md +190 -0
- package/plugins/lisa-expo/skills/expo-deployment/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/app-store-metadata.md +479 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/ios-app-store.md +355 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/play-store.md +246 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/testflight.md +58 -0
- package/plugins/lisa-expo/skills/expo-deployment/references/workflows.md +200 -0
- package/plugins/lisa-expo/skills/expo-dev-client/SKILL.md +164 -0
- package/plugins/lisa-expo/skills/expo-dev-client/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-module/SKILL.md +141 -0
- package/plugins/lisa-expo/skills/expo-module/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-module/references/config-plugin.md +90 -0
- package/plugins/lisa-expo/skills/expo-module/references/create-expo-module.md +206 -0
- package/plugins/lisa-expo/skills/expo-module/references/lifecycle.md +127 -0
- package/plugins/lisa-expo/skills/expo-module/references/module-config.md +48 -0
- package/plugins/lisa-expo/skills/expo-module/references/native-module.md +286 -0
- package/plugins/lisa-expo/skills/expo-module/references/native-view.md +171 -0
- package/plugins/lisa-expo/skills/expo-tailwind-setup/SKILL.md +480 -0
- package/plugins/lisa-expo/skills/expo-tailwind-setup/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-ui-jetpack-compose/SKILL.md +40 -0
- package/plugins/lisa-expo/skills/expo-ui-jetpack-compose/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/expo-ui-swift-ui/SKILL.md +39 -0
- package/plugins/lisa-expo/skills/expo-ui-swift-ui/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/native-data-fetching/SKILL.md +507 -0
- package/plugins/lisa-expo/skills/native-data-fetching/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/native-data-fetching/references/expo-router-loaders.md +344 -0
- package/plugins/lisa-expo/skills/upgrading-expo/SKILL.md +134 -0
- package/plugins/lisa-expo/skills/upgrading-expo/agents/openai.yaml +4 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/expo-av-to-audio.md +132 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/expo-av-to-video.md +160 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/native-tabs.md +124 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/new-architecture.md +79 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/react-19.md +79 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/react-compiler.md +59 -0
- package/plugins/lisa-expo/skills/upgrading-expo/references/react-navigation-to-expo-router.md +61 -0
- package/plugins/lisa-expo/skills/use-dom/SKILL.md +417 -0
- package/plugins/lisa-expo/skills/use-dom/agents/openai.yaml +4 -0
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/src/expo/.mcp.json +3 -3
- package/plugins/src/expo/THIRD-PARTY-NOTICES.md +57 -0
- package/plugins/src/expo/skills/add-app-clip/SKILL.md +280 -0
- package/plugins/src/expo/skills/add-app-clip/references/native-module.md +96 -0
- package/plugins/src/expo/skills/building-native-ui/SKILL.md +321 -0
- package/plugins/src/expo/skills/building-native-ui/references/animations.md +220 -0
- package/plugins/src/expo/skills/building-native-ui/references/controls.md +272 -0
- package/plugins/src/expo/skills/building-native-ui/references/form-sheet.md +253 -0
- package/plugins/src/expo/skills/building-native-ui/references/gradients.md +106 -0
- package/plugins/src/expo/skills/building-native-ui/references/icons.md +213 -0
- package/plugins/src/expo/skills/building-native-ui/references/media.md +198 -0
- package/plugins/src/expo/skills/building-native-ui/references/route-structure.md +229 -0
- package/plugins/src/expo/skills/building-native-ui/references/search.md +248 -0
- package/plugins/src/expo/skills/building-native-ui/references/storage.md +121 -0
- package/plugins/src/expo/skills/building-native-ui/references/tabs.md +433 -0
- package/plugins/src/expo/skills/building-native-ui/references/toolbar-and-headers.md +284 -0
- package/plugins/src/expo/skills/building-native-ui/references/visual-effects.md +197 -0
- package/plugins/src/expo/skills/building-native-ui/references/webgpu-three.md +605 -0
- package/plugins/src/expo/skills/building-native-ui/references/zoom-transitions.md +158 -0
- package/plugins/src/expo/skills/eas-update-insights/SKILL.md +228 -0
- package/plugins/src/expo/skills/eas-update-insights/references/channel-insights-schema.md +47 -0
- package/plugins/src/expo/skills/eas-update-insights/references/update-insights-schema.md +69 -0
- package/plugins/src/expo/skills/expo-api-routes/SKILL.md +369 -0
- package/plugins/src/expo/skills/expo-brownfield/SKILL.md +54 -0
- package/plugins/src/expo/skills/expo-brownfield/references/brownfield-integrated.md +526 -0
- package/plugins/src/expo/skills/expo-brownfield/references/brownfield-isolated.md +402 -0
- package/plugins/src/expo/skills/expo-brownfield/references/comparison.md +63 -0
- package/plugins/src/expo/skills/expo-brownfield/references/troubleshooting.md +88 -0
- package/plugins/src/expo/skills/expo-cicd-workflows/SKILL.md +92 -0
- package/plugins/src/expo/skills/expo-cicd-workflows/scripts/fetch.js +113 -0
- package/plugins/src/expo/skills/expo-cicd-workflows/scripts/package.json +11 -0
- package/plugins/src/expo/skills/expo-cicd-workflows/scripts/validate.js +85 -0
- package/plugins/src/expo/skills/expo-deployment/SKILL.md +190 -0
- package/plugins/src/expo/skills/expo-deployment/references/app-store-metadata.md +479 -0
- package/plugins/src/expo/skills/expo-deployment/references/ios-app-store.md +355 -0
- package/plugins/src/expo/skills/expo-deployment/references/play-store.md +246 -0
- package/plugins/src/expo/skills/expo-deployment/references/testflight.md +58 -0
- package/plugins/src/expo/skills/expo-deployment/references/workflows.md +200 -0
- package/plugins/src/expo/skills/expo-dev-client/SKILL.md +164 -0
- package/plugins/src/expo/skills/expo-module/SKILL.md +141 -0
- package/plugins/src/expo/skills/expo-module/references/config-plugin.md +90 -0
- package/plugins/src/expo/skills/expo-module/references/create-expo-module.md +206 -0
- package/plugins/src/expo/skills/expo-module/references/lifecycle.md +127 -0
- package/plugins/src/expo/skills/expo-module/references/module-config.md +48 -0
- package/plugins/src/expo/skills/expo-module/references/native-module.md +286 -0
- package/plugins/src/expo/skills/expo-module/references/native-view.md +171 -0
- package/plugins/src/expo/skills/expo-tailwind-setup/SKILL.md +480 -0
- package/plugins/src/expo/skills/expo-ui-jetpack-compose/SKILL.md +40 -0
- package/plugins/src/expo/skills/expo-ui-swift-ui/SKILL.md +39 -0
- package/plugins/src/expo/skills/native-data-fetching/SKILL.md +507 -0
- package/plugins/src/expo/skills/native-data-fetching/references/expo-router-loaders.md +344 -0
- package/plugins/src/expo/skills/upgrading-expo/SKILL.md +134 -0
- package/plugins/src/expo/skills/upgrading-expo/references/expo-av-to-audio.md +132 -0
- package/plugins/src/expo/skills/upgrading-expo/references/expo-av-to-video.md +160 -0
- package/plugins/src/expo/skills/upgrading-expo/references/native-tabs.md +124 -0
- package/plugins/src/expo/skills/upgrading-expo/references/new-architecture.md +79 -0
- package/plugins/src/expo/skills/upgrading-expo/references/react-19.md +79 -0
- package/plugins/src/expo/skills/upgrading-expo/references/react-compiler.md +59 -0
- package/plugins/src/expo/skills/upgrading-expo/references/react-navigation-to-expo-router.md +61 -0
- package/plugins/src/expo/skills/use-dom/SKILL.md +417 -0
- package/scripts/generate-codex-plugin-artifacts.mjs +7 -2
- package/scripts/install-claude-plugins.sh +23 -7
- package/typescript/package-lisa/package.lisa.json +2 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
# Brownfield: Integrated Approach
|
|
2
|
+
|
|
3
|
+
Add React Native and Expo directly to the existing native project's build system — Gradle on Android, CocoaPods on iOS — the same way you would add any other library. The native project gains React Native capabilities while keeping a single, unified build.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- A single team owns both the native and React Native code.
|
|
8
|
+
- The team is comfortable adding React Native and Expo to the native build (Gradle plugin, CocoaPods pods).
|
|
9
|
+
- You want hot reload, JS source maps, and a single Metro instance to "just work" inside the existing build.
|
|
10
|
+
- You prefer one repository and one build pipeline over shipping a prebuilt artifact.
|
|
11
|
+
|
|
12
|
+
If the native team must not need Node, Yarn, or React Native tooling, use [./brownfield-isolated.md](./brownfield-isolated.md) instead.
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
- **Expo SDK 54 or later** — the `ExpoReactHostFactory`, `ExpoReactNativeFactory`, and `ApplicationLifecycleDispatcher` entry points used below require SDK 54+. Earlier SDKs do not support this setup.
|
|
17
|
+
- **Node.js (LTS)** — runs JavaScript and the Expo CLI.
|
|
18
|
+
- **Yarn** — manages JavaScript dependencies.
|
|
19
|
+
- **CocoaPods** (iOS) — `sudo gem install cocoapods`.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 1) Create an Expo project
|
|
24
|
+
|
|
25
|
+
Create the Expo project inside (or alongside) the existing native project. **Pin to SDK 55 or later — earlier SDKs do not support brownfield integration:**
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npx create-expo-app@latest my-project --template default@sdk-55
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The new project ships a TypeScript example app. The JS entry point registers a root component under the name `"main"` — this name must match the `moduleName` referenced from the native side later.
|
|
32
|
+
|
|
33
|
+
## 2) Place native projects under the Expo project
|
|
34
|
+
|
|
35
|
+
A standard React Native project keeps native code under `android/` and `ios/`. Move the existing native projects in:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
mkdir my-project/android
|
|
39
|
+
mv /path/to/your/android-project my-project/android/
|
|
40
|
+
# repeat for ios/
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Monorepo alternative
|
|
44
|
+
|
|
45
|
+
If the native projects cannot be moved, set up a monorepo with the Expo project as a workspace. Create a root `package.json`:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"version": "1.0.0",
|
|
50
|
+
"private": true,
|
|
51
|
+
"workspaces": ["my-project"]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Run `yarn install` at the root. This installs `node_modules` at the workspace root so Gradle and CocoaPods scripts can resolve React Native and Expo dependencies.
|
|
56
|
+
|
|
57
|
+
> **Monorepo callout:** with a monorepo, the Expo project is not at `../../` from the native projects. You must set `projectRoot` explicitly in Gradle and pass the project root to CocoaPods so autolinking can find the Expo project.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 3) Configure Android
|
|
62
|
+
|
|
63
|
+
### `settings.gradle`
|
|
64
|
+
|
|
65
|
+
Register the React Native Gradle plugin and Expo autolinking. Reference: [bare-minimum template `settings.gradle`](https://github.com/expo/expo/blob/main/templates/expo-template-bare-minimum/android/settings.gradle).
|
|
66
|
+
|
|
67
|
+
```groovy
|
|
68
|
+
pluginManagement {
|
|
69
|
+
def reactNativeGradlePlugin = new File(
|
|
70
|
+
providers.exec {
|
|
71
|
+
workingDir(rootDir)
|
|
72
|
+
commandLine("node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })")
|
|
73
|
+
}.standardOutput.asText.get().trim()
|
|
74
|
+
).getParentFile().absolutePath
|
|
75
|
+
includeBuild(reactNativeGradlePlugin)
|
|
76
|
+
|
|
77
|
+
def expoPluginsPath = new File(
|
|
78
|
+
providers.exec {
|
|
79
|
+
workingDir(rootDir)
|
|
80
|
+
commandLine("node", "--print", "require.resolve('expo-modules-autolinking/package.json', { paths: [require.resolve('expo/package.json')] })")
|
|
81
|
+
}.standardOutput.asText.get().trim(),
|
|
82
|
+
"../android/expo-gradle-plugin"
|
|
83
|
+
).absolutePath
|
|
84
|
+
includeBuild(expoPluginsPath)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
plugins {
|
|
88
|
+
id("com.facebook.react.settings")
|
|
89
|
+
id("expo-autolinking-settings")
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
|
|
93
|
+
ex.autolinkLibrariesFromCommand(expoAutolinking.rnConfigCommand)
|
|
94
|
+
}
|
|
95
|
+
expoAutolinking.useExpoModules()
|
|
96
|
+
expoAutolinking.useExpoVersionCatalog()
|
|
97
|
+
includeBuild(expoAutolinking.reactNativeGradlePlugin)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
> **Monorepo:** add an explicit project root before `expoAutolinking.useExpoModules()` so autolinking finds your Expo project's `node_modules`.
|
|
101
|
+
|
|
102
|
+
### Top-level `build.gradle`
|
|
103
|
+
|
|
104
|
+
Add the React Native Gradle plugin classpath and the Expo root-project plugin:
|
|
105
|
+
|
|
106
|
+
```groovy
|
|
107
|
+
buildscript {
|
|
108
|
+
repositories {
|
|
109
|
+
google()
|
|
110
|
+
mavenCentral()
|
|
111
|
+
}
|
|
112
|
+
dependencies {
|
|
113
|
+
classpath('com.android.tools.build:gradle')
|
|
114
|
+
classpath('com.facebook.react:react-native-gradle-plugin')
|
|
115
|
+
classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
allprojects {
|
|
120
|
+
repositories {
|
|
121
|
+
google()
|
|
122
|
+
mavenCentral()
|
|
123
|
+
maven { url 'https://www.jitpack.io' }
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
apply plugin: "expo-root-project"
|
|
128
|
+
apply plugin: "com.facebook.react.rootproject"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### `app/build.gradle`
|
|
132
|
+
|
|
133
|
+
Apply the React Native plugin and configure the `react { ... }` block. The full template is at [bare-minimum `app/build.gradle`](https://github.com/expo/expo/blob/main/templates/expo-template-bare-minimum/android/app/build.gradle); the minimum that must change in your existing module:
|
|
134
|
+
|
|
135
|
+
```groovy
|
|
136
|
+
apply plugin: "com.android.application"
|
|
137
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
138
|
+
apply plugin: "com.facebook.react"
|
|
139
|
+
|
|
140
|
+
def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
|
|
141
|
+
|
|
142
|
+
react {
|
|
143
|
+
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
|
|
144
|
+
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
|
|
145
|
+
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
|
|
146
|
+
cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
|
|
147
|
+
bundleCommand = "export:embed"
|
|
148
|
+
autolinkLibrariesWithApp()
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
> **Monorepo:** set `root = file("../../")` (or wherever your Expo project lives) inside the `react { ... }` block.
|
|
153
|
+
|
|
154
|
+
### `gradle.properties`
|
|
155
|
+
|
|
156
|
+
```properties
|
|
157
|
+
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
|
|
158
|
+
newArchEnabled=true
|
|
159
|
+
hermesEnabled=true
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`newArchEnabled` and `hermesEnabled` must match across all sub-modules in your build.
|
|
163
|
+
|
|
164
|
+
### `AndroidManifest.xml`
|
|
165
|
+
|
|
166
|
+
Add the `INTERNET` permission to your main manifest at `app/src/main/AndroidManifest.xml`:
|
|
167
|
+
|
|
168
|
+
```xml
|
|
169
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
In the debug-variant manifest at `app/src/debug/AndroidManifest.xml`, enable cleartext traffic so the app can talk to the local Metro bundler over HTTP:
|
|
173
|
+
|
|
174
|
+
```xml
|
|
175
|
+
<application
|
|
176
|
+
android:usesCleartextTraffic="true"
|
|
177
|
+
tools:targetApi="28"
|
|
178
|
+
tools:ignore="GoogleAppIndexingWarning">
|
|
179
|
+
...
|
|
180
|
+
</application>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### `MainApplication.kt`
|
|
184
|
+
|
|
185
|
+
Initialize React Native and Expo lifecycle dispatch in your `Application` class:
|
|
186
|
+
|
|
187
|
+
```kotlin
|
|
188
|
+
package com.example.myapp
|
|
189
|
+
|
|
190
|
+
import android.app.Application
|
|
191
|
+
import android.content.res.Configuration
|
|
192
|
+
|
|
193
|
+
import com.facebook.react.PackageList
|
|
194
|
+
import com.facebook.react.ReactApplication
|
|
195
|
+
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
|
|
196
|
+
import com.facebook.react.ReactHost
|
|
197
|
+
import com.facebook.react.common.ReleaseLevel
|
|
198
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
|
|
199
|
+
|
|
200
|
+
import expo.modules.ApplicationLifecycleDispatcher
|
|
201
|
+
import expo.modules.ExpoReactHostFactory
|
|
202
|
+
|
|
203
|
+
class MainApplication : Application(), ReactApplication {
|
|
204
|
+
|
|
205
|
+
override val reactHost: ReactHost by lazy {
|
|
206
|
+
ExpoReactHostFactory.getDefaultReactHost(
|
|
207
|
+
context = applicationContext,
|
|
208
|
+
packageList = PackageList(this).packages
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
override fun onCreate() {
|
|
213
|
+
super.onCreate()
|
|
214
|
+
DefaultNewArchitectureEntryPoint.releaseLevel = try {
|
|
215
|
+
ReleaseLevel.valueOf(BuildConfig.REACT_NATIVE_RELEASE_LEVEL.uppercase())
|
|
216
|
+
} catch (_: IllegalArgumentException) {
|
|
217
|
+
ReleaseLevel.STABLE
|
|
218
|
+
}
|
|
219
|
+
loadReactNative(this)
|
|
220
|
+
ApplicationLifecycleDispatcher.onApplicationCreate(this)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
override fun onConfigurationChanged(newConfig: Configuration) {
|
|
224
|
+
super.onConfigurationChanged(newConfig)
|
|
225
|
+
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### `ReactActivity`
|
|
231
|
+
|
|
232
|
+
Create an `Activity` that hosts a React Native screen. The `moduleName` returned by `getMainComponentName()` must match the name registered via `AppRegistry.registerComponent(...)` in your JS entry point (`"main"` for the default template).
|
|
233
|
+
|
|
234
|
+
```kotlin
|
|
235
|
+
package com.example.myapp
|
|
236
|
+
|
|
237
|
+
import com.facebook.react.ReactActivity
|
|
238
|
+
import com.facebook.react.ReactActivityDelegate
|
|
239
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
|
240
|
+
import com.facebook.react.defaults.DefaultReactActivityDelegate
|
|
241
|
+
|
|
242
|
+
import expo.modules.ReactActivityDelegateWrapper
|
|
243
|
+
|
|
244
|
+
class MyReactActivity : ReactActivity() {
|
|
245
|
+
|
|
246
|
+
override fun getMainComponentName(): String = "main"
|
|
247
|
+
|
|
248
|
+
override fun createReactActivityDelegate(): ReactActivityDelegate {
|
|
249
|
+
return ReactActivityDelegateWrapper(
|
|
250
|
+
this,
|
|
251
|
+
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
|
|
252
|
+
object : DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) {}
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Register the activity in `AndroidManifest.xml` with a non-ActionBar theme:
|
|
259
|
+
|
|
260
|
+
```xml
|
|
261
|
+
<activity
|
|
262
|
+
android:name=".MyReactActivity"
|
|
263
|
+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
|
264
|
+
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
|
|
265
|
+
/>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Launch it from existing native code:
|
|
269
|
+
|
|
270
|
+
```kotlin
|
|
271
|
+
startActivity(Intent(this, MyReactActivity::class.java))
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## 4) Configure iOS
|
|
277
|
+
|
|
278
|
+
The integrated approach drives iOS through CocoaPods + Expo modules autolinking, exactly like a fresh Expo project. The key difference is that you are integrating into your existing Xcode project rather than starting from the template.
|
|
279
|
+
|
|
280
|
+
### `ios/Podfile`
|
|
281
|
+
|
|
282
|
+
Create (or update) `ios/Podfile` based on the [bare-minimum Podfile](https://github.com/expo/expo/blob/main/templates/expo-template-bare-minimum/ios/Podfile). The essential lines:
|
|
283
|
+
|
|
284
|
+
```ruby
|
|
285
|
+
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
|
|
286
|
+
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
|
|
287
|
+
|
|
288
|
+
require 'json'
|
|
289
|
+
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
|
|
290
|
+
|
|
291
|
+
platform :ios, podfile_properties['ios.deploymentTarget'] || '16.4'
|
|
292
|
+
|
|
293
|
+
prepare_react_native_project!
|
|
294
|
+
|
|
295
|
+
target 'MyApp' do
|
|
296
|
+
use_expo_modules!
|
|
297
|
+
|
|
298
|
+
config_command = [
|
|
299
|
+
'node',
|
|
300
|
+
'--no-warnings',
|
|
301
|
+
'--eval',
|
|
302
|
+
'require(\'expo/bin/autolinking\')',
|
|
303
|
+
'expo-modules-autolinking',
|
|
304
|
+
'react-native-config',
|
|
305
|
+
'--json',
|
|
306
|
+
'--platform',
|
|
307
|
+
'ios'
|
|
308
|
+
]
|
|
309
|
+
|
|
310
|
+
config = use_native_modules!(config_command)
|
|
311
|
+
|
|
312
|
+
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
313
|
+
|
|
314
|
+
use_react_native!(
|
|
315
|
+
:path => config[:reactNativePath],
|
|
316
|
+
:hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
|
|
317
|
+
:app_path => "#{Pod::Config.instance.installation_root}/..",
|
|
318
|
+
:privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false',
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
post_install do |installer|
|
|
322
|
+
react_native_post_install(installer, config[:reactNativePath], :mac_catalyst_enabled => false)
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Replace `'MyApp'` with the existing Xcode target name. The `:app_path` value tells `use_react_native!` where the JS app lives — set it to the absolute path of your Expo project root if you are in a monorepo.
|
|
328
|
+
|
|
329
|
+
Create `ios/Podfile.properties.json` alongside the Podfile (defaults are fine):
|
|
330
|
+
|
|
331
|
+
```json
|
|
332
|
+
{
|
|
333
|
+
"expo.jsEngine": "hermes",
|
|
334
|
+
"EX_DEV_CLIENT_NETWORK_INSPECTOR": "true"
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Install pods:
|
|
339
|
+
|
|
340
|
+
```sh
|
|
341
|
+
cd ios && pod install
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Open the generated `.xcworkspace` (not the `.xcodeproj`) from now on.
|
|
345
|
+
|
|
346
|
+
### Xcode project changes
|
|
347
|
+
|
|
348
|
+
Three Xcode-side adjustments are required before the app can build and run a React Native screen. Skip any one and either CocoaPods scripts fail under sandboxing, the JS bundle never lands in the IPA (release crashes looking for `main.jsbundle`), or the status bar fights React Native at runtime.
|
|
349
|
+
|
|
350
|
+
#### 1. Disable user script sandboxing
|
|
351
|
+
|
|
352
|
+
In Xcode, select your project → app target → **Build Settings**, search for `ENABLE_USER_SCRIPT_SANDBOXING`, and set it to **No**. CocoaPods' Hermes scripts need to switch between debug and release engine binaries at build time, which sandboxing blocks.
|
|
353
|
+
|
|
354
|
+
#### 2. Add a Run Script phase to embed the JS bundle
|
|
355
|
+
|
|
356
|
+
On the app target's **Build Phases** tab, add a new **Run Script** phase **before** `[CP] Embed Pods Frameworks`. This phase bundles JS for release builds and is skipped automatically in debug (Metro serves the bundle then).
|
|
357
|
+
|
|
358
|
+
```sh
|
|
359
|
+
if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then
|
|
360
|
+
source "$PODS_ROOT/../.xcode.env"
|
|
361
|
+
fi
|
|
362
|
+
if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
|
|
363
|
+
source "$PODS_ROOT/../.xcode.env.local"
|
|
364
|
+
fi
|
|
365
|
+
|
|
366
|
+
export PROJECT_ROOT="$PROJECT_DIR"/..
|
|
367
|
+
|
|
368
|
+
if [[ "$CONFIGURATION" = *Debug* ]]; then
|
|
369
|
+
export SKIP_BUNDLING=1
|
|
370
|
+
fi
|
|
371
|
+
if [[ -z "$ENTRY_FILE" ]]; then
|
|
372
|
+
export ENTRY_FILE="$("$NODE_BINARY" -e "require('expo/scripts/resolveAppEntry')" "$PROJECT_ROOT" ios absolute | tail -n 1)"
|
|
373
|
+
fi
|
|
374
|
+
if [[ -z "$CLI_PATH" ]]; then
|
|
375
|
+
export CLI_PATH="$("$NODE_BINARY" --print "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })")"
|
|
376
|
+
fi
|
|
377
|
+
if [[ -z "$BUNDLE_COMMAND" ]]; then
|
|
378
|
+
export BUNDLE_COMMAND="export:embed"
|
|
379
|
+
fi
|
|
380
|
+
|
|
381
|
+
if [[ -f "$PODS_ROOT/../.xcode.env.updates" ]]; then
|
|
382
|
+
source "$PODS_ROOT/../.xcode.env.updates"
|
|
383
|
+
fi
|
|
384
|
+
if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
|
|
385
|
+
source "$PODS_ROOT/../.xcode.env.local"
|
|
386
|
+
fi
|
|
387
|
+
|
|
388
|
+
`"$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'"`
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
> **Monorepo:** override `PROJECT_ROOT` to point at the Expo project (e.g. `export PROJECT_ROOT="$PROJECT_DIR"/../../my-project`). Without this, bundling looks for `node_modules` in the wrong directory.
|
|
392
|
+
|
|
393
|
+
This script writes `main.jsbundle` into the app's resources directory in release configurations. Without it, the `bundleURL()` fallback in `ReactNativeDelegate` resolves to `nil` and the React Native screen fails to load whenever Metro is not running.
|
|
394
|
+
|
|
395
|
+
#### 3. Update `Info.plist`
|
|
396
|
+
|
|
397
|
+
Set `UIViewControllerBasedStatusBarAppearance` to `NO` so React Native can manage the status bar:
|
|
398
|
+
|
|
399
|
+
```xml
|
|
400
|
+
<key>UIViewControllerBasedStatusBarAppearance</key>
|
|
401
|
+
<false/>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### `AppDelegate.swift`
|
|
405
|
+
|
|
406
|
+
Wire React Native into the app delegate via Expo's `ExpoReactNativeFactory`. The delegate's `bundleURL()` selects the Metro dev server in `DEBUG` and the embedded bundle in release.
|
|
407
|
+
|
|
408
|
+
```swift
|
|
409
|
+
internal import Expo
|
|
410
|
+
import React
|
|
411
|
+
import ReactAppDependencyProvider
|
|
412
|
+
|
|
413
|
+
@main
|
|
414
|
+
class AppDelegate: ExpoAppDelegate {
|
|
415
|
+
var window: UIWindow?
|
|
416
|
+
|
|
417
|
+
var reactNativeDelegate: ExpoReactNativeFactoryDelegate?
|
|
418
|
+
var reactNativeFactory: RCTReactNativeFactory?
|
|
419
|
+
|
|
420
|
+
public override func application(
|
|
421
|
+
_ application: UIApplication,
|
|
422
|
+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
|
423
|
+
) -> Bool {
|
|
424
|
+
let delegate = ReactNativeDelegate()
|
|
425
|
+
let factory = ExpoReactNativeFactory(delegate: delegate)
|
|
426
|
+
delegate.dependencyProvider = RCTAppDependencyProvider()
|
|
427
|
+
|
|
428
|
+
reactNativeDelegate = delegate
|
|
429
|
+
reactNativeFactory = factory
|
|
430
|
+
|
|
431
|
+
window = UIWindow(frame: UIScreen.main.bounds)
|
|
432
|
+
factory.startReactNative(
|
|
433
|
+
withModuleName: "main",
|
|
434
|
+
in: window,
|
|
435
|
+
launchOptions: launchOptions
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
class ReactNativeDelegate: ExpoReactNativeFactoryDelegate {
|
|
443
|
+
override func sourceURL(for bridge: RCTBridge) -> URL? {
|
|
444
|
+
bridge.bundleURL ?? bundleURL()
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
override func bundleURL() -> URL? {
|
|
448
|
+
#if DEBUG
|
|
449
|
+
return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: ".expo/.virtual-metro-entry")
|
|
450
|
+
#else
|
|
451
|
+
return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
|
|
452
|
+
#endif
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
The module name `"main"` must match what the JS side registers with `AppRegistry.registerComponent("main", () => App)`.
|
|
458
|
+
|
|
459
|
+
### Embedding RN inside an existing screen (not the root window)
|
|
460
|
+
|
|
461
|
+
If you do not want React Native to take over the whole window, instantiate the factory the same way but mount the produced root view inside an existing `UIViewController`:
|
|
462
|
+
|
|
463
|
+
```swift
|
|
464
|
+
import UIKit
|
|
465
|
+
import React
|
|
466
|
+
import Expo
|
|
467
|
+
|
|
468
|
+
class ReactNativeScreenViewController: UIViewController {
|
|
469
|
+
private var reactNativeDelegate: ExpoReactNativeFactoryDelegate?
|
|
470
|
+
private var reactNativeFactory: RCTReactNativeFactory?
|
|
471
|
+
|
|
472
|
+
override func viewDidLoad() {
|
|
473
|
+
super.viewDidLoad()
|
|
474
|
+
|
|
475
|
+
let delegate = ReactNativeDelegate()
|
|
476
|
+
let factory = ExpoReactNativeFactory(delegate: delegate)
|
|
477
|
+
delegate.dependencyProvider = RCTAppDependencyProvider()
|
|
478
|
+
self.reactNativeDelegate = delegate
|
|
479
|
+
self.reactNativeFactory = factory
|
|
480
|
+
|
|
481
|
+
let rootView = factory.rootViewFactory.view(
|
|
482
|
+
withModuleName: "main",
|
|
483
|
+
initialProperties: nil,
|
|
484
|
+
launchOptions: nil
|
|
485
|
+
)
|
|
486
|
+
rootView.frame = view.bounds
|
|
487
|
+
rootView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
488
|
+
view.addSubview(rootView)
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
Present it like any other view controller:
|
|
494
|
+
|
|
495
|
+
```swift
|
|
496
|
+
navigationController?.pushViewController(ReactNativeScreenViewController(), animated: true)
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
> **Monorepo iOS:** `pod install` is run from `ios/`, but Node module resolution starts from the Expo project root. Pass `EXPO_PROJECT_ROOT=/absolute/path/to/expo-project` to the `pod install` invocation if autolinking cannot find the Expo project automatically.
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
## 5) Test the integration
|
|
504
|
+
|
|
505
|
+
Start Metro from the Expo project (or `yarn start` from the monorepo root):
|
|
506
|
+
|
|
507
|
+
```sh
|
|
508
|
+
yarn start
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
Build and run the native app normally (Android Studio / Xcode). Navigate to your React Native–powered Activity or screen — it loads JS from the Metro dev server with hot reloading.
|
|
512
|
+
|
|
513
|
+
### Development vs. production
|
|
514
|
+
|
|
515
|
+
- **Development** — Metro serves the JS bundle with hot reloading over HTTP. Debug builds use the Metro URL via `RCTBundleURLProvider` (iOS) or the dev server detection in `ReactActivity` (Android).
|
|
516
|
+
- **Production** — Metro is not used. Run `expo export:embed` (invoked automatically by the React Native Gradle plugin and the iOS build phase) to embed the bundle into the APK/IPA.
|
|
517
|
+
|
|
518
|
+
For Metro connection issues, build failures, missing modules, or arch mismatches, see [./troubleshooting.md](./troubleshooting.md).
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
## Related references
|
|
523
|
+
|
|
524
|
+
- [./brownfield-isolated.md](./brownfield-isolated.md) — Alternative: ship RN as a prebuilt AAR/XCFramework.
|
|
525
|
+
- [./comparison.md](./comparison.md) — Decide between isolated and integrated.
|
|
526
|
+
- [./troubleshooting.md](./troubleshooting.md) — Common Metro, build, and integration issues.
|