Only make backgroundColor opaque if non-nil

Summary: public

Do not set a default backgroundColor of white when top-level RCTShadowText has
backgroundColor == nil.

Reviewed By: nicklockwood

Differential Revision: D2605636

fb-gh-sync-id: f2076d302e7ed574f7804080ccc80db1c9b9401c
This commit is contained in:
Josh Berdine
2015-11-04 08:52:52 -08:00
committed by facebook-github-bot-3
parent 6b9e4ec4b2
commit c357943dfb

View File

@@ -155,7 +155,7 @@ static css_dim_t RCTMeasure(void *context, float width)
letterSpacing:nil
useBackgroundColor:NO
foregroundColor:self.color ?: [UIColor blackColor]
backgroundColor:self.backgroundColor ?: [UIColor whiteColor]
backgroundColor:self.backgroundColor
opacity:self.opacity];
}
@@ -231,7 +231,7 @@ static css_dim_t RCTMeasure(void *context, float width)
if (_isHighlighted) {
[self _addAttribute:RCTIsHighlightedAttributeName withValue:@YES toAttributedString:attributedString];
}
if (useBackgroundColor) {
if (useBackgroundColor && backgroundColor) {
[self _addAttribute:NSBackgroundColorAttributeName
withValue:[backgroundColor colorWithAlphaComponent:CGColorGetAlpha(backgroundColor.CGColor) * opacity]
toAttributedString:attributedString];