Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freeze/Crash when using secure TextField #1095

Open
Hackmodford opened this issue Feb 16, 2021 · 3 comments
Open

Freeze/Crash when using secure TextField #1095

Hackmodford opened this issue Feb 16, 2021 · 3 comments

Comments

@Hackmodford
Copy link

I am using the MDC for text fields in my native Xamarin ios app.

If I set the secureTextEntry to true, the app freezes and eventually crashes when trying to enter text.

I believe this is related to this stackoverflow post and this Github issue.

The Github issue mentions this was a bug that was fixed in a newer version. Are they any plans on updating these components?

@keozx
Copy link

keozx commented Apr 21, 2021

In my case is only when I have 2 TextFields with SecureTextEntry as true :/

@merckxite
Copy link

This was affecting me also, however I combed through some PR's in the Material Components library and created a workaround until the bindings are updated. Turns out there is an issue with setting TextColor in the MDCTextField somewhere up the chain that is causing an infinite loop when SecureTextEntry is true (This commit and this PR led me to this).

To fix for now, create a custom TextField (MDCTextField) subclass if you don't have one already and override the TextColor property, adding a check like this:

public override UIColor TextColor
{
    get => base.TextColor;
    set
    {
        if (value != base.TextColor)
            base.TextColor = value;
    }
}

Use this class in place of where you would usually use TextField and it should get you by for now 🙂

@keozx
Copy link

keozx commented Apr 28, 2021

Thanks @merckxite it works! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants