Fixed loading flicker on RCTRootView

This commit is contained in:
Nick Lockwood 2015-05-27 02:30:57 -07:00
parent a4442e4576
commit 8d992262ed
1 changed files with 10 additions and 9 deletions

View File

@ -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
{
/**