Skip to content

Commit

Permalink
Hide the logbox window explicitly. New behavior in iOS SDK appears to… (
Browse files Browse the repository at this point in the history
#32435)

Summary:
Fixes  #32434: RCTLogBox window is orphaned, covering entire screen.

After this change, the logbox window once again is removed from the screen.

## Changelog

Some third-party SDKs may hold references to created UIWindow, UIViewController, or UIView objects. Doing so means that the current code's `hide` method that releases the reference to the UIWindow in LogBox will not cause the window to be dealloc'd, and thus instead it will remain on the screen. This change explicitly hides the LogBox window when the reference is released, so that even if some other SDK holds onto the window it will still be taken off the screen.

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - 32434

Pull Request resolved: #32435

Test Plan:
1.     Use console.warn to generate a yellow warning message in log box.  Also install a third-party SDK that holds onto a reference to UIWindow -- for example the Facebook SDK, the Data Dog SDK, or any number of other SDKs that use `swizzling` to intercept calls like `viewDidAppear:`.
2.     click the log
3.     tap "dismiss"
4.     try to tap anywhere
5. Use Xcode view debugger to inspect the UI state

## Expected

The app still responds to the touch.
In Xcode, there is not an extra UIWindow covering the screen

Reviewed By: philIip

Differential Revision: D31794242

Pulled By: sshic

fbshipit-source-id: 28aa247b3ed3fd60b8e7c2ed7d0606cbf5c42408
  • Loading branch information
paddlefish authored and facebook-github-bot committed Oct 24, 2021
1 parent ebe5417 commit 72ea0e1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions React/CoreModules/RCTLogBox.mm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ + (BOOL)requiresMainQueueSetup
if (!strongSelf) {
return;
}
[strongSelf->_view setHidden: YES];
strongSelf->_view = nil;
});
}
Expand Down

0 comments on commit 72ea0e1

Please sign in to comment.