diff --git a/React/Base/RCTRootView.m b/React/Base/RCTRootView.m index 23100f5e2..e9a8170eb 100644 --- a/React/Base/RCTRootView.m +++ b/React/Base/RCTRootView.m @@ -48,7 +48,6 @@ RCTBridge *_bridge; NSString *_moduleName; NSDictionary *_launchOptions; - UIColor *_backgroundColor; RCTRootContentView *_contentView; } @@ -90,15 +89,10 @@ - (void)setBackgroundColor:(UIColor *)backgroundColor { - _backgroundColor = backgroundColor; + super.backgroundColor = backgroundColor; _contentView.backgroundColor = backgroundColor; } -- (UIColor *)backgroundColor -{ - return _backgroundColor; -} - - (UIViewController *)backingViewController { return _backingViewController ?: [super backingViewController]; @@ -135,7 +129,7 @@ RCT_IMPORT_METHOD(ReactNative, unmountComponentAtNodeAndRemoveContainer) [_contentView removeFromSuperview]; _contentView = [[RCTRootContentView alloc] initWithFrame:self.bounds bridge:bridge]; - _contentView.backgroundColor = _backgroundColor; + _contentView.backgroundColor = self.backgroundColor; [self addSubview:_contentView]; NSString *moduleName = _moduleName ?: @""; @@ -184,6 +178,7 @@ RCT_IMPORT_METHOD(ReactNative, unmountComponentAtNodeAndRemoveContainer) { __weak RCTBridge *_bridge; RCTTouchHandler *_touchHandler; + UIColor *_backgroundColor; } - (instancetype)initWithFrame:(CGRect)frame @@ -193,6 +188,7 @@ RCT_IMPORT_METHOD(ReactNative, unmountComponentAtNodeAndRemoveContainer) _bridge = bridge; [self setUp]; self.frame = frame; + self.layer.backgroundColor = NULL; } return self; } @@ -207,12 +203,17 @@ RCT_IMPORT_METHOD(ReactNative, unmountComponentAtNodeAndRemoveContainer) - (void)setBackgroundColor:(UIColor *)backgroundColor { - super.backgroundColor = backgroundColor; + _backgroundColor = backgroundColor; if (self.reactTag && _bridge.isValid) { [_bridge.uiManager setBackgroundColor:backgroundColor forRootView:self]; } } +- (UIColor *)backgroundColor +{ + return _backgroundColor; +} + - (void)setUp { /**