From 1165c07c24d7ee03d04f14d6209483cb7d1a52d0 Mon Sep 17 00:00:00 2001 From: Devan Buggay Date: Fri, 16 Jan 2026 13:54:04 -0800 Subject: [PATCH] Log/redbox compiling for AppleTV (#55197) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55197 Platform guarding some unavailable UIKit APIs. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D90711498 fbshipit-source-id: af29087e91d3983a2a95db3633ad0f1ca9b3c16d --- packages/react-native/React/CoreModules/RCTLogBoxView.mm | 4 ++++ packages/react-native/React/CoreModules/RCTRedBox.mm | 4 ++++ .../React/Modules/RCTRedBoxExtraDataViewController.m | 2 ++ 3 files changed, 10 insertions(+) diff --git a/packages/react-native/React/CoreModules/RCTLogBoxView.mm b/packages/react-native/React/CoreModules/RCTLogBoxView.mm index 3b003a28a5d..79f9aa288a4 100644 --- a/packages/react-native/React/CoreModules/RCTLogBoxView.mm +++ b/packages/react-native/React/CoreModules/RCTLogBoxView.mm @@ -20,7 +20,9 @@ - (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame]) != nullptr) { +#if !TARGET_OS_TV self.windowLevel = UIWindowLevelStatusBar - 1; +#endif self.backgroundColor = [UIColor clearColor]; } return self; @@ -40,7 +42,9 @@ { self = [super initWithWindowScene:window.windowScene]; +#if !TARGET_OS_TV self.windowLevel = UIWindowLevelStatusBar - 1; +#endif self.backgroundColor = [UIColor clearColor]; _surface = [[RCTSurface alloc] initWithBridge:bridge moduleName:@"LogBox" initialProperties:@{}]; diff --git a/packages/react-native/React/CoreModules/RCTRedBox.mm b/packages/react-native/React/CoreModules/RCTRedBox.mm index fb057b96921..f0dbb32bad1 100644 --- a/packages/react-native/React/CoreModules/RCTRedBox.mm +++ b/packages/react-native/React/CoreModules/RCTRedBox.mm @@ -108,8 +108,10 @@ _stackTraceTableView.delegate = self; _stackTraceTableView.dataSource = self; _stackTraceTableView.backgroundColor = [UIColor clearColor]; +#if !TARGET_OS_TV _stackTraceTableView.separatorColor = [UIColor colorWithWhite:1 alpha:0.3]; _stackTraceTableView.separatorStyle = UITableViewCellSeparatorStyleNone; +#endif _stackTraceTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; [self.view addSubview:_stackTraceTableView]; @@ -308,8 +310,10 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder) [fullStackTrace appendFormat:@" %@\n", [self formatFrameSource:stackFrame]]; } } +#if !TARGET_OS_TV UIPasteboard *pb = [UIPasteboard generalPasteboard]; [pb setString:fullStackTrace]; +#endif } - (NSString *)formatFrameSource:(RCTJSStackFrame *)stackFrame diff --git a/packages/react-native/React/Modules/RCTRedBoxExtraDataViewController.m b/packages/react-native/React/Modules/RCTRedBoxExtraDataViewController.m index 6afd630eac2..c3c089d8598 100644 --- a/packages/react-native/React/Modules/RCTRedBoxExtraDataViewController.m +++ b/packages/react-native/React/Modules/RCTRedBoxExtraDataViewController.m @@ -108,7 +108,9 @@ _tableView.delegate = self; _tableView.dataSource = self; _tableView.backgroundColor = [UIColor colorWithRed:0.8 green:0 blue:0 alpha:1]; +#if !TARGET_OS_TV _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; +#endif _tableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; _tableView.allowsSelection = NO; [self.view addSubview:_tableView];