Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit 51c8d12

Browse files
wqyfavorjianhan-he
authored andcommitted
[iOS] Rename the backgroundColor property name. (#2951)
1 parent c9abe38 commit 51c8d12

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ typedef id (^WXDataBindingBlock)(NSDictionary *data, BOOL *needUpdate);
4949
/**
5050
* View
5151
*/
52-
UIColor *_backgroundColor;
52+
UIColor *_styleBackgroundColor;
5353
NSString *_backgroundImage;
5454
NSString *_clipRadius;
5555
WXClipType _clipToBounds;
@@ -178,7 +178,7 @@ typedef id (^WXDataBindingBlock)(NSDictionary *data, BOOL *needUpdate);
178178
/**
179179
DO NOT use "_backgroundColor" directly. The same reason as '_transform'.
180180
*/
181-
@property (atomic, strong) UIColor* backgroundColor;
181+
@property (atomic, strong) UIColor* styleBackgroundColor;
182182

183183
///--------------------------------------
184184
/// @name Package Internal Methods

ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ - (WXDisplayBlock)_compositeDisplayBlock
289289
- (void)_collectCompositingDisplayBlocks:(NSMutableArray *)displayBlocks context:(CGContextRef)context isCancelled:(BOOL(^)(void))isCancelled
290290
{
291291
// TODO: compositingChild has no chance to applyPropertiesToView, need update here?
292-
UIColor *backgroundColor = self.backgroundColor;
292+
UIColor *backgroundColor = self.styleBackgroundColor;
293293
BOOL clipsToBounds = _clipToBounds;
294294
CGRect frame = self.calculatedFrame;
295295
CGRect bounds = CGRectMake(0, 0, frame.size.width, frame.size.height);
@@ -349,8 +349,8 @@ - (void)_drawBorderWithContext:(CGContextRef)context size:(CGSize)size
349349

350350
CGContextSetAlpha(context, _opacity);
351351
// fill background color
352-
if (self.backgroundColor && CGColorGetAlpha(self.backgroundColor.CGColor) > 0) {
353-
CGContextSetFillColorWithColor(context, self.backgroundColor.CGColor);
352+
if (self.styleBackgroundColor && CGColorGetAlpha(self.styleBackgroundColor.CGColor) > 0) {
353+
CGContextSetFillColorWithColor(context, self.styleBackgroundColor.CGColor);
354354
UIBezierPath *bezierPath = [UIBezierPath wx_bezierPathWithRoundedRect:rect topLeft:topLeft topRight:topRight bottomLeft:bottomLeft bottomRight:bottomRight];
355355
[bezierPath fill];
356356
WXPerformBlockOnMainThread(^{
@@ -594,7 +594,7 @@ - (void)_handleBorders:(NSDictionary *)styles isUpdating:(BOOL)updating
594594
_layer.borderWidth = _borderTopWidth;
595595
_layer.borderColor = _borderTopColor.CGColor;
596596
if ((_transition.transitionOptions & WXTransitionOptionsBackgroundColor) != WXTransitionOptionsBackgroundColor ) {
597-
_layer.backgroundColor = self.backgroundColor.CGColor;
597+
_layer.backgroundColor = self.styleBackgroundColor.CGColor;
598598
}
599599
}
600600
}
@@ -606,7 +606,7 @@ - (BOOL)_bitmapOpaqueWithSize:(CGSize)size
606606
WXRoundedRect *borderRect = [[WXRoundedRect alloc] initWithRect:rect topLeft:_borderTopLeftRadius topRight:_borderTopRightRadius bottomLeft:_borderBottomLeftRadius bottomRight:_borderBottomRightRadius];
607607
WXRadii *radii = borderRect.radii;
608608
BOOL hasBorderRadius = [radii hasBorderRadius];
609-
return (!hasBorderRadius) && _opacity == 1.0 && CGColorGetAlpha(self.backgroundColor.CGColor) == 1.0 && [self _needsDrawBorder];
609+
return (!hasBorderRadius) && _opacity == 1.0 && CGColorGetAlpha(self.styleBackgroundColor.CGColor) == 1.0 && [self _needsDrawBorder];
610610
}
611611

612612
- (CAShapeLayer *)drawBorderRadiusMaskLayer:(CGRect)rect

ios/sdk/WeexSDK/Sources/Model/WXComponent.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ @implementation WXComponent
7070
}
7171

7272
@synthesize transform = _transform;
73-
@synthesize backgroundColor = _backgroundColor;
73+
@synthesize styleBackgroundColor = _styleBackgroundColor;
7474

7575
#pragma mark Life Cycle
7676

@@ -392,7 +392,7 @@ - (UIView *)view
392392
_layer.borderWidth = _borderTopWidth;
393393
[self _resetNativeBorderRadius];
394394
_layer.opacity = _opacity;
395-
_view.backgroundColor = self.backgroundColor;
395+
_view.backgroundColor = self.styleBackgroundColor;
396396
}
397397

398398
if (_backgroundImage) {
@@ -858,8 +858,8 @@ - (void)setGradientLayer
858858
UIColor * endColor = (UIColor*)linearGradient[@"endColor"];
859859
CAGradientLayer * gradientLayer = [WXUtility gradientLayerFromColors:@[startColor, endColor] locations:nil frame:strongSelf.view.bounds gradientType:(WXGradientType)[linearGradient[@"gradientType"] integerValue]];
860860
if (gradientLayer) {
861-
strongSelf.backgroundColor = [UIColor colorWithPatternImage:[strongSelf imageFromLayer:gradientLayer]];
862-
strongSelf.view.backgroundColor = strongSelf.backgroundColor;
861+
strongSelf.styleBackgroundColor = [UIColor colorWithPatternImage:[strongSelf imageFromLayer:gradientLayer]];
862+
strongSelf.view.backgroundColor = strongSelf.styleBackgroundColor;
863863
[strongSelf setNeedsDisplay];
864864
}
865865
}

ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ - (void)viewDidUnload
174174

175175
- (void)_initViewPropertyWithStyles:(NSDictionary *)styles
176176
{
177-
self.backgroundColor = styles[@"backgroundColor"] ? [WXConvert UIColor:styles[@"backgroundColor"]] : [UIColor clearColor];
177+
self.styleBackgroundColor = styles[@"backgroundColor"] ? [WXConvert UIColor:styles[@"backgroundColor"]] : [UIColor clearColor];
178178
_backgroundImage = styles[@"backgroundImage"] ? [WXConvert NSString:styles[@"backgroundImage"]]: nil;
179179
_opacity = styles[@"opacity"] ? [WXConvert CGFloat:styles[@"opacity"]] : 1.0;
180180
_clipToBounds = styles[@"overflow"] ? [WXConvert WXClipType:styles[@"overflow"]] : NO;
@@ -193,7 +193,7 @@ - (void)_transitionUpdateViewProperty:(NSDictionary *)styles
193193
{
194194
WX_CHECK_COMPONENT_TYPE(self.componentType)
195195
if (styles[@"backgroundColor"]) {
196-
self.backgroundColor = [WXConvert UIColor:styles[@"backgroundColor"]];
196+
self.styleBackgroundColor = [WXConvert UIColor:styles[@"backgroundColor"]];
197197
}
198198
if (styles[@"opacity"]) {
199199
_opacity = [WXConvert CGFloat:styles[@"opacity"]];
@@ -211,7 +211,7 @@ - (void)_updateViewStyles:(NSDictionary *)styles
211211
}
212212

213213
if (styles[@"backgroundColor"]) {
214-
self.backgroundColor = [WXConvert UIColor:styles[@"backgroundColor"]];
214+
self.styleBackgroundColor = [WXConvert UIColor:styles[@"backgroundColor"]];
215215
[self setNeedsDisplay];
216216
}
217217

@@ -307,7 +307,7 @@ - (void)resetBorder:(NSArray *)styles
307307
- (void)_resetStyles:(NSArray *)styles
308308
{
309309
if (styles && [styles containsObject:@"backgroundColor"]) {
310-
self.backgroundColor = [UIColor clearColor];
310+
self.styleBackgroundColor = [UIColor clearColor];
311311
[self setNeedsDisplay];
312312
}
313313
if (styles && [styles containsObject:@"boxShadow"]) {

0 commit comments

Comments
 (0)