From 18319645c171b3897be6647f2327bdb4674b6830 Mon Sep 17 00:00:00 2001 From: Marcin Szalski Date: Thu, 7 May 2026 16:38:55 +0200 Subject: [PATCH 1/2] fix: make sure android libs are loaded for expo apps --- .changeset/five-signs-fix.md | 7 + .../android/BrownfieldLib/consumer-rules.pro | 0 packages/brownfield-navigation/package.json | 4 +- packages/brownie/package.json | 6 +- .../ReactNativeBrownfield.kt | 42 +++- packages/react-native-brownfield/package.json | 4 +- .../android/ReactNativeHostManager.post55.kt | 5 +- .../android/ReactNativeHostManager.pre55.kt | 6 +- yarn.lock | 207 ++++-------------- 9 files changed, 83 insertions(+), 198 deletions(-) create mode 100644 .changeset/five-signs-fix.md create mode 100644 apps/RNApp/android/BrownfieldLib/consumer-rules.pro diff --git a/.changeset/five-signs-fix.md b/.changeset/five-signs-fix.md new file mode 100644 index 00000000..cccfbd79 --- /dev/null +++ b/.changeset/five-signs-fix.md @@ -0,0 +1,7 @@ +--- +'@callstack/react-native-brownfield': patch +'@callstack/brownfield-navigation': patch +'@callstack/brownie': patch +--- + +fix: make sure android libs are loaded for expo apps diff --git a/apps/RNApp/android/BrownfieldLib/consumer-rules.pro b/apps/RNApp/android/BrownfieldLib/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/packages/brownfield-navigation/package.json b/packages/brownfield-navigation/package.json index a964c0b0..156d6782 100644 --- a/packages/brownfield-navigation/package.json +++ b/packages/brownfield-navigation/package.json @@ -66,7 +66,7 @@ "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.3", "@babel/runtime": "^7.25.0", - "@react-native/babel-preset": "0.82.1", + "@react-native/babel-preset": "0.83.2", "@types/jest": "^30.0.0", "@types/react": "^19.1.1", "eslint": "^9.28.0", @@ -74,7 +74,7 @@ "import": "^0.0.6", "nodemon": "^3.1.14", "react": "19.1.1", - "react-native": "0.82.1", + "react-native": "0.83.2", "react-native-builder-bob": "^0.41.0", "typescript": "5.9.3" }, diff --git a/packages/brownie/package.json b/packages/brownie/package.json index b44f0100..11b96694 100644 --- a/packages/brownie/package.json +++ b/packages/brownie/package.json @@ -84,15 +84,15 @@ "@babel/preset-env": "^7.25.3", "@babel/preset-typescript": "^7.27.1", "@babel/runtime": "^7.25.0", - "@react-native/babel-preset": "0.82.1", - "@react-native/eslint-config": "0.82.1", + "@react-native/babel-preset": "0.83.2", + "@react-native/eslint-config": "0.83.2", "@types/node": "^25.5.0", "@types/react": "^19.1.1", "eslint": "^9.39.3", "globals": "^17.3.0", "import": "^0.0.6", "nodemon": "^3.1.14", - "react-native": "0.82.1", + "react-native": "0.83.2", "react-native-builder-bob": "^0.41.0", "typescript": "5.9.3" }, diff --git a/packages/react-native-brownfield/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt b/packages/react-native-brownfield/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt index fc9349af..2d3aedb5 100644 --- a/packages/react-native-brownfield/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt +++ b/packages/react-native-brownfield/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt @@ -34,7 +34,6 @@ class ReactNativeBrownfield private constructor(val reactHost: ReactHost) { private lateinit var instance: ReactNativeBrownfield private val initialized = AtomicBoolean() private val nativeLibsLoaded = AtomicBoolean() - private const val LOG_TAG = "ReactNativeBrownfield" @JvmStatic val shared: ReactNativeBrownfield get() = instance @@ -50,6 +49,12 @@ class ReactNativeBrownfield private constructor(val reactHost: ReactHost) { load() } + @Deprecated( + message = "Unsafe when reactHost construction triggers SoLoader (e.g. ExpoReactHostFactory): " + + "the parameter is evaluated by the caller before loadNativeLibs() runs. " + + "Use initialize(application, onJSBundleLoaded) { reactHostFactory } instead.", + replaceWith = ReplaceWith("initialize(application, onJSBundleLoaded) { reactHost }") + ) @JvmStatic @JvmOverloads fun initialize( @@ -59,14 +64,22 @@ class ReactNativeBrownfield private constructor(val reactHost: ReactHost) { ) { if (!initialized.getAndSet(true)) { loadNativeLibs(application) - instance = ReactNativeBrownfield(reactHost) - - preloadReactNative { - onJSBundleLoaded?.invoke(true) - } + installAndPreload(reactHost, onJSBundleLoaded) } } + @JvmStatic + fun initialize( + application: Application, + onJSBundleLoaded: OnJSBundleLoaded? = null, + reactHostFactory: () -> ReactHost + ) { + if (!initialized.getAndSet(true)) { + loadNativeLibs(application) + installAndPreload(reactHostFactory(), onJSBundleLoaded) + } + } + @JvmStatic @JvmOverloads fun initialize( @@ -74,10 +87,9 @@ class ReactNativeBrownfield private constructor(val reactHost: ReactHost) { options: HashMap, onJSBundleLoaded: OnJSBundleLoaded? = null ) { - loadNativeLibs(application) - - val reactHost: ReactHost by lazy { - getDefaultReactHost( + if (!initialized.getAndSet(true)) { + loadNativeLibs(application) + val reactHost = getDefaultReactHost( context = application, packageList = (options["packages"] as? List<*> ?: emptyList()) .filterIsInstance(), @@ -89,9 +101,8 @@ class ReactNativeBrownfield private constructor(val reactHost: ReactHost) { ?: ReactBuildConfig.DEBUG, jsRuntimeFactory = null ) + installAndPreload(reactHost, onJSBundleLoaded) } - - initialize(application, reactHost, onJSBundleLoaded) } @JvmStatic @@ -116,6 +127,13 @@ class ReactNativeBrownfield private constructor(val reactHost: ReactHost) { }) shared.reactHost.start() } + + private fun installAndPreload(reactHost: ReactHost, onJSBundleLoaded: OnJSBundleLoaded?) { + instance = ReactNativeBrownfield(reactHost) + preloadReactNative { + onJSBundleLoaded?.invoke(true) + } + } } /** diff --git a/packages/react-native-brownfield/package.json b/packages/react-native-brownfield/package.json index 0bdafe04..b49bd635 100644 --- a/packages/react-native-brownfield/package.json +++ b/packages/react-native-brownfield/package.json @@ -93,7 +93,7 @@ "@babel/preset-env": "^7.25.3", "@babel/runtime": "^7.25.0", "@expo/config-plugins": "^54.0.4", - "@react-native/babel-preset": "0.82.1", + "@react-native/babel-preset": "0.83.2", "@types/jest": "^30.0.0", "@types/react": "^19.1.1", "@vitest/coverage-v8": "^4.1.0", @@ -102,7 +102,7 @@ "import": "^0.0.6", "nodemon": "^3.1.14", "react": "19.1.1", - "react-native": "0.82.1", + "react-native": "0.83.2", "react-native-builder-bob": "^0.41.0", "typescript": "5.9.3", "vitest": "^4.1.4" diff --git a/packages/react-native-brownfield/src/expo-config-plugin/template/android/ReactNativeHostManager.post55.kt b/packages/react-native-brownfield/src/expo-config-plugin/template/android/ReactNativeHostManager.post55.kt index 57f628ba..aa87d6df 100644 --- a/packages/react-native-brownfield/src/expo-config-plugin/template/android/ReactNativeHostManager.post55.kt +++ b/packages/react-native-brownfield/src/expo-config-plugin/template/android/ReactNativeHostManager.post55.kt @@ -5,7 +5,6 @@ import android.content.res.Configuration import com.callstack.reactnativebrownfield.OnJSBundleLoaded import com.callstack.reactnativebrownfield.ReactNativeBrownfield import com.facebook.react.PackageList -import com.facebook.react.ReactHost import expo.modules.ApplicationLifecycleDispatcher import expo.modules.ExpoReactHostFactory @@ -13,14 +12,12 @@ object ReactNativeHostManager { fun initialize(application: Application, onJSBundleLoaded: OnJSBundleLoaded? = null) { ApplicationLifecycleDispatcher.onApplicationCreate(application) - val reactHost: ReactHost by lazy { + ReactNativeBrownfield.initialize(application, onJSBundleLoaded) { ExpoReactHostFactory.getDefaultReactHost( context = application.applicationContext, packageList = PackageList(application).packages, ) } - - ReactNativeBrownfield.initialize(application, reactHost, onJSBundleLoaded) } fun onConfigurationChanged(application: Application, newConfig: Configuration) { diff --git a/packages/react-native-brownfield/src/expo-config-plugin/template/android/ReactNativeHostManager.pre55.kt b/packages/react-native-brownfield/src/expo-config-plugin/template/android/ReactNativeHostManager.pre55.kt index c577aa09..0c6fed70 100644 --- a/packages/react-native-brownfield/src/expo-config-plugin/template/android/ReactNativeHostManager.pre55.kt +++ b/packages/react-native-brownfield/src/expo-config-plugin/template/android/ReactNativeHostManager.pre55.kt @@ -5,7 +5,6 @@ import android.content.res.Configuration import com.callstack.reactnativebrownfield.OnJSBundleLoaded import com.callstack.reactnativebrownfield.ReactNativeBrownfield import com.facebook.react.PackageList -import com.facebook.react.ReactHost import com.facebook.react.ReactPackage import com.facebook.react.defaults.DefaultReactNativeHost import expo.modules.ApplicationLifecycleDispatcher @@ -34,15 +33,12 @@ object ReactNativeHostManager { override fun getBundleAssetName(): String = "index.android.bundle" }) - - val reactHost: ReactHost by lazy { + ReactNativeBrownfield.initialize(application, onJSBundleLoaded) { ExpoReactHostFactory.createFromReactNativeHost( context = application.applicationContext, reactNativeHost = reactNativeHost ) } - - ReactNativeBrownfield.initialize(application, reactHost, onJSBundleLoaded) } fun onConfigurationChanged(application: Application, newConfig: Configuration) { diff --git a/yarn.lock b/yarn.lock index f44718be..5e06a409 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1982,7 +1982,7 @@ __metadata: "@babel/preset-env": "npm:^7.25.3" "@babel/runtime": "npm:^7.25.0" "@callstack/brownfield-cli": "workspace:^" - "@react-native/babel-preset": "npm:0.82.1" + "@react-native/babel-preset": "npm:0.83.2" "@types/jest": "npm:^30.0.0" "@types/react": "npm:^19.1.1" eslint: "npm:^9.28.0" @@ -1990,7 +1990,7 @@ __metadata: import: "npm:^0.0.6" nodemon: "npm:^3.1.14" react: "npm:19.1.1" - react-native: "npm:0.82.1" + react-native: "npm:0.83.2" react-native-builder-bob: "npm:^0.41.0" typescript: "npm:5.9.3" peerDependencies: @@ -2010,15 +2010,15 @@ __metadata: "@babel/preset-typescript": "npm:^7.27.1" "@babel/runtime": "npm:^7.25.0" "@callstack/brownfield-cli": "workspace:^" - "@react-native/babel-preset": "npm:0.82.1" - "@react-native/eslint-config": "npm:0.82.1" + "@react-native/babel-preset": "npm:0.83.2" + "@react-native/eslint-config": "npm:0.83.2" "@types/node": "npm:^25.5.0" "@types/react": "npm:^19.1.1" eslint: "npm:^9.39.3" globals: "npm:^17.3.0" import: "npm:^0.0.6" nodemon: "npm:^3.1.14" - react-native: "npm:0.82.1" + react-native: "npm:0.83.2" react-native-builder-bob: "npm:^0.41.0" ts-morph: "npm:^27.0.2" typescript: "npm:5.9.3" @@ -2039,7 +2039,7 @@ __metadata: "@babel/runtime": "npm:^7.25.0" "@callstack/brownfield-cli": "workspace:^" "@expo/config-plugins": "npm:^54.0.4" - "@react-native/babel-preset": "npm:0.82.1" + "@react-native/babel-preset": "npm:0.83.2" "@types/jest": "npm:^30.0.0" "@types/react": "npm:^19.1.1" "@vitest/coverage-v8": "npm:^4.1.0" @@ -2048,7 +2048,7 @@ __metadata: import: "npm:^0.0.6" nodemon: "npm:^3.1.14" react: "npm:19.1.1" - react-native: "npm:0.82.1" + react-native: "npm:0.83.2" react-native-builder-bob: "npm:^0.41.0" typescript: "npm:5.9.3" vitest: "npm:^4.1.4" @@ -5130,13 +5130,6 @@ __metadata: languageName: node linkType: hard -"@react-native/assets-registry@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/assets-registry@npm:0.82.1" - checksum: 10/2c0880dd0923f6c876171783099c46daea5d2db1cffe4175b62f6988e50019c586b6ef477e41a2790529ca8ff351930b4f973b7ebfd1fb5593d155cd7f188acd - languageName: node - linkType: hard - "@react-native/assets-registry@npm:0.83.2": version: 0.83.2 resolution: "@react-native/assets-registry@npm:0.83.2" @@ -5490,29 +5483,6 @@ __metadata: languageName: node linkType: hard -"@react-native/community-cli-plugin@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/community-cli-plugin@npm:0.82.1" - dependencies: - "@react-native/dev-middleware": "npm:0.82.1" - debug: "npm:^4.4.0" - invariant: "npm:^2.2.4" - metro: "npm:^0.83.1" - metro-config: "npm:^0.83.1" - metro-core: "npm:^0.83.1" - semver: "npm:^7.1.3" - peerDependencies: - "@react-native-community/cli": "*" - "@react-native/metro-config": "*" - peerDependenciesMeta: - "@react-native-community/cli": - optional: true - "@react-native/metro-config": - optional: true - checksum: 10/f794e77eb4d745ce307f8c6a2bbea1a0e33b4b890586bfdbdd8f57139a6545327618f761edd0a6844d78b1984c5dca2181a8c717db616ec325872038165a73cc - languageName: node - linkType: hard - "@react-native/community-cli-plugin@npm:0.83.2": version: 0.83.2 resolution: "@react-native/community-cli-plugin@npm:0.83.2" @@ -5566,13 +5536,6 @@ __metadata: languageName: node linkType: hard -"@react-native/debugger-frontend@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/debugger-frontend@npm:0.82.1" - checksum: 10/8529451265cadb6418a5dd829bd08f0452d7da5a4698770dac9757bc2394a265a405a7c099ce628ad496e8668dd371a0bf30d7fd852383911f59ed927435d37b - languageName: node - linkType: hard - "@react-native/debugger-frontend@npm:0.83.2": version: 0.83.2 resolution: "@react-native/debugger-frontend@npm:0.83.2" @@ -5587,16 +5550,6 @@ __metadata: languageName: node linkType: hard -"@react-native/debugger-shell@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/debugger-shell@npm:0.82.1" - dependencies: - cross-spawn: "npm:^7.0.6" - fb-dotslash: "npm:0.5.8" - checksum: 10/4b84507dda0676e1a81b0016a25b4f0c54bb1008955e08c32cc7f40b8eec8d72f4a3941b957724db0c2e2bca3759498dec2e620d4b33e2b6488453b8a7b5cb59 - languageName: node - linkType: hard - "@react-native/debugger-shell@npm:0.83.2": version: 0.83.2 resolution: "@react-native/debugger-shell@npm:0.83.2" @@ -5637,26 +5590,6 @@ __metadata: languageName: node linkType: hard -"@react-native/dev-middleware@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/dev-middleware@npm:0.82.1" - dependencies: - "@isaacs/ttlcache": "npm:^1.4.1" - "@react-native/debugger-frontend": "npm:0.82.1" - "@react-native/debugger-shell": "npm:0.82.1" - chrome-launcher: "npm:^0.15.2" - chromium-edge-launcher: "npm:^0.2.0" - connect: "npm:^3.6.5" - debug: "npm:^4.4.0" - invariant: "npm:^2.2.4" - nullthrows: "npm:^1.1.1" - open: "npm:^7.0.3" - serve-static: "npm:^1.16.2" - ws: "npm:^6.2.3" - checksum: 10/124ac46440669c92d19457dd29319f00e1a9cd60e21942ae734b12a57a0efb76b02f291710af6cf06090674728f840485e05878c0ac4aabfd7088c0b624edf58 - languageName: node - linkType: hard - "@react-native/dev-middleware@npm:0.83.2": version: 0.83.2 resolution: "@react-native/dev-middleware@npm:0.83.2" @@ -5720,6 +5653,29 @@ __metadata: languageName: node linkType: hard +"@react-native/eslint-config@npm:0.83.2": + version: 0.83.2 + resolution: "@react-native/eslint-config@npm:0.83.2" + dependencies: + "@babel/core": "npm:^7.25.2" + "@babel/eslint-parser": "npm:^7.25.1" + "@react-native/eslint-plugin": "npm:0.83.2" + "@typescript-eslint/eslint-plugin": "npm:^8.36.0" + "@typescript-eslint/parser": "npm:^8.36.0" + eslint-config-prettier: "npm:^8.5.0" + eslint-plugin-eslint-comments: "npm:^3.2.0" + eslint-plugin-ft-flow: "npm:^2.0.1" + eslint-plugin-jest: "npm:^29.0.1" + eslint-plugin-react: "npm:^7.30.1" + eslint-plugin-react-hooks: "npm:^7.0.1" + eslint-plugin-react-native: "npm:^4.0.0" + peerDependencies: + eslint: ">=8" + prettier: ">=2" + checksum: 10/3f5e8545d5f573f8925fe326f09e67891eb40a5d087963bc39aebf3589107fee94c578c0b508d5506c5a3084c5adead118d4cbbcbfee39b8facbfa9fb33be1fc + languageName: node + linkType: hard + "@react-native/eslint-config@npm:0.85.0": version: 0.85.0 resolution: "@react-native/eslint-config@npm:0.85.0" @@ -5750,6 +5706,13 @@ __metadata: languageName: node linkType: hard +"@react-native/eslint-plugin@npm:0.83.2": + version: 0.83.2 + resolution: "@react-native/eslint-plugin@npm:0.83.2" + checksum: 10/9c3f1367f697a3721d21899d14011c8f0d20e09cd713ccf7a356c4c95b56c9bbbfa52e550224b4748b48529b0fe9e1044492441127489deb088e5f6d9062b957 + languageName: node + linkType: hard + "@react-native/eslint-plugin@npm:0.85.0": version: 0.85.0 resolution: "@react-native/eslint-plugin@npm:0.85.0" @@ -5764,13 +5727,6 @@ __metadata: languageName: node linkType: hard -"@react-native/gradle-plugin@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/gradle-plugin@npm:0.82.1" - checksum: 10/73d41bf3a3fb98edf407f520e12eb6c300bb6048b7e2637d61f21f1f36735e1f0b6e47ab5fa138bac02df2de2308911b01c625b82884d3323ef9ce1199670177 - languageName: node - linkType: hard - "@react-native/gradle-plugin@npm:0.83.2": version: 0.83.2 resolution: "@react-native/gradle-plugin@npm:0.83.2" @@ -5807,13 +5763,6 @@ __metadata: languageName: node linkType: hard -"@react-native/js-polyfills@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/js-polyfills@npm:0.82.1" - checksum: 10/66b6640c320dd91330ce125b569217b90b845ce81d39d539f1bd663600bdab8c6a6fe7731abff54ac4426bd685f6d24e950fcf499913f4d54338f6e270e14b0a - languageName: node - linkType: hard - "@react-native/js-polyfills@npm:0.83.2": version: 0.83.2 resolution: "@react-native/js-polyfills@npm:0.83.2" @@ -5861,13 +5810,6 @@ __metadata: languageName: node linkType: hard -"@react-native/normalize-colors@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/normalize-colors@npm:0.82.1" - checksum: 10/62f9ae165aeed20ad61c6a45472be8314a1e158fa5e6c6645f1332f5d72692e35cebba6b86fd3890ab4f29a7a71be731c46e208adea4965858612b1118645343 - languageName: node - linkType: hard - "@react-native/normalize-colors@npm:0.83.2": version: 0.83.2 resolution: "@react-native/normalize-colors@npm:0.83.2" @@ -5913,23 +5855,6 @@ __metadata: languageName: node linkType: hard -"@react-native/virtualized-lists@npm:0.82.1": - version: 0.82.1 - resolution: "@react-native/virtualized-lists@npm:0.82.1" - dependencies: - invariant: "npm:^2.2.4" - nullthrows: "npm:^1.1.1" - peerDependencies: - "@types/react": ^19.1.1 - react: "*" - react-native: "*" - peerDependenciesMeta: - "@types/react": - optional: true - checksum: 10/f613f7d1fea6382d70b6fbef66b37f2480d9a41b8d75f76b613a61e6af29f8aab10583914be2ad550722e32864978fc9150624d6b17f6e1823ca070d73d34936 - languageName: node - linkType: hard - "@react-native/virtualized-lists@npm:0.83.2": version: 0.83.2 resolution: "@react-native/virtualized-lists@npm:0.83.2" @@ -12318,13 +12243,6 @@ __metadata: languageName: node linkType: hard -"hermes-compiler@npm:0.0.0": - version: 0.0.0 - resolution: "hermes-compiler@npm:0.0.0" - checksum: 10/8b6fc8a64c2fa18c9aa6ddb8831c92253b6a2f10adf7d5d8f361b574f07e91b64f0c44b1370665075c33c17dd71c02fd19422124a3d2aa1717c37006ab12a1f0 - languageName: node - linkType: hard - "hermes-compiler@npm:0.14.1": version: 0.14.1 resolution: "hermes-compiler@npm:0.14.1" @@ -18424,57 +18342,6 @@ __metadata: languageName: node linkType: hard -"react-native@npm:0.82.1": - version: 0.82.1 - resolution: "react-native@npm:0.82.1" - dependencies: - "@jest/create-cache-key-function": "npm:^29.7.0" - "@react-native/assets-registry": "npm:0.82.1" - "@react-native/codegen": "npm:0.82.1" - "@react-native/community-cli-plugin": "npm:0.82.1" - "@react-native/gradle-plugin": "npm:0.82.1" - "@react-native/js-polyfills": "npm:0.82.1" - "@react-native/normalize-colors": "npm:0.82.1" - "@react-native/virtualized-lists": "npm:0.82.1" - abort-controller: "npm:^3.0.0" - anser: "npm:^1.4.9" - ansi-regex: "npm:^5.0.0" - babel-jest: "npm:^29.7.0" - babel-plugin-syntax-hermes-parser: "npm:0.32.0" - base64-js: "npm:^1.5.1" - commander: "npm:^12.0.0" - flow-enums-runtime: "npm:^0.0.6" - glob: "npm:^7.1.1" - hermes-compiler: "npm:0.0.0" - invariant: "npm:^2.2.4" - jest-environment-node: "npm:^29.7.0" - memoize-one: "npm:^5.0.0" - metro-runtime: "npm:^0.83.1" - metro-source-map: "npm:^0.83.1" - nullthrows: "npm:^1.1.1" - pretty-format: "npm:^29.7.0" - promise: "npm:^8.3.0" - react-devtools-core: "npm:^6.1.5" - react-refresh: "npm:^0.14.0" - regenerator-runtime: "npm:^0.13.2" - scheduler: "npm:0.26.0" - semver: "npm:^7.1.3" - stacktrace-parser: "npm:^0.1.10" - whatwg-fetch: "npm:^3.0.0" - ws: "npm:^6.2.3" - yargs: "npm:^17.6.2" - peerDependencies: - "@types/react": ^19.1.1 - react: ^19.1.1 - peerDependenciesMeta: - "@types/react": - optional: true - bin: - react-native: cli.js - checksum: 10/49a9173fc930cb151ec03e262a116e78e1059ee03c4215f28cf4bbd956af57b6efa688d6e518fc6825bd0516a8511ae41d84693b7bdd0a8b9095229f11e5e4d1 - languageName: node - linkType: hard - "react-native@npm:0.83.2": version: 0.83.2 resolution: "react-native@npm:0.83.2" From ec71389f661402192e1b38f112edba35331fa90d Mon Sep 17 00:00:00 2001 From: Marcin Szalski Date: Tue, 12 May 2026 16:43:52 +0200 Subject: [PATCH 2/2] docs: clean up chapter 4 and mention one ReactNativeBrownfield::initialize variant is deprecated --- docs/docs/docs/getting-started/android.mdx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/docs/docs/getting-started/android.mdx b/docs/docs/docs/getting-started/android.mdx index 97d458d9..dab37ac1 100644 --- a/docs/docs/docs/getting-started/android.mdx +++ b/docs/docs/docs/getting-started/android.mdx @@ -185,14 +185,17 @@ import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative object ReactNativeHostManager { fun initialize(application: Application, onJSBundleLoaded: OnJSBundleLoaded? = null) { - loadReactNative(application) // **Only required for RN >= 0.80.0** - val packageList = PackageList(application).packages ReactNativeBrownfield.initialize(application, packageList, onJSBundleLoaded) } } ``` +:::warning Important +The `ReactNativeBrownfield::initialize(Application, ReactHost, OnJSBundleLoaded? = null)` function variant is deprecated and shouldn't be used any more. It will be removed in a future release. +This version is unsafe because passing a pre-constructed `ReactHost` can trigger `SoLoader` (e.g., via `ExpoReactHostFactory`) before native libraries are fully loaded, leading to potential runtime crashes. +::: + ## 5. Add Build Config Fields Add to `reactnativeapp/build.gradle.kts`: