Skip to content

Commit

Permalink
Fix background color glitch
Browse files Browse the repository at this point in the history
Summary:Because the source of truth for backgroundColor is the shadow view, it's possible for the default RCTView backgroundColor to get overwritten by the current shadowView backgroundColor when the view is first created. This overridden value will then be used as the default whenever the background color is reset, which may not be be appropriate for other components that use RCTView.

This diff fixes the bug by ensuring that the view props (and therefore the default color) are set *before* the background color is propagated from the shadowView.

Reviewed By: furdei

Differential Revision: D3064128

fb-gh-sync-id: ac36007c094c7201a5c4fd93399dee4d3eb9a043
shipit-source-id: ac36007c094c7201a5c4fd93399dee4d3eb9a043
  • Loading branch information
nicklockwood authored and Facebook Github Bot 4 committed Mar 17, 2016
1 parent a4b01ae commit 4c7c365
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -897,10 +897,10 @@ - (void)_manageChildren:(NSNumber *)containerReactTag
[self addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
UIView *view = [componentData createViewWithTag:reactTag];
if (view) {
[componentData setProps:props forView:view]; // Must be done before bgColor to prevent wrong default
if ([view respondsToSelector:@selector(setBackgroundColor:)]) {
((UIView *)view).backgroundColor = backgroundColor;
}
[componentData setProps:props forView:view];
if ([view respondsToSelector:@selector(reactBridgeDidFinishTransaction)]) {
[uiManager->_bridgeTransactionListeners addObject:view];
}
Expand Down

0 comments on commit 4c7c365

Please sign in to comment.