Bug 36042 - Placeholder and entered text colors for iOS SearchBar are incorrectly set
Summary: Placeholder and entered text colors for iOS SearchBar are incorrectly set
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal blocker
Target Milestone: ---
Assignee: E.Z. Hart [MSFT]
: 36074 36386 ()
Depends on:
Reported: 2015-11-19 06:54 UTC by jmgomez
Modified: 2015-11-30 22:13 UTC (History)
5 users (show)

Tags: iOS ac
Is this bug a regression?: ---
Last known good build:

Image of the text (25.30 KB, image/png)
2015-11-19 06:54 UTC, jmgomez

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description jmgomez 2015-11-19 06:54:27 UTC
With the latest update of Xamarin.Forms (2.0.0) the SearchBar Element doesn't show the text, the text is there but it doesn't get renderer (it isn't white). 

I had to rewrite the render as a workaround and it works well, so it's something related with the SearchBarRenderer (just in case, the code below only fits my needs):

public class CustomSearchBarRenderer : ViewRenderer<SearchBar, UISearchBar> {
		protected override void OnElementChanged (ElementChangedEventArgs<SearchBar> e){
			base.OnElementChanged (e);
			if (e.OldElement != null || this.Element == null)
			var nativeSearchBar = new UISearchBar ();
			SetNativeControl (nativeSearchBar);
			Control.Text = Element.Text;
			Control.Placeholder = Element.Placeholder;
			Control.SearchButtonClicked += (sender, e2) => Element.SearchCommand?.Execute(Control.Text);
			Control.CancelButtonClicked += (sender, e2) => Element.Text = "";
			Control.TextChanged += (sender, e2) => Element.Text = Control.Text;

		protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) {
			base.OnElementPropertyChanged (sender, e);
			if (e.PropertyName == "Text") 
				Control.Text = Element.Text;
			if (e.PropertyName == "Placeholder")
				Control.Placeholder = Element.Placeholder;
Comment 1 jmgomez 2015-11-19 06:54:57 UTC
Created attachment 13886 [details]
Image of the text
Comment 2 Paul DiPietro [MSFT] 2015-11-19 13:53:18 UTC
The default placeholder color of the SearchBar is also being affected, so the title has been updated to reflect this.
Comment 3 Paul DiPietro [MSFT] 2015-11-20 11:57:57 UTC
*** Bug 36074 has been marked as a duplicate of this bug. ***
Comment 4 Rui Marinho 2015-11-20 14:30:14 UTC
It will be fixed in the next hotfix for 2.0.0
Comment 5 Paul DiPietro [MSFT] 2015-11-30 22:13:13 UTC
*** Bug 36386 has been marked as a duplicate of this bug. ***