From 8019bb9dd41b95ff14a55fb0ab4e73857503687f Mon Sep 17 00:00:00 2001 From: Asaf Korem Date: Wed, 5 Jan 2022 17:28:04 +0200 Subject: [PATCH] fix(iOS): remove alert's window when call to `hide`. 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`. --- React/CoreModules/RCTAlertController.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/React/CoreModules/RCTAlertController.m b/React/CoreModules/RCTAlertController.m index 7b326a2ad31ee8..cf60793e33ee49 100644 --- a/React/CoreModules/RCTAlertController.m +++ b/React/CoreModules/RCTAlertController.m @@ -35,6 +35,8 @@ - (void)show:(BOOL)animated completion:(void (^)(void))completion - (void)hide { + [_alertWindow setHidden: YES]; + _alertWindow.windowScene = nil; _alertWindow = nil; }