Skip to content

Fix iconTint ignored in ShieldConfiguration#91

Merged
robertherber merged 2 commits intomainfrom
copilot/fix-icon-tint-on-shield-icon
Feb 19, 2026
Merged

Fix iconTint ignored in ShieldConfiguration#91
robertherber merged 2 commits intomainfrom
copilot/fix-icon-tint-on-shield-icon

Conversation

Copy link
Contributor

Copilot AI commented Feb 18, 2026

iconTint parameter was silently ignored when configuring shield icons. UIImage.withTintColor(_:) returns a new instance rather than mutating—the tinted image was created and immediately discarded.

Changes

  • Assign withTintColor result back to image variable
  • Use .alwaysOriginal rendering mode to prevent system override
// Before
if let iconTint = getColor(color: dict["iconTint"] as? [String: Double]) {
    image?.withTintColor(iconTint)  // Result discarded
}

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

Location: packages/react-native-device-activity/targets/ShieldConfiguration/ShieldConfigurationExtension.swift:64

Original prompt

This section details on the original issue you should resolve

<issue_title>iconTint has no effect on shield icon — withTintColor result is discarded</issue_title>
<issue_description>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
    </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: robertherber <1467411+robertherber@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix iconTint effect on shield icon Fix iconTint ignored in ShieldConfiguration Feb 18, 2026
Copilot AI requested a review from robertherber February 18, 2026 19:09
@robertherber robertherber marked this pull request as ready for review February 19, 2026 00:20
Copilot AI review requested due to automatic review settings February 19, 2026 00:20
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 19, 2026

Open in StackBlitz

npm i https://pkg.pr.new/kingstinct/react-native-device-activity@91

commit: 1a2b1ce

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes shield icon tinting in the ShieldConfiguration extension by applying the result of UIImage.withTintColor instead of discarding it, ensuring iconTint actually affects the rendered icon.

Changes:

  • Assign the tinted image back to image when iconTint is provided.
  • Use .alwaysOriginal rendering mode to prevent the system from overriding the tint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@robertherber robertherber merged commit f943fd7 into main Feb 19, 2026
16 checks passed
@robertherber robertherber deleted the copilot/fix-icon-tint-on-shield-icon branch February 19, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants

Comments