Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix android root view group removal during instance re-creation #41678

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1296,14 +1296,12 @@ private void detachRootViewFromInstance(ReactRoot reactRoot, ReactContext reactC
uiManager.stopSurface(surfaceId);
} else {
FLog.w(ReactConstants.TAG, "Failed to stop surface, UIManager has already gone away");
reactRoot.getRootViewGroup().removeAllViews();
}
} else {
ReactSoftExceptionLogger.logSoftException(
TAG,
new RuntimeException(
"detachRootViewFromInstance called with ReactRootView with invalid id"));
reactRoot.getRootViewGroup().removeAllViews();
}
} else {
reactContext
Expand All @@ -1312,8 +1310,7 @@ private void detachRootViewFromInstance(ReactRoot reactRoot, ReactContext reactC
.unmountApplicationComponentAtRootTag(reactRoot.getRootViewTag());
}

// The view is no longer attached, so mark it as such by resetting its ID.
reactRoot.getRootViewGroup().setId(View.NO_ID);
clearReactRoot(reactRoot);
}

@ThreadConfined(UI)
Expand Down