mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Allow developers to load JavaScript bundle from any source.
Summary: This patch adds two pieces of functionality:
- Exposes `JSBundleLoader` to allow a developer to load JavaScript bundles as they choose.
- Adds `ReactBridge.loadScripFromFile` method which loads a JavaScript bundle from an arbitrary file path.
Example usage:
```
JSBundleLoader jsBundleLoader = new JSBundleLoader() {
Override
public void loadScript(ReactBridge reactBridge) {
reactBridge.loadScriptFromFile("/sdcard/Download/index.android.bundle");
}
};
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setJSBundleLoader(jsBundleLoader)
.setJSMainModuleName("") /* necessary due to TODO(6803830) */
.addPackage(new MainReactPackage())
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
```
cc ide
Closes https://github.com/facebook/react-native/pull/3189
Reviewed By: svcscm
Differential Revision: D2535819
Pulled By: mkonicek
fb-gh-sync-id: f319299dbe29bab3b7e91f94249c14b270d9fec3
This commit is contained in:
committed by
facebook-github-bot-7
parent
b59f250214
commit
3a743ef228
@@ -367,10 +367,18 @@ public class DevSupportManager implements NativeModuleCallExceptionHandler {
|
||||
}
|
||||
|
||||
public String getSourceMapUrl() {
|
||||
if (mJSAppBundleName == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return mDevServerHelper.getSourceMapUrl(Assertions.assertNotNull(mJSAppBundleName));
|
||||
}
|
||||
|
||||
public String getSourceUrl() {
|
||||
if (mJSAppBundleName == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return mDevServerHelper.getSourceUrl(Assertions.assertNotNull(mJSAppBundleName));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user