Skip to content

Commit

Permalink
feat: optimize RCTKeyWindow() for iOS 15+ (#43066)
Browse files Browse the repository at this point in the history
Summary:
This PR further optimizes RCTKeyWindow() for iOS 15+ removing the need for additional loop
bypass-github-export-checks
## Changelog:

[IOS] [ADDED] - optimize RCTKeyWindow() for iOS 15+

Pull Request resolved: #43066

Test Plan: Launch RNTester, check if proper keyWindow is returned for iOS 15+

Reviewed By: javache

Differential Revision: D54541838

Pulled By: cipolleschi

fbshipit-source-id: be79ff48f825d10c8fd71efc18629377aadc29fd
  • Loading branch information
okwasniewski authored and facebook-github-bot committed Mar 6, 2024
1 parent 7c95369 commit b2fba37
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react-native/React/Base/RCTUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,10 @@ BOOL RCTRunningInAppExtension(void)
}
UIWindowScene *windowScene = (UIWindowScene *)scene;

if (@available(iOS 15.0, *)) {
return windowScene.keyWindow;
}

for (UIWindow *window in windowScene.windows) {
if (window.isKeyWindow) {
return window;
Expand Down

0 comments on commit b2fba37

Please sign in to comment.