This repository was archived by the owner on Jun 3, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-11
lines changed Expand file tree Collapse file tree 3 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -349,13 +349,15 @@ - (void)_drawBorderWithContext:(CGContextRef)context size:(CGSize)size
349
349
350
350
CGContextSetAlpha (context, _opacity);
351
351
// fill background color
352
- if (_backgroundColor && CGColorGetAlpha (_backgroundColor.CGColor ) > 0 ) {
353
- CGContextSetFillColorWithColor (context, _backgroundColor.CGColor );
354
- UIBezierPath *bezierPath = [UIBezierPath wx_bezierPathWithRoundedRect: rect topLeft: topLeft topRight: topRight bottomLeft: bottomLeft bottomRight: bottomRight];
355
- [bezierPath fill ];
356
- WXPerformBlockOnMainThread (^{
357
- _view.backgroundColor = UIColor.clearColor ;
358
- });
352
+ @synchronized (self) {
353
+ if (_backgroundColor && CGColorGetAlpha (_backgroundColor.CGColor ) > 0 ) {
354
+ CGContextSetFillColorWithColor (context, _backgroundColor.CGColor );
355
+ UIBezierPath *bezierPath = [UIBezierPath wx_bezierPathWithRoundedRect: rect topLeft: topLeft topRight: topRight bottomLeft: bottomLeft bottomRight: bottomRight];
356
+ [bezierPath fill ];
357
+ WXPerformBlockOnMainThread (^{
358
+ _view.backgroundColor = UIColor.clearColor ;
359
+ });
360
+ }
359
361
}
360
362
// Top
361
363
if (_borderTopWidth > 0 ) {
Original file line number Diff line number Diff line change @@ -857,7 +857,9 @@ - (void)setGradientLayer
857
857
UIColor * endColor = (UIColor*)linearGradient[@" endColor" ];
858
858
CAGradientLayer * gradientLayer = [WXUtility gradientLayerFromColors: @[startColor, endColor] locations: nil frame: strongSelf.view.bounds gradientType: (WXGradientType)[linearGradient[@" gradientType" ] integerValue ]];
859
859
if (gradientLayer) {
860
- _backgroundColor = [UIColor colorWithPatternImage: [strongSelf imageFromLayer: gradientLayer]];
860
+ @synchronized (strongSelf) {
861
+ _backgroundColor = [UIColor colorWithPatternImage: [strongSelf imageFromLayer: gradientLayer]];
862
+ }
861
863
strongSelf.view .backgroundColor = _backgroundColor;
862
864
[strongSelf setNeedsDisplay ];
863
865
}
Original file line number Diff line number Diff line change @@ -193,7 +193,9 @@ - (void)_transitionUpdateViewProperty:(NSDictionary *)styles
193
193
{
194
194
WX_CHECK_COMPONENT_TYPE (self.componentType )
195
195
if (styles[@" backgroundColor" ]) {
196
- _backgroundColor = [WXConvert UIColor: styles[@" backgroundColor" ]];
196
+ @synchronized (self) {
197
+ _backgroundColor = [WXConvert UIColor: styles[@" backgroundColor" ]];
198
+ }
197
199
}
198
200
if (styles[@" opacity" ]) {
199
201
_opacity = [WXConvert CGFloat: styles[@" opacity" ]];
@@ -211,7 +213,9 @@ - (void)_updateViewStyles:(NSDictionary *)styles
211
213
}
212
214
213
215
if (styles[@" backgroundColor" ]) {
214
- _backgroundColor = [WXConvert UIColor: styles[@" backgroundColor" ]];
216
+ @synchronized (self) {
217
+ _backgroundColor = [WXConvert UIColor: styles[@" backgroundColor" ]];
218
+ }
215
219
[self setNeedsDisplay ];
216
220
}
217
221
@@ -307,7 +311,9 @@ - (void)resetBorder:(NSArray *)styles
307
311
- (void )_resetStyles : (NSArray *)styles
308
312
{
309
313
if (styles && [styles containsObject: @" backgroundColor" ]) {
310
- _backgroundColor = [UIColor clearColor ];
314
+ @synchronized (self) {
315
+ _backgroundColor = [UIColor clearColor ];
316
+ }
311
317
[self setNeedsDisplay ];
312
318
}
313
319
if (styles && [styles containsObject: @" boxShadow" ]) {
You can’t perform that action at this time.
0 commit comments