Skip to content

iconTint has no effect on shield icon — withTintColor result is discarded #90

@Talha345

Description

@Talha345

Description

Setting iconTint in updateShield / ShieldConfiguration has no visible effect. The tint color is silently ignored regardless of what value is passed.

Root Cause

In targets/ShieldConfiguration/ShieldConfigurationExtension.swift, the resolveIcon function calls withTintColor but doesn't assign the result back:

// Current (broken) — result is discarded

  if let iconTint = getColor(color: dict["iconTint"] as? [String: Double]) {
      image?.withTintColor(iconTint)
  }

UIImage.withTintColor(_:) is not a mutating method — it returns a new UIImage. The tinted image is created and immediately thrown away, so image is returned untouched.

Fix

  if let iconTint = getColor(color: dict["iconTint"] as? [String: Double]) {
      image = image?.withTintColor(iconTint, renderingMode: .alwaysOriginal)
  }

Using .alwaysOriginal rendering mode ensures the tint colour is preserved and not overridden by the system.

Steps to Reproduce

  1. Call updateShield with any iconSystemName and a non-default iconTint colour
  2. Trigger the shield — the icon renders in its default system colour, not the specified tint

Environment

  • react-native-device-activity version: 0.5.1

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions