Java Code Examples for com.facebook.react.bridge.JSBundleLoader#createCachedBundleFromNetworkLoader()

The following examples show how to use com.facebook.react.bridge.JSBundleLoader#createCachedBundleFromNetworkLoader() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReactInstanceManager.java    From react-native-GPay with MIT License 5 votes vote down vote up
@ThreadConfined(UI)
private void onJSBundleLoadedFromServer(@Nullable NativeDeltaClient nativeDeltaClient) {
  Log.d(ReactConstants.TAG, "ReactInstanceManager.onJSBundleLoadedFromServer()");

  JSBundleLoader bundleLoader = nativeDeltaClient == null
      ? JSBundleLoader.createCachedBundleFromNetworkLoader(
          mDevSupportManager.getSourceUrl(),
          mDevSupportManager.getDownloadedJSBundleFile())
      : JSBundleLoader.createDeltaFromNetworkLoader(
          mDevSupportManager.getSourceUrl(), nativeDeltaClient);

  recreateReactContextInBackground(mJavaScriptExecutorFactory, bundleLoader);
}
 
Example 2
Source File: RNThreadModule.java    From react-native-threads with MIT License 5 votes vote down vote up
private JSBundleLoader createDevBundleLoader(String jsFileName, String jsFileSlug) {
  String bundleUrl = bundleUrlForFile(jsFileName);
  // nested file directory will not exist in the files dir during development,
  // so remove any leading directory paths to simply download a flat file into
  // the root of the files directory.
  String[] splitFileSlug = jsFileSlug.split("/");
  String bundleOut = getReactApplicationContext().getFilesDir().getAbsolutePath() + "/" + splitFileSlug[splitFileSlug.length - 1];

  Log.d(TAG, "createDevBundleLoader - download web thread to - " + bundleOut);
  downloadScriptToFileSync(bundleUrl, bundleOut);

  return JSBundleLoader.createCachedBundleFromNetworkLoader(bundleUrl, bundleOut);
}
 
Example 3
Source File: WorkerModule.java    From react-native-workers with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private JSBundleLoader createDevBundleLoader(String jsFileName, String jsFileSlug) {
    String bundleUrl = bundleUrlForFile(jsFileName);
    String bundleOut = getReactApplicationContext().getFilesDir().getAbsolutePath() + "/" + jsFileSlug;

    Log.d(TAG, "createDevBundleLoader - download web worker to - " + bundleOut);
    downloadScriptToFileSync(bundleUrl, bundleOut);

    return JSBundleLoader.createCachedBundleFromNetworkLoader(bundleUrl, bundleOut);
}