Skip to content

[iOS][Regression] Fix ToolbarItem color when used with IconImageSource is always default color#26048

Merged
PureWeen merged 14 commits intodotnet:mainfrom
devanathan-vaithiyanathan:fix-25912
Dec 6, 2024
Merged

[iOS][Regression] Fix ToolbarItem color when used with IconImageSource is always default color#26048
PureWeen merged 14 commits intodotnet:mainfrom
devanathan-vaithiyanathan:fix-25912

Conversation

@devanathan-vaithiyanathan
Copy link
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Nov 22, 2024

Root cause

The regression occurred because a previous PR changed the UIImageRenderingMode to Automatic, which caused the ToolbarItem icon to ignore the FontImageSource.Color.

Description of Change

To address this issue, the TintColor is explicitly set to the platform-specific equivalent of FontImageSource.Color. This ensures the toolbar icon respects and correctly displays the specified color.

Regressed PR

Issues Fixed

Fixes #25912

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Output Screenshot

Before After

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 22, 2024
@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title [iOS][Regression] Fix ToolbarItem color when used with IconImageSource is always white [iOS][Regression] Fix ToolbarItem color when used with IconImageSource is always default color Nov 22, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz jsuarezruiz added area-controls-toolbar ToolBar t/bug Something isn't working labels Nov 22, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@devanathan-vaithiyanathan devanathan-vaithiyanathan marked this pull request as ready for review November 22, 2024 15:01
@devanathan-vaithiyanathan devanathan-vaithiyanathan requested a review from a team as a code owner November 22, 2024 15:01
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen added the p/0 Current heighest priority issues that we are targeting for a release. label Nov 23, 2024
Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

The regression is due this change https://github.com/dotnet/maui/pull/22437/files#diff-48977a1f6983e847819315f0fcab9bc88a0bf15ba282e24616895a7c65713774 and impact:

Could we fix also the menus in this PR?



<ContentPage.Content>
<Label Text="ToolbarItemIconColorTest" AutomationId="Label"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Could modify the sample to change the ToolbarItem color at runtime?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per your suggestion, I have modified the test case. Could you please validate the changes?

@devanathan-vaithiyanathan
Copy link
Contributor Author

The regression is due this change https://github.com/dotnet/maui/pull/22437/files#diff-48977a1f6983e847819315f0fcab9bc88a0bf15ba282e24616895a7c65713774 and impact:

Could we fix also the menus in this PR?

The issue does not occur when using IconImageSource with MenuItem.

@rmarinho
Copy link
Member

/azp run

@rmarinho rmarinho added this to the .NET 9 SR2 milestone Nov 26, 2024
@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@sheiksyedm sheiksyedm added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 6, 2024
@PureWeen
Copy link
Member

PureWeen commented Dec 6, 2024

I think this fix works for this scenario but I'm curious if we can more generally apply this to ImageSourceExtensions

The color gets applied via an AttributeString

image

Would it makes sense to just apply the TintColor here

image

So it's always just applied when using FontImages?

@PureWeen PureWeen merged commit 23e1522 into dotnet:main Dec 6, 2024
@samhouts samhouts added fixed-in-9.0.21 fixed-in-net8.0-nightly This may be available in a nightly release! labels Dec 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-toolbar ToolBar community ✨ Community Contribution fixed-in-9.0.21 fixed-in-net8.0-nightly This may be available in a nightly release! p/0 Current heighest priority issues that we are targeting for a release. partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios t/bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[9.0] [iOS] [Regression] - ToolbarItem color when used with IconImageSource is always white.

6 participants