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

use reflect

This commit is contained in:
sunny.luo
2025-01-15 17:02:29 +08:00
parent d355b37501
commit 08547b7c8d

View File

@@ -144,8 +144,21 @@ public class UpdateModuleImpl {
return;
}
try {
final ReactDelegate reactDelegate = ((ReactActivity) currentActivity).getReactDelegate();
reactDelegate.reload();
// Try to get getReactDelegate method using reflection
java.lang.reflect.Method getReactDelegateMethod =
ReactActivity.class.getMethod("getReactDelegate");
if (getReactDelegateMethod != null) {
ReactDelegate reactDelegate = (ReactDelegate)
getReactDelegateMethod.invoke(currentActivity);
reactDelegate.reload();
} else {
currentActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
currentActivity.recreate();
}
});
}
} catch (Throwable e) {
currentActivity.runOnUiThread(new Runnable() {
@Override