@@ -79,24 +79,26 @@ private boolean isReactApplication(Context context) {
7979 return false ;
8080 }
8181
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 ) {
8883 mCodePush .invalidateCurrentInstance ();
84+
85+ currentActivity .runOnUiThread (new Runnable () {
86+ @ Override
87+ public void run () {
88+ currentActivity .recreate ();
89+ }
90+ });
8991 }
9092
9193 private void loadBundle () {
9294 mCodePush .clearDebugCacheIfNeeded ();
93- Activity currentActivity = getCurrentActivity ();
95+ final Activity currentActivity = getCurrentActivity ();
9496
9597 if (!ReactActivity .class .isInstance (currentActivity )) {
9698 // Our preferred reload logic relies on the user's Activity inheriting
9799 // from the core ReactActivity class, so if it doesn't, we fallback
98100 // early to our legacy behavior.
99- loadBundleLegacy ();
101+ loadBundleLegacy (currentActivity );
100102 } else {
101103 try {
102104 ReactActivity reactActivity = (ReactActivity )currentActivity ;
@@ -144,14 +146,14 @@ public void run() {
144146 catch (Exception e ) {
145147 // The recreation method threw an unknown exception
146148 // so just simply fallback to restarting the Activity
147- loadBundleLegacy ();
149+ loadBundleLegacy (currentActivity );
148150 }
149151 }
150152 });
151153 } catch (Exception e ) {
152154 // Our reflection logic failed somewhere
153155 // so fall back to restarting the Activity
154- loadBundleLegacy ();
156+ loadBundleLegacy (currentActivity );
155157 }
156158 }
157159 }
0 commit comments