Bug 37758 - iOS EntryRenderer PlaceholderColor will always be Black
Summary: iOS EntryRenderer PlaceholderColor will always be Black
Status: RESOLVED INVALID
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-01-18 00:34 UTC by david
Modified: 2016-01-19 09:38 UTC (History)
4 users (show)

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

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:
Status:
RESOLVED INVALID

Description david 2016-01-18 00:34:56 UTC
internal static NSAttributedString ToAttributed (this Span span, Element owner, Color defaultForegroundColor)
{
	if (span == null) {
		return null;
	}
	UIFont font;
	if (span.IsDefault ()) {
		font = ((IFontElement)owner).ToUIFont ();
	}
	else {
		font = span.ToUIFont ();
	}
	Color color = span.ForegroundColor;
	if (color.IsDefault) {
		color = defaultForegroundColor;
	}
	if (color.IsDefault) {
		color = Color.Black;
	}
	return new NSAttributedString (span.Text, font, color.ToUIColor (), span.BackgroundColor.ToUIColor (), null, null, NSLigatureType.Default, 0, NSUnderlineStyle.None, null, 0, NSUnderlineStyle.None);
}

The code cited above is from FormattedStringExtensions in Xamarin.Forms.Platform.iOS.

This code will always set the PlaceholderColor to Black.
Comment 1 Stephane Delcroix 2016-01-18 13:00:36 UTC
Hi David,

From my experiments, setting the Entry.PlaceholderColor property correctly sets the placeholder color of the iOS entry, and setting it back to default sets it back to gray.

I fail to understand what's the problem you're trying to report here... so I'm closing this bug for now. Feel free to reopen with more information if appropriate.
Comment 2 david 2016-01-19 06:48:04 UTC
Stephane

I wonder if we're looking at the same code, because I quoted the code from the renderer in my report:

	if (color.IsDefault) {
		color = defaultForegroundColor;
	}
	if (color.IsDefault) {
		color = Color.Black;
	}


The same condition is tested and two different results are applied. Obviously the eventual result will come from the decode conditional.

If this has been fixed already, great!
Comment 3 david 2016-01-19 06:54:08 UTC
"The same condition is tested and two different results are applied. Obviously the eventual result will come from the *second* conditional."
Comment 4 Stephane Delcroix 2016-01-19 08:02:41 UTC
Hi David,

Thanks for doing code review for us, but the code looks right to me.

I'm reclosing this unless you can come up with an example showing the behavior of the Placeholder color for entries is faulty.

Warm regards,

The xF team
Comment 5 david 2016-01-19 09:38:17 UTC
Doh! My bad. Sorry for the noise.