Xamarin Forms Searchbar iOS 13 ignores background color

You can solve this by creating a PlatformEffect:

App.xaml.cs

[assembly: ResolutionGroupName("ProjectName")]
namespace ProjectName.App
{
    public partial class App : Application
    {
        ...

Shared project:

public class SearchBarBackgroundEffect : RoutingEffect
    {
        public SearchBarBackgroundEffect() : base("ProjectName.SearchBarBackgroundEffect") { }
    }

iOS project:


[assembly: ExportEffect(typeof(SearchBarBackgroundPlatformEffect), "SearchBarBackgroundEffect")]
 public class SearchBarBackgroundPlatformEffect : PlatformEffect
    {
        private UISearchBar NativeSearchBar => (UISearchBar)Control;
        private SearchBar XamarinSearchBar => (SearchBar)Element;

        protected override void OnAttached()
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
                NativeSearchBar.SearchTextField.BackgroundColor = XamarinSearchBar.BackgroundColor.ToUIColor();
        }

        protected override void OnDetached()
        {
             // Intentionally left blank.
        }
    }

XAML File

 <SearchBar>
                <SearchBar.Effects>
                    <effects:SearchBarBackgroundEffect />
                </SearchBar.Effects>
            </SearchBar>

If you are facing this issue, this definitely is a bug that needs to be fixed by Xamarin Forms.

It was introduced in iOS 13 when a new Property was introduced. As I mentioned here, they have to place a conditional check for iOS 13 and set the BackgroundColor of the SearchBar.

You could open an issue in Xamarin Forms on GitHub, and for now use a CustomRenderer to fix this locally.