mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix(iOS): remove deprecated method from RCTPerfMonitor & fix position (#43058)
Summary: This PR removes usage of deprecated `statusBarFrame` method in `RCTPerfMonitor` . Instead `RCTPerfMonitor` now uses `safeAreaInsets` which also fixes issue causing Perf Monitor to appear under corner in landscape mode on e.g. `iPhone 15 Pro`. It also fixes initial position of expanded state which was causing it to render under notch. Also removed duplicate background color setting ## Changelog: [IOS] [REMOVED] - Remove usage of deprecated statusBarFrame method [IOS] [FIXED] - Fix position of RCTPerfMonitor in landscape mode & expanded mode Pull Request resolved: https://github.com/facebook/react-native/pull/43058 Test Plan: `RNTester` builds and runs successfully, `RCTPerfMonitor` works and displays correctly Reviewed By: dmytrorykun Differential Revision: D59116913 Pulled By: cipolleschi fbshipit-source-id: 0ff61f61b206c530cfb9e471bc2dc33a0a43c833
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8c8c77b974
commit
258f41a30f
@@ -171,16 +171,15 @@ RCT_EXPORT_MODULE()
|
||||
- (UIView *)container
|
||||
{
|
||||
if (!_container) {
|
||||
CGSize statusBarSize = RCTUIStatusBarManager().statusBarFrame.size;
|
||||
CGFloat statusBarHeight = statusBarSize.height;
|
||||
_container = [[UIView alloc] initWithFrame:CGRectMake(10, statusBarHeight, 180, RCTPerfMonitorBarHeight)];
|
||||
UIEdgeInsets safeInsets = RCTKeyWindow().safeAreaInsets;
|
||||
|
||||
_container =
|
||||
[[UIView alloc] initWithFrame:CGRectMake(safeInsets.left, safeInsets.top, 180, RCTPerfMonitorBarHeight)];
|
||||
_container.layer.borderWidth = 2;
|
||||
_container.layer.borderColor = [UIColor lightGrayColor].CGColor;
|
||||
[_container addGestureRecognizer:self.gestureRecognizer];
|
||||
[_container addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap)]];
|
||||
|
||||
_container.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
_container.backgroundColor = [UIColor systemBackgroundColor];
|
||||
}
|
||||
|
||||
@@ -449,7 +448,9 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
[self loadPerformanceLoggerData];
|
||||
if (CGRectIsEmpty(_storedMonitorFrame)) {
|
||||
_storedMonitorFrame = CGRectMake(0, 20, self.container.window.frame.size.width, RCTPerfMonitorExpandHeight);
|
||||
UIEdgeInsets safeInsets = RCTKeyWindow().safeAreaInsets;
|
||||
_storedMonitorFrame =
|
||||
CGRectMake(safeInsets.left, safeInsets.top, self.container.window.frame.size.width, RCTPerfMonitorExpandHeight);
|
||||
[self.container addSubview:self.metrics];
|
||||
} else {
|
||||
[_metrics reloadData];
|
||||
|
||||
Reference in New Issue
Block a user