Use backgroundColor ivar instead of property access in traitCollectionDidChange (#1678)

traitCollectionDidChange isn't necessarily called on Main, but our self.backgroundColor property access must be done on main once the view is loaded.

I originally opted to use self.backgroundColor rather than _backgroundColor in #1674, but I think we should use the ivar here. This could get out-of-sync if someone modified the UIView's background color instead of updating the node, but I think that's unlikely, so we should be safe to use the ivar here.
This commit is contained in:
Rahul Malik
2019-09-18 09:15:32 -07:00
committed by GitHub
parent 06ab67a3aa
commit ee18b9cd6c
+1 -1
View File
@@ -445,7 +445,7 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__);
BOOL needsClippingCornerUpdate = NO;
CGFloat cornerRadius = _cornerRadius;
ASCornerRoundingType cornerRoundingType = _cornerRoundingType;
UIColor *backgroundColor = self.backgroundColor;
UIColor *backgroundColor = _backgroundColor;
if (_loaded(self)) {
if (self.isLayerBacked) {
// Background colors do not dynamically update for layer backed nodes since they utilize CGColorRef