Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cool-parts-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@callstack/react-native-brownfield': minor
---

feat(android): allow bundle file path
3 changes: 2 additions & 1 deletion docs/docs/docs/api-reference/java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ A function used to initialize a React Native Brownfield singleton. Keep in mind
- `useDeveloperSupport`: `Boolean` - Flag to use dev support.
- `packages`: `List<ReactPackage>` - List of your React Native Native modules.
- `mainModuleName`: `String` - Path to react native entry file (when loading from Metro).
- `bundleAssetPath`: `String` - Path to react native bundle asset file (when loading from app assets), appended to `asset://`.
- `bundleAssetPath`: `String` - Path to react native bundle asset file (when loading from app assets), appended to `asset://`
- `bundleFilePath`: `String` - Optional, should start with `file://`, in which case the JS bundle will be loaded from a local file; alternatively, can start with `asset://`, in which case it is equivalent to `bundleAssetPath` passed the value without the `asset://` prefix. This value has precedence over `bundleAssetPath`, if passed.

**Examples:**

Expand Down
3 changes: 2 additions & 1 deletion docs/docs/docs/api-reference/kotlin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ A function used to initialize a React Native Brownfield singleton. Keep in mind
- `useDeveloperSupport`: `Boolean` - Flag to use dev support.
- `packages`: `List<ReactPackage>` - List of your React Native Native modules.
- `mainModuleName`: `String` - Path to react native entry file (when loading from Metro).
- `bundleAssetPath`: `String` - Path to react native bundle asset file (when loading from app assets), appended to `asset://`.
- `bundleAssetPath`: `String` - Path to react native bundle asset file (when loading from app assets), appended to `asset://`
- `bundleFilePath`: `String` - Optional, should start with `file://`, in which case the JS bundle will be loaded from a local file; alternatively, can start with `asset://`, in which case it is equivalent to `bundleAssetPath` passed the value without the `asset://` prefix. This value has precedence over `bundleAssetPath`, if passed.

**Examples:**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,13 @@ class ReactNativeBrownfield private constructor(val reactHost: ReactHost) {
onJSBundleLoaded: OnJSBundleLoaded? = null
) {
val reactHost: ReactHost by lazy {
val bundlePath = options["bundleAssetPath"] as? String ?: "index.android.bundle"
val isFilePath = bundlePath.startsWith("/") || bundlePath.startsWith("file://") || bundlePath.startsWith("assets://")

getDefaultReactHost(
context = application,
packageList = (options["packages"] as? List<*> ?: emptyList<ReactPackage>())
.filterIsInstance<ReactPackage>(),
jsMainModulePath = options["mainModuleName"] as? String ?: "index",
jsBundleAssetPath = bundlePath,
jsBundleFilePath = if (isFilePath) bundlePath else null,
jsBundleAssetPath = options["bundleAssetPath"] as? String ?: "index.android.bundle",
jsBundleFilePath = options["bundleFilePath"] as? String,
useDevSupport = options["useDeveloperSupport"] as? Boolean
?: ReactBuildConfig.DEBUG,
jsRuntimeFactory = null
Expand Down