Skip to content

Commit 2246e2b

Browse files
cortinicofacebook-github-bot
authored andcommitted
Fix wrong default for jsBundleAssetPath on DefaultReactHost (#53546)
Summary: Pull Request resolved: #53546 The default for `DefaultReactHost.getDefaultReactHost(...,jsBundleAssetPath,...)` is wrong. The default should be `index.android.bundle`. That's the same value we had for the same field in ReactNativeHost: https://www.internalfb.com/code/fbsource/[76a814c7d27036f7056c9f2c7e1370746ed4ccd4]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java?lines=225-227 Having just `index` as default cause the app to instacrash on release because the bundle can't be found. Reviewed By: fabriziocucci Differential Revision: D81435921 fbshipit-source-id: ea871f771fd61e9d838a800e988f2edc308ec8ea
1 parent 529fd97 commit 2246e2b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public object DefaultReactHost {
4444
* @param jsMainModulePath the path to your app's main module on Metro. Usually `index` or
4545
* `index.<platform>`
4646
* @param jsBundleAssetPath the path to the JS bundle relative to the assets directory. Will be
47-
* composed in a `asset://...` URL
47+
* composed in a `asset://...` URL. Usually `index.android.bundle`.
4848
* @param jsBundleFilePath the path to the JS bundle on the filesystem. Will be composed in a
4949
* `file://...` URL
5050
* @param jsRuntimeFactory the JS engine to use for executing [ReactHost], default to Hermes.
@@ -63,7 +63,7 @@ public object DefaultReactHost {
6363
context: Context,
6464
packageList: List<ReactPackage>,
6565
jsMainModulePath: String = "index",
66-
jsBundleAssetPath: String = "index",
66+
jsBundleAssetPath: String = "index.android.bundle",
6767
jsBundleFilePath: String? = null,
6868
jsRuntimeFactory: JSRuntimeFactory? = null,
6969
useDevSupport: Boolean = ReactBuildConfig.DEBUG,

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected constructor(
122122
context,
123123
packages,
124124
jsMainModuleName,
125-
bundleAssetName ?: "index",
125+
bundleAssetName ?: "index.android.bundle",
126126
jsBundleFile,
127127
concreteJSRuntimeFactory,
128128
useDeveloperSupport,

0 commit comments

Comments
 (0)