Skip to content

Commit

Permalink
fix(iOS): remove alert's window when call to hide.
Browse files Browse the repository at this point in the history
Resolves this issue: #32304.

Without this change, calling to hide an alert, leaves a `UIWindow`
that blocks user interactions with the screen.

The correct way to remove a `UIWindow` in iOS is to set its
hidden property to `YES`.

Also, it is required to remove all references to the window (the
associated `windowScene` for example) and ARC will automatically
free this `UIWindow`.

Co-authored-by: paddlefish <paddlefish@users.noreply.github.com>
  • Loading branch information
asafkorem and paddlefish committed Jan 5, 2022
1 parent 681ed40 commit 3767095
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions React/CoreModules/RCTAlertController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ - (void)show:(BOOL)animated completion:(void (^)(void))completion

- (void)hide
{
[_alertWindow setHidden: YES];

if (@available(iOS 13, *)) {
_alertWindow.windowScene = nil;
}

_alertWindow = nil;
}

Expand Down

0 comments on commit 3767095

Please sign in to comment.