Skip to content

Commit

Permalink
Remove usage of UIApplication.sharedApplication (#34787)
Browse files Browse the repository at this point in the history
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: #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
  • Loading branch information
evoactivity authored and facebook-github-bot committed Sep 26, 2022
1 parent cc13b02 commit 5e79fa8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion React/Base/RCTKeyCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5e79fa8

Please sign in to comment.