Skip to content

Commit

Permalink
Fix RCTPerfMonitor not showing up in scene based app (#43476)
Browse files Browse the repository at this point in the history
Summary:
Currently RCTPerfMonitor won't show up in scene based app, we should first try to extract the window from the connected scenes, and fallback to the window in `UIApplicationDelegate`.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[iOS] [Fixed] - Fix RCTPerfMonitor not showing up in scene based app

Pull Request resolved: #43476

Test Plan:
- Tested RCTPerfMonitor in app not using scenes;
- Tested RCTPerfMonitor in app using scenes in iOS 13 & 14;
- Tested RCTPerfMonitor in app using scenes in iOS 15+.

Reviewed By: rshest

Differential Revision: D57381551

Pulled By: javache

fbshipit-source-id: fd6cce20c9a4ed41d7aae84751fc0c83391d0865
  • Loading branch information
ouabing authored and facebook-github-bot committed May 16, 2024
1 parent 46d4b83 commit 1677521
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/react-native/React/CoreModules/RCTPerfMonitor.mm
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ - (void)show

[self updateStats];

UIWindow *window = RCTSharedApplication().delegate.window;
[window addSubview:self.container];
[RCTKeyWindow() addSubview:self.container];

_uiDisplayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(threadUpdate:)];
[_uiDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
Expand Down

0 comments on commit 1677521

Please sign in to comment.