Skip to content

Commit f314973

Browse files
fkgozalifacebook-github-bot
authored andcommitted
iOS: make RCTSurfaceHostingView have default backgroundColor
Summary: Previously it defaults to using transparent color (iOS default), but when using `RCTSurfaceHostingProxyRootView` we actually manually set to `[UIColor whiteColor]`. However, if the surface is initialized via a different API, the color wasn't set. To avoid confusion and backward incompatibility, let's just set the same background color here. We can decide in the future if the default color should be transparent instead. Changelog: [Fixed][iOS] RCTSurfaceHostingView default background color is now consistent with RCTRootView Reviewed By: RSNara Differential Revision: D27973748 fbshipit-source-id: c506afbc5629df6647277aa2323f084773c8e760
1 parent d48c2be commit f314973

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
7474
initialProperties:initialProperties];
7575
[surface start];
7676
if (self = [super initWithSurface:surface sizeMeasureMode:sizeMeasureMode]) {
77-
self.backgroundColor = [UIColor whiteColor];
77+
// Nothing specific to do.
7878
}
7979

8080
RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");

React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ - (instancetype)initWithSurface:(id<RCTSurfaceProtocol>)surface
6060
_surface.delegate = self;
6161
_stage = surface.stage;
6262
[self _updateViews];
63+
64+
// For backward compatibility with RCTRootView, set a color here instead of transparent (OS default).
65+
self.backgroundColor = [UIColor whiteColor];
6366
}
6467

6568
return self;

0 commit comments

Comments
 (0)