KEMBAR78
[Android] SearchBar does not update colors on theme change - fix by kubaflo · Pull Request #30601 · dotnet/maui · GitHub
Skip to content

Conversation

@kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Jul 13, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issues Fixed

Fixes #30600
Fixes #25153

Before After
Screen.Recording.2025-07-13.at.19.44.33.mov
Screen.Recording.2025-07-13.at.19.36.48.mov

@Copilot Copilot AI review requested due to automatic review settings July 13, 2025 18:08
@kubaflo kubaflo requested a review from a team as a code owner July 13, 2025 18:08
@kubaflo kubaflo self-assigned this Jul 13, 2025
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 13, 2025
@kubaflo kubaflo added platform/android area-controls-searchbar SearchBar control community ✨ Community Contribution and removed community ✨ Community Contribution labels Jul 13, 2025
Copilot

This comment was marked as outdated.

@jsuarezruiz
Copy link
Contributor

jsuarezruiz commented Jul 14, 2025

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

@kubaflo any comments on the Copilot review?

@jfversluis jfversluis self-assigned this Aug 24, 2025
@kubaflo kubaflo changed the base branch from main to inflight/candidate August 28, 2025 16:47
@kubaflo kubaflo changed the base branch from inflight/candidate to inflight/current August 28, 2025 16:48
@kubaflo kubaflo changed the base branch from inflight/current to main August 28, 2025 16:48
@kubaflo kubaflo changed the base branch from main to inflight/current August 28, 2025 16:48
@jfversluis jfversluis requested a review from Copilot August 29, 2025 08:15
Copy link
Contributor

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

This PR fixes an issue where SearchBar controls on Android do not update their colors when the device theme changes between light and dark modes. The fix ensures that SearchBar text, placeholder, and icon colors properly respond to theme changes by implementing proper theme change detection and color updates.

Key changes:

  • Added theme change detection to SearchBar controls by subscribing to Application.RequestedThemeChanged events
  • Enhanced SearchViewExtensions to properly handle default system colors and update search icon colors during theme changes
  • Added UI test coverage to verify the theme change behavior works correctly

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
SearchViewExtensions.cs Enhanced color update methods to handle system default colors and search icon tinting during theme changes
SearchBarHandler.Android.cs Added text color update call to the SearchView platform control
SearchBar.cs Added theme change event subscription to trigger property updates when app theme changes
Issue30601.cs (HostApp) Created UI test page demonstrating SearchBar theme change behavior with various color configurations
Issue30601.cs (Tests) Added automated test to verify SearchBar colors update correctly on theme change

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

/rebase

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

/rebase

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis jfversluis merged commit 490f09b into dotnet:inflight/current Sep 2, 2025
71 of 78 checks passed
@jfversluis jfversluis added this to the .NET 9 SR11 milestone Sep 2, 2025
PureWeen pushed a commit that referenced this pull request Sep 8, 2025
Update SearchViewExtensions.cs

Update SearchViewExtensions.cs

Update SearchViewExtensions.cs

Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Updated snapshots
@jfversluis jfversluis modified the milestones: .NET 9 SR11, .NET 9 SR12 Sep 12, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-searchbar SearchBar control community ✨ Community Contribution platform/android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] SearchBar does not update colors on theme change Theme issue on Search bar control in .NET MAUI

3 participants