Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,14 @@ void SearchButtonClicked(object sender, EventArgs e)

void SetSearchBarIcon(UISearchBar searchBar, ImageSource source, UISearchBarIcon icon)
{
source.LoadImage(source.FindMauiContext(), image =>
var mauiContext = source.FindMauiContext(true);

if (mauiContext is null)
{
return;
}

source.LoadImage(mauiContext, image =>
{
var result = image?.Value;
if (result != null)
Expand All @@ -822,6 +829,11 @@ void OnPageLoaded(object sender, EventArgs e)
}

UpdateToolbarItemsInternal();

//UIKIt will try to override our colors when the SearchController is inside the NavigationBar
//Best way was to force them to be set again when page is loaded / ViewDidLoad
_searchHandlerAppearanceTracker?.UpdateSearchBarColors();

CheckAppeared();
}

Expand All @@ -843,9 +855,6 @@ void SetAppeared()
return;

_isVisiblePage = true;
//UIKIt will try to override our colors when the SearchController is inside the NavigationBar
//Best way was to force them to be set again when page is Appearing / ViewDidLoad
_searchHandlerAppearanceTracker?.UpdateSearchBarColors();
UpdateShellToMyPage();

if (_context.Shell.Toolbar != null)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue20250.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 20250, "[iOS] SearchHandler ClearPlaceholderIcon color", PlatformAffected.iOS)]
public partial class Issue20250 : TestShell
{

protected override void Init()
{
this.FlyoutBehavior = FlyoutBehavior.Flyout;

var shellContent = new ShellContent
{
Title = "Home",
Route = "MainPage",
Content = new Issue20250ContentPage() { Title = "Home" }
};

Items.Add(shellContent);

}
class Issue20250ContentPage : ContentPage
{
public Issue20250ContentPage()
{
Shell.SetSearchHandler(this, new SearchHandler
{
AutomationId = "searchHandler",
Placeholder = "Search",
TextColor = Colors.Red,
ClearPlaceholderEnabled = true,
ClearPlaceholderIcon = "bank.png",

});

this.SetBinding(TitleProperty, new Binding("Title", source: Shell.Current));

Content = new Label
{
Text = "SearchHandler",
AutomationId = "label",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
};
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#if TEST_FAILS_ON_WINDOWS // On Windows, the ClearPlaceholderIcon is not displayed in the SearchHandler.
// Issue: https://github.com/dotnet/maui/issues/28619
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue20250 : _IssuesUITest
{
public override string Issue => "[iOS] SearchHandler ClearPlaceholderIcon color";

public Issue20250(TestDevice device)
: base(device)
{ }

[Test]
[Category(UITestCategories.Shell)]
public void VerifySearchHandlerClearPlaceholderIconColor()
{
App.WaitForElement("label");
VerifyScreenshot();
}
}

#endif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading