From 5e79fa84412111cf8b8ea4828d82f83672c9dc9f Mon Sep 17 00:00:00 2001 From: Liam Potter Date: Mon, 26 Sep 2022 07:13:52 -0700 Subject: [PATCH] Remove usage of UIApplication.sharedApplication (#34787) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Brings in line with rest of code base and avoids running into this error ``` ‘sharedApplication’ is unavailable: not available on iOS (App Extension) — Use view controller based solutions where appropriate instead. ``` when `Requires Only App-Extension-Safe-API` is set to Yes. ## Changelog [iOS] [Fixed] - Update usage of UIApplication.sharedApplication in RCTKeyCommands Pull Request resolved: https://github.com/facebook/react-native/pull/34787 Test Plan: Setting `Requires Only App-Extension-Safe-API` to Yes before this change means the app will not compile, after the change it does. Reviewed By: dmytrorykun Differential Revision: D39812410 Pulled By: cipolleschi fbshipit-source-id: 78d185ba20301b10609e4a387f000f0cfda55663 --- React/Base/RCTKeyCommands.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/React/Base/RCTKeyCommands.m b/React/Base/RCTKeyCommands.m index 83385f82439f84..1ceaf6ec0dceb1 100644 --- a/React/Base/RCTKeyCommands.m +++ b/React/Base/RCTKeyCommands.m @@ -128,7 +128,7 @@ - (void)handleKeyUIEventSwizzle:(UIEvent *)event isKeyDown = [event _isKeyDown]; } - BOOL interactionEnabled = !UIApplication.sharedApplication.isIgnoringInteractionEvents; + BOOL interactionEnabled = !RCTSharedApplication().isIgnoringInteractionEvents; BOOL hasFirstResponder = NO; if (isKeyDown && modifiedInput.length > 0 && interactionEnabled) { UIResponder *firstResponder = nil;