Skip to content

Commit ed91b65

Browse files
committed
allow overriding the bundle on ios
1 parent 523f585 commit ed91b65

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

ios/ReactNativeBrownfield.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ internal import ReactAppDependencyProvider
66
class ReactNativeBrownfieldDelegate: RCTDefaultReactNativeFactoryDelegate {
77
var entryFile = "index"
88
var bundlePath = "main.jsbundle"
9+
var bundle = Bundle.main
910
// MARK: - RCTReactNativeFactoryDelegate Methods
1011

1112
override func sourceURL(for bridge: RCTBridge) -> URL? {
@@ -21,7 +22,7 @@ class ReactNativeBrownfieldDelegate: RCTDefaultReactNativeFactoryDelegate {
2122
let resourceName = withoutLast.joined()
2223
let fileExtension = resourceURLComponents.last ?? ""
2324

24-
return Bundle.main.url(forResource: resourceName, withExtension: fileExtension)
25+
return bundle.url(forResource: resourceName, withExtension: fileExtension)
2526
#endif
2627
}
2728
}
@@ -54,6 +55,15 @@ class ReactNativeBrownfieldDelegate: RCTDefaultReactNativeFactoryDelegate {
5455
delegate.bundlePath = bundlePath
5556
}
5657
}
58+
/**
59+
* Bundle instance to lookup the JavaScript bundle.
60+
* Default value: Bundle.main
61+
*/
62+
@objc public var bundle: Bundle = Bundle.main {
63+
didSet {
64+
delegate.bundle = bundle
65+
}
66+
}
5767
/**
5868
* React Native factory instance created when starting React Native.
5969
* Default value: nil

0 commit comments

Comments
 (0)