Skip to content

Commit 64b77d1

Browse files
author
sunny.luo
committed
fix reload
1 parent a0adf1e commit 64b77d1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,17 @@ public void run() {
150150
if (getReactDelegateMethod != null) {
151151
ReactDelegate reactDelegate = (ReactDelegate)
152152
getReactDelegateMethod.invoke(currentActivity);
153-
reactDelegate.reload();
153+
154+
// Try to get reload method using reflection
155+
java.lang.reflect.Method reloadMethod =
156+
ReactDelegate.class.getMethod("reload");
157+
if (reloadMethod != null) {
158+
reloadMethod.invoke(reactDelegate);
159+
} else {
160+
throw new NoSuchMethodException();
161+
}
154162
} else {
155-
currentActivity.runOnUiThread(new Runnable() {
156-
@Override
157-
public void run() {
158-
currentActivity.recreate();
159-
}
160-
});
163+
throw new NoSuchMethodException();
161164
}
162165
} catch (Throwable e) {
163166
currentActivity.runOnUiThread(new Runnable() {

0 commit comments

Comments
 (0)