Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ private void setJSBundle(ReactInstanceManager instanceManager, String latestJSBu
Field bundleLoaderField = instanceManager.getClass().getDeclaredField("mBundleLoader");
Class<?> jsBundleLoaderClass = Class.forName("com.facebook.react.cxxbridge.JSBundleLoader");
Method createFileLoaderMethod = null;
String createFileLoaderMethodName = latestJSBundleFile.toLowerCase().startsWith("assets://")
? "createAssetLoader" : "createFileLoader";

Method[] methods = jsBundleLoaderClass.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals("createFileLoader")) {
for (Method method : methods) {
if (method.getName().equals(createFileLoaderMethodName)) {
createFileLoaderMethod = method;
break;
}
Expand All @@ -125,7 +127,7 @@ private void setJSBundle(ReactInstanceManager instanceManager, String latestJSBu
// RN >= v0.34
latestJSBundleLoader = createFileLoaderMethod.invoke(jsBundleLoaderClass, latestJSBundleFile);
} else if (numParameters == 2) {
// RN >= v0.31 && RN < v0.34
// RN >= v0.31 && RN < v0.34 or AssetLoader instance
latestJSBundleLoader = createFileLoaderMethod.invoke(jsBundleLoaderClass, getReactApplicationContext(), latestJSBundleFile);
} else {
throw new NoSuchMethodException("Could not find a recognized 'createFileLoader' method");
Expand Down