diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/SearchHandlerAppearanceTracker.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/SearchHandlerAppearanceTracker.cs index 7d8e11076e63..ab7eaf2018fb 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/SearchHandlerAppearanceTracker.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/SearchHandlerAppearanceTracker.cs @@ -177,7 +177,10 @@ void UpdateSearchBarBackgroundColor(UITextField textField) backgroundView.ClipsToBounds = true; if (_defaultBackgroundColor == null) _defaultBackgroundColor = backgroundView.BackgroundColor; - backgroundView.BackgroundColor = backGroundColor.ToPlatform(); + + UIColor backgroundColor = backGroundColor.ToPlatform(); + backgroundView.BackgroundColor = backgroundColor; + textField.BackgroundColor = backgroundColor; } void UpdateCancelButtonColor(UIButton cancelButton) diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue23325Test.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue23325Test.png new file mode 100644 index 000000000000..08064cf20c08 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Issue23325Test.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23325.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue23325.xaml new file mode 100644 index 000000000000..8222f7427a86 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23325.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23325.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23325.xaml.cs new file mode 100644 index 000000000000..b030707338e5 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23325.xaml.cs @@ -0,0 +1,17 @@ +using System; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Xaml; +using Microsoft.Maui.Platform; + +namespace Maui.Controls.Sample.Issues +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + [Issue(IssueTracker.Github, 23325, "Setting background color on the Searchbar does nothing", PlatformAffected.All)] + public partial class Issue23325 : Shell + { + public Issue23325() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23325.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23325.cs new file mode 100644 index 000000000000..e9fdff30ef15 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23325.cs @@ -0,0 +1,28 @@ +#if IOS || Android +using NUnit.Framework; +using NUnit.Framework.Legacy; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue23325 : _IssuesUITest + { + public Issue23325(TestDevice device) : base(device) + { + } + + public override string Issue => "Setting background color on the Searchbar does nothing"; + + [Test] + [Category(UITestCategories.SearchBar)] + public void Issue23325Test() + { + App.WaitForElement("label"); + + // The test passes if search handler is red + VerifyScreenshot(); + } + } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue23325Test.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue23325Test.png new file mode 100644 index 000000000000..35526051ab43 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Issue23325Test.png differ