@@ -79,24 +79,26 @@ private boolean isReactApplication(Context context) {
79
79
return false ;
80
80
}
81
81
82
- private void loadBundleLegacy () {
83
- Activity currentActivity = getCurrentActivity ();
84
- Intent intent = currentActivity .getIntent ();
85
- currentActivity .finish ();
86
- currentActivity .startActivity (intent );
87
-
82
+ private void loadBundleLegacy (final Activity currentActivity ) {
88
83
mCodePush .invalidateCurrentInstance ();
84
+
85
+ currentActivity .runOnUiThread (new Runnable () {
86
+ @ Override
87
+ public void run () {
88
+ currentActivity .recreate ();
89
+ }
90
+ });
89
91
}
90
92
91
93
private void loadBundle () {
92
94
mCodePush .clearDebugCacheIfNeeded ();
93
- Activity currentActivity = getCurrentActivity ();
95
+ final Activity currentActivity = getCurrentActivity ();
94
96
95
97
if (!ReactActivity .class .isInstance (currentActivity )) {
96
98
// Our preferred reload logic relies on the user's Activity inheriting
97
99
// from the core ReactActivity class, so if it doesn't, we fallback
98
100
// early to our legacy behavior.
99
- loadBundleLegacy ();
101
+ loadBundleLegacy (currentActivity );
100
102
} else {
101
103
try {
102
104
ReactActivity reactActivity = (ReactActivity )currentActivity ;
@@ -144,14 +146,14 @@ public void run() {
144
146
catch (Exception e ) {
145
147
// The recreation method threw an unknown exception
146
148
// so just simply fallback to restarting the Activity
147
- loadBundleLegacy ();
149
+ loadBundleLegacy (currentActivity );
148
150
}
149
151
}
150
152
});
151
153
} catch (Exception e ) {
152
154
// Our reflection logic failed somewhere
153
155
// so fall back to restarting the Activity
154
- loadBundleLegacy ();
156
+ loadBundleLegacy (currentActivity );
155
157
}
156
158
}
157
159
}
0 commit comments