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: facebook#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`.
  • Loading branch information
asafkorem committed Jan 5, 2022
1 parent 681ed40 commit 8019bb9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions React/CoreModules/RCTAlertController.m
Expand Up @@ -35,6 +35,8 @@ - (void)show:(BOOL)animated completion:(void (^)(void))completion

- (void)hide
{
[_alertWindow setHidden: YES];
_alertWindow.windowScene = nil;
_alertWindow = nil;
}

Expand Down

0 comments on commit 8019bb9

Please sign in to comment.