1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-09 01:25:14 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

解决安卓更新重启问题

This commit is contained in:
tdzl2003
2017-05-04 20:23:16 +08:00
parent dd693f4cee
commit 26708dc5bd
2 changed files with 7 additions and 7 deletions

View File

@@ -124,15 +124,15 @@ public class UpdateModule extends ReactContextBaseJavaModule{
Application application = activity.getApplication();
ReactInstanceManager instanceManager = ((ReactApplication) application).getReactNativeHost().getReactInstanceManager();
if (instanceManager.getClass().getSimpleName().equals("XReactInstanceManagerImpl")) {
JSBundleLoader loader = JSBundleLoader.createFileLoader(UpdateContext.getBundleUrl(application));
Field jsBundleField = instanceManager.getClass().getDeclaredField("mBundleLoader");
jsBundleField.setAccessible(true);
jsBundleField.set(instanceManager, loader);
} else {
try {
Field jsBundleField = instanceManager.getClass().getDeclaredField("mJSBundleFile");
jsBundleField.setAccessible(true);
jsBundleField.set(instanceManager, UpdateContext.getBundleUrl(application));
} catch (Throwable err) {
JSBundleLoader loader = JSBundleLoader.createFileLoader(UpdateContext.getBundleUrl(application));
Field loadField = instanceManager.getClass().getDeclaredField("mBundleLoader");
loadField.setAccessible(true);
loadField.set(instanceManager, loader);
}
final Method recreateMethod = instanceManager.getClass().getMethod("recreateReactContextInBackground");