Skip to content

Commit 5aa5933

Browse files
authored
feat(android): allow bundle file path (#200)
* feat(android): allow bundle file path * fix: apply review
1 parent ae21134 commit 5aa5933

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/react-native-brownfield/android/src/main/java/com/callstack/reactnativebrownfield/ReactNativeBrownfield.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,16 @@ class ReactNativeBrownfield private constructor(val reactHost: ReactHost) {
7272
onJSBundleLoaded: OnJSBundleLoaded? = null
7373
) {
7474
val reactHost: ReactHost by lazy {
75+
val bundlePath = options["bundleAssetPath"] as? String ?: "index.android.bundle"
76+
val isFilePath = bundlePath.startsWith("/") || bundlePath.startsWith("file://") || bundlePath.startsWith("assets://")
77+
7578
getDefaultReactHost(
7679
context = application,
7780
packageList = (options["packages"] as? List<*> ?: emptyList<ReactPackage>())
7881
.filterIsInstance<ReactPackage>(),
7982
jsMainModulePath = options["mainModuleName"] as? String ?: "index",
80-
jsBundleAssetPath = options["bundleAssetPath"] as? String ?: "index.android.bundle",
83+
jsBundleAssetPath = bundlePath,
84+
jsBundleFilePath = if (isFilePath) bundlePath else null,
8185
useDevSupport = options["useDeveloperSupport"] as? Boolean
8286
?: ReactBuildConfig.DEBUG,
8387
jsRuntimeFactory = null

0 commit comments

Comments
 (0)