Skip to content

Commit c32d01f

Browse files
sbuggayfacebook-github-bot
authored andcommitted
Replace systemBackgroundColor for AppleTV (#55131)
Summary: [UIColor systemBackgroundColor] is unavailable on AppleTV, defaulting to [UIColor clearColor]. Changelog: [internal] Reviewed By: Abbondanzo Differential Revision: D90514013
1 parent f5092fd commit c32d01f

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
5959
{
6060
UIView *rootView = RCTAppSetupDefaultRootView(bridge, moduleName, initProps, YES);
6161

62+
#if TARGET_OS_TV
63+
rootView.backgroundColor = [UIColor clearColor];
64+
#else
6265
rootView.backgroundColor = [UIColor systemBackgroundColor];
66+
#endif
6367

6468
return rootView;
6569
}

packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ - (UIView *)viewWithModuleName:(NSString *)moduleName
190190
RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView =
191191
[[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
192192

193+
#if TARGET_OS_TV
194+
surfaceHostingProxyRootView.backgroundColor = [UIColor clearColor];
195+
#else
193196
surfaceHostingProxyRootView.backgroundColor = [UIColor systemBackgroundColor];
197+
#endif
194198
if (_configuration.customizeRootView != nil) {
195199
_configuration.customizeRootView(surfaceHostingProxyRootView);
196200
}
@@ -207,7 +211,11 @@ - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
207211
initProps:(NSDictionary *)initProps
208212
{
209213
UIView *rootView = RCTAppSetupDefaultRootView(bridge, moduleName, initProps, YES);
214+
#if !TARGET_OS_TV
210215
rootView.backgroundColor = [UIColor systemBackgroundColor];
216+
#else
217+
rootView.backgroundColor = [UIColor blackColor];
218+
#endif
211219
return rootView;
212220
}
213221

0 commit comments

Comments
 (0)