Skip to content

Commit b0907b4

Browse files
committed
fix: restartApp on the main thread
Post the restart to the main thread to ensure the Activity lifecycle completes before we start tearing down the React context. This prevents the new React instance from immediately being paused.
1 parent fdb5e3c commit b0907b4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

android/app/src/main/java/com/appzung/codepush/react/CodePushNativeModule.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,12 @@ public void onHostResume() {
686686
if (installMode == CodePushInstallMode.IMMEDIATE.getValue()
687687
|| durationInBackground >= CodePushNativeModule.this.mMinimumBackgroundDuration) {
688688
CodePushUtils.log("Loading bundle on resume");
689-
restartAppInternal(false);
689+
new Handler(Looper.getMainLooper()).post(new Runnable() {
690+
@Override
691+
public void run() {
692+
restartAppInternal(false);
693+
}
694+
});
690695
}
691696
}
692697
}

0 commit comments

Comments
 (0)