Skip to content

Commit

Permalink
Use backgroundColor ivar instead of property access in traitCollectio…
Browse files Browse the repository at this point in the history
…nDidChange (#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.
  • Loading branch information
rahul-malik authored Sep 18, 2019
1 parent 06ab67a commit ee18b9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ - (void)asyncTraitCollectionDidChangeWithPreviousTraitCollection:(ASPrimitiveTra
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
Expand Down

0 comments on commit ee18b9c

Please sign in to comment.