1. Download the package file and manage the path (s).
2.New ReactNativeHost in your application:
public String mBundleFilePath = "";
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.asList(new MainReactPackage(), new MyReactPackage());
}
@Override
protected String getJSBundleFile() {
return mBundleFilePath;
}
};
3. Before starting ReactActivity, assign the path of the ur bundle file to the variable: mBundleFilePath.
public class ReactNativeActivity extends ReactActivity {
public static void launchSelf(...) {
MyApplication.getInstance().mBundleFilePath = path;
COMPONENT_NAME = ...;
Intent intent = new Intent(activity,ReactNativeActivity.class);
activity.startActivity(..);
}
...
}
source:
com.facebook.react.ReactNativeHost#createReactInstanceManager
com.facebook.react.ReactInstanceManager.Builder#setJSBundleFile
com.facebook.react.cxxbridge.JSBundleLoader#createFileLoader
...
can help u :)
source
share