Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] PlaceholderColor on Entry does not work when global Span TextColor style is set #11425

Closed
acuntex opened this issue Jul 14, 2020 · 0 comments
Labels
a/entry a/style e/2 🕑 2 in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛

Comments

@acuntex
Copy link
Contributor

acuntex commented Jul 14, 2020

Description

When setting a PlaceholderColor on an Entry while there is a global style for Span setting TextColor, the PlaceholderColor will not work but instead show the TextColor defined in the global style for Span as PlaceholderColor.
I created a repository with a repro: https://github.com/acuntex/XamarinBug_EntryPlaceHolderColor
Here is what has been changed: acuntex/XamarinBug_EntryPlaceHolderColor@74ab16d

Steps to Reproduce

  1. Add global style for Span in App.xaml (Application.Resources)
        <Style TargetType="Span">
            <Setter Property="TextColor" Value="Blue" />
        </Style>

  1. Add Entry with Placeholder and PlaceholderColor to some View
            <Entry Placeholder="This placeholder should be red but it is blue because of the global Span TextColor style."
                    PlaceholderColor="Red"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="CenterAndExpand">
            </Entry>

Expected Behavior

The Placeholder shows the placeholder in the Color defined by PlaceholderColor.

Actual Behavior

The Placeholder shows the placeholder in the Color defined by the global TextColor style of Span.

Basic Information

  • Version with issue: 4.7.0.1080
  • Last known good version: None
  • IDE: Visual Studio for Mac
  • Platform Target Frameworks:
    • iOS: 13.5
  • Nuget Packages: Xamarin.Forms
  • Affected Devices: All iOS Devices

Screenshots

Reproduction Link

https://github.com/acuntex/XamarinBug_EntryPlaceHolderColor/
acuntex/XamarinBug_EntryPlaceHolderColor@74ab16d

Workaround

    public class CustomEntryRenderer: EntryRenderer
    {
        protected override void UpdatePlaceholder()
        {
            UIFont font = UIFont.FromName(Element.FontFamily, (float) Element.FontSize);
            UpdateAttributedPlaceholder(new NSAttributedString(Element.Placeholder, font, Element.PlaceholderColor.ToUIColor(), Element.BackgroundColor.ToUIColor()));
        }
    }

@acuntex acuntex added s/unverified New report that has yet to be verified t/bug 🐛 labels Jul 14, 2020
@pauldipietro pauldipietro added this to New in Triage Jul 14, 2020
@jsuarezruiz jsuarezruiz added a/entry p/iOS 🍎 a/style e/2 🕑 2 and removed s/unverified New report that has yet to be verified labels Jul 14, 2020
@jsuarezruiz jsuarezruiz moved this from New to Ready For Work in Triage Jul 14, 2020
@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Jul 14, 2020
@samhouts samhouts added this to In Progress in 4.7.0 Jul 14, 2020
@samhouts samhouts added this to To do in iOS Ready For Work Jul 21, 2020
@samhouts samhouts removed this from Ready For Work in Triage Jul 21, 2020
@samhouts samhouts moved this from To do to In progress in iOS Ready For Work Jul 21, 2020
@samhouts samhouts removed this from In Progress in 4.7.0 Jul 28, 2020
iOS Ready For Work automation moved this from In progress to Done Jul 30, 2020
@samhouts samhouts added this to In Progress in vCurrent (4.8.0) Jul 30, 2020
@samhouts samhouts moved this from In Progress to Done in vCurrent (4.8.0) Jul 30, 2020
@samhouts samhouts removed this from Done in iOS Ready For Work Aug 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/entry a/style e/2 🕑 2 in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛
Projects
No open projects
Development

No branches or pull requests

3 participants