Skip to content

Commit

Permalink
resolve background color using system trait collection
Browse files Browse the repository at this point in the history
  • Loading branch information
vovasty committed Feb 21, 2020
1 parent 7798440 commit 294229e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,10 @@ - (void)asyncTraitCollectionDidChangeWithPreviousTraitCollection:(ASPrimitiveTra
CGFloat cornerRadius = _cornerRadius;
ASCornerRoundingType cornerRoundingType = _cornerRoundingType;
UIColor *backgroundColor = _backgroundColor;
ASPrimitiveTraitCollection primitiveTraitCollection = _primitiveTraitCollection;
__instanceLock__.unlock();
UITraitCollection *traitCollection = ASPrimitiveTraitCollectionToUITraitCollection(primitiveTraitCollection);
UIColor *resolvedBackgroundColor = [backgroundColor resolvedColorWithTraitCollection:traitCollection];
CGColorRef cgBackgroundColor = resolvedBackgroundColor.CGColor;
// TODO: we should resolve color using node's trait collection
// but Texture changes it from many places, so we may receive the wrong one.
CGColorRef cgBackgroundColor = backgroundColor.CGColor;
if (!CGColorEqualToColor(_layer.backgroundColor, cgBackgroundColor)) {
// Background colors do not dynamically update for layer backed nodes since they utilize CGColorRef
// instead of UIColor. Non layer backed node also receive color to the layer (see [_ASPendingState -applyToView:withSpecialPropertiesHandling:]).
Expand Down

0 comments on commit 294229e

Please sign in to comment.