Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
On Android, reloading the app while the LogBox inspector is open leaves a blank (black or white) full-screen window over the reloaded app.
The inspector is a
LogBoxDialogshown byLogBoxDialogSurfaceDelegate.When the React instance is torn down for the reload,
LogBoxModule.invalidate()calls onlysurfaceDelegate.destroyContentView().That destroys the LogBox root view but never dismisses the dialog, so its window stays on screen with nothing in it.
The reloaded app renders normally underneath, but the user only sees the empty window until they press Back, which then also delivers a
hardwareBackPressto the new instance.invalidate()now callssurfaceDelegate.hide().In
LogBoxDialogSurfaceDelegate, that dismisses the dialog, detaches the root view and then callsdestroyContentView(), so the cleanupinvalidate()did before still happens.Changelog:
[ANDROID] [FIXED] - Dismiss the LogBox dialog on reload so it no longer leaves a blank window over the app
Test Plan:
Reproduced on a physical Android device (Redmi K20 Pro, Android 11) with React Native 0.86.3 (bridgeless, new architecture) in an Expo SDK 57 dev client:
console.errorso the LogBox notification appears, then tap it to open the inspector.rin Metro).dumpsys window windowslists two windows for the activity: the reloaded app's window, which has itsReactSurfaceView, and the leftover LogBox dialog window on top. Logcat showsstopSurface(surfaceId = 11) ... reactInstance is null. Dropping work.for the LogBox surface.Not done: I did not build React Native from source to run the patched module on the device, because the app consumes the prebuilt
react-androidartifact.The change relies on
hide()being safe when no dialog is showing, whichLogBoxDialogSurfaceDelegate.hide()already is (isShowing()guards the dismiss, and the remaining steps are null-safe).🤖 Generated with Claude Code