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

[Bug] iOS 14 App freezes when password is entered after email #12246

Closed
mtsrdr opened this issue Sep 25, 2020 · 38 comments · Fixed by #12316
Closed

[Bug] iOS 14 App freezes when password is entered after email #12246

mtsrdr opened this issue Sep 25, 2020 · 38 comments · Fixed by #12316
Assignees
Labels
a/visual e/3 🕒 3 in-progress This issue has an associated pull request that may resolve it! iOS 14 m/high impact ⬛ p/iOS 🍎 t/bug 🐛
Milestone

Comments

@mtsrdr
Copy link

mtsrdr commented Sep 25, 2020

Description

When you are using Xamarin.Forms.Visual.Material package and create a style like this:

        <Style TargetType="Entry">
            <Setter Property="BackgroundColor" Value="#DCDCDC" />
            <Setter Property="PlaceholderColor" Value="#454344" />
            <Setter Property="TextColor" Value="Black" />
        </Style>

And create a layout like this:

        <StackLayout Padding="16" VerticalOptions="Center">
            <Entry
                x:Name="EmailEntry"
                Visual="Material"
                Keyboard="Email"
                Placeholder="Email" />
            <Entry
                x:Name="PasswordEntry"
                Visual="Material"
                IsPassword="True"
                Placeholder="Password" />
            <Button 
                x:Name="LoginButton"
                Visual="Material"
                Text="Login" />
            <ActivityIndicator 
                x:Name="BusyIndicator"
                Visual="Material"
                IsRunning="False"
                IsVisible="{Binding Source={x:Reference BusyIndicator}, Path=IsRunning}" />
        </StackLayout>

Then the following behavior occurs:

  • If a username is entered and then a password is entered, focus is locked on the password control and nothing else on the screen (like the login button or the username control) can be tapped.
  • If a password is entered and then a username is entered, focus is not locked and all controls react to taps normally. The password can even be re-entered without focus being locked.

More details in: https://forums.xamarin.com/discussion/185124/xcode12-ios-14-breaking-entry-controls

Steps to Reproduce

  1. Run the attached project on iOS 14
  2. Enter an email
  3. Then enter a password

Expected Behavior

Focus is not locked and all controls react to taps normally

Actual Behavior

Focus is locked on the password control and nothing else on the screen can be tapped

Basic Information

  • Version with issue: 4.8
  • IDE: Visual Studio for Mac 8.8 (Preview)
  • Platform Target Frameworks:
    • iOS: 14.0 (XCode 12)
  • Nuget Packages:
    • Xamarin.Forms.Visual.Material
  • Affected Devices:
    • iOS Simulator: 14.0 (Haven't tested on physical device)

Screenshots

Reproduction Link

EntryTest.zip

Workaround

@mtsrdr mtsrdr added s/unverified New report that has yet to be verified t/bug 🐛 labels Sep 25, 2020
@samhouts samhouts added this to New in Triage Sep 25, 2020
@inimirpaz
Copy link

inimirpaz commented Sep 25, 2020

Same here, this issue is pretty serious as it prevents iOS 14 users to login in into the apps!
The issue is with Visual="Material" in Entries with IsPassword="True". As a workaround, try to get rid of that attribute, it should work.

@Sivaraman761
Copy link

I am too, Faced the same issue.

@MattePozzy
Copy link

Same issue here.
When a fix?
In our business application we can't have a different style for some Entries.

@vecalion
Copy link

We're experiencing similar issue in our project. The iOS app freezes when tries to navigate to a page with two entries (Visual = "Material"). Works OK if there is only one entry on the page. Also works OK without Visual = "Material".

@samhouts, I would say this is a critical issue, isn't it?

@nikkla19
Copy link

Same Problem here. I'cant release my app unless it is fixed. Without Visual = "Material" the app is not so pretty...

@nikkla19
Copy link

I have tested it on a real device (iPhone SE 2020) on iOS 14.0.0 and 14.0.1.

@freever
Copy link

freever commented Sep 25, 2020

Plus one for me - also getting it with the password entries. It's super nasty

@jBijsterboschNL
Copy link

We also experience the same issue. We are using the latest Xamarin.Forms version (v4.8.xxx). We have an Entry field and have set Visual="Material" and IsPassword="True". It only occurs on iOS 14 devices (on emulators and fysical devices). Anyone has a work-around for this? Or the Xamarin.Forms team has any idea how to work-around this for now, until a decent fix is released?

@LucGal
Copy link

LucGal commented Sep 25, 2020

I'm facing the same issue both on simulator and real device. Urgent fix needed!

@oythorsen
Copy link

Same issue here also. Tested on iPhone 8 and Simulator. Using Xamarin.Forms version (v4.6.0.1180). Also tested on latest v4.8.xxx, but not using that due to error with Frame CornerRadius error (not showing rounded corners)

@marcojak
Copy link

Same here, tested on simulator and my iPad with iOS 14. Some of my clients have the same issue too.
No problem with devices with iOS <14

@hartez hartez added iOS 14 p/iOS 🍎 and removed s/unverified New report that has yet to be verified labels Sep 29, 2020
@hartez
Copy link
Contributor

hartez commented Sep 30, 2020

Well, this is a weird one.

Here's my repro for this:

var layout = new StackLayout() { Padding = 16, VerticalOptions = LayoutOptions.Center};

var entry = new Entry() {  Visual = VisualMarker.Material, Keyboard = Keyboard.Email, Placeholder = "Email", TextColor = Color.Purple };
//var password = new Entry { Visual = VisualMarker.Material, IsPassword = true, Placeholder = "Password", TextColor = Color.Purple }; // App locks up

var color3 = Color.FromRgba(Color.Purple.R, Color.Purple.G, Color.Purple.B, Color.Purple.A - 0.01);
var password = new Entry {  Visual = VisualMarker.Material, IsPassword = true, Placeholder = "Password", TextColor = color3 }; // Works fine

layout.Children.Add(entry);
layout.Children.Add(password);

Content = layout;

If the two entries have the same TextColor, the app locks up if you follow the steps upthread. Only seems to happen with TextColor; PlaceholderColor and BackgroundColor don't cause it (though other properties may, I haven't test them).

If the TextColors are set to different values, no issues - everything works fine. A copy of the color variable isn't enough - it needs to be an actually different value (note the very slight opacity change; if we change Color.Purple.A - 0.01 to Color.Purple.A, the issue pops up again).

@ManfredRohleder
Copy link

ManfredRohleder commented Sep 30, 2020

@hartez Your comment put me on the right track. I tested the following workaround and it works again.

Before

<Entry x:Name="txtPassword" 
                                Text="{Binding Password}" Margin="30,0,30,0"
                                TextColor="{DynamicResource TextThemeColor}"
                                Placeholder="Passwort"
                                IsPassword="True"
                                PlaceholderColor="{DynamicResource TextThemeColor}"
                                ClearButtonVisibility="WhileEditing"/>

After

<Entry x:Name="txtPassword" 
                                Text="{Binding Password}" Margin="30,0,30,0"
                                TextColor="{DynamicResource TextThemeColorPassword}"
                                Placeholder="Passwort"
                                IsPassword="True"
                                PlaceholderColor="{DynamicResource TextThemeColorPassword}"
                                ClearButtonVisibility="WhileEditing"/>

In my theme files (DarkTheme.xaml and LightTheme.xaml) I made the following changes.

DarkTheme.xaml

<Color x:Key="TextThemeColor">#e7e7e7</Color>
    <Color x:Key="TextThemeColorPassword">#e7e7e6</Color>

LightTheme.xaml

<Color x:Key="TextThemeColor">#55575c</Color>
    <Color x:Key="TextThemeColorPassword">#55575b</Color>

@jsuarezruiz jsuarezruiz moved this from New to Needs Estimate in Triage Sep 30, 2020
@LucGal
Copy link

LucGal commented Sep 30, 2020

If you have more than one password text in the same Page (eg Change password feature) setting a different color don't work for me. If you don't set any color (remove TextColor = ".....") it works fine..

@jBijsterboschNL
Copy link

@hartez, you saved my day! :) great find! Although this is obscure for sure, but rather a work-around then my users being unable to login! Thanks!!

@hartez hartez self-assigned this Sep 30, 2020
@hartez hartez added this to To do in iOS Ready For Work via automation Sep 30, 2020
@hartez hartez removed this from Needs Estimate in Triage Sep 30, 2020
@samhouts samhouts added this to the 5.0.0 milestone Sep 30, 2020
@Baophp1805e
Copy link

Delete Visual Material, It works.

@hartez Did you try with prism ? I have changed color between entrys, The first that screen it work, but when I back to it, My iOS 14 App freezes . Example Screen 1: Login, Screen 2: Home, From App run the first -> Login -> Home, It's work! But Form Home -> Logout back to Login, iOS 14 App freezes ...

@SteveGrixti-Remax
Copy link

I am experiencing the same issue too. Since upgrading to IOS 14 in my login page, if the user first enters the email and then the password the application freezes. However, if the user enters the password first and then the email, the application does not freeze and proceeds..

I can also confirm that changing the color of the entries for some miraculous reason fixes this issue .. 😂

Any idea when this will be fixed? As due to this reason, users are unable to log in to the app..

@hartez
Copy link
Contributor

hartez commented Oct 6, 2020

Any idea when this will be fixed? As due to this reason, users are unable to log in to the app..

Can't say when it will be fixed, since it's an issue with either iOS or the iOS Material library. But Forms has a workaround for it in the works: #12316

After that's merged and released, you shouldn't have to manually fix the colors to make it work.

@hartez
Copy link
Contributor

hartez commented Oct 6, 2020

Delete Visual Material, It works.

@hartez Did you try with prism ? I have changed color between entrys, The first that screen it work, but when I back to it, My iOS 14 App freezes . Example Screen 1: Login, Screen 2: Home, From App run the first -> Login -> Home, It's work! But Form Home -> Logout back to Login, iOS 14 App freezes ...

What happens if you use different colors for every Entry on those pages? Not just different colors for the Entries on a single page, but for every single Entry. I'm wondering if Prism is keeping two instances of pages using a single color around, and that's why you're seeing the application hang.

@NeilN1
Copy link

NeilN1 commented Oct 7, 2020

While we wait for the workaround to be released, has anyone successfully implemented a version of the workaround in their code? I tried the below but it didn't work.

    static double AlphaAdjustment = 0.0;

    public LoginPage()
    {
        Title = "Login";
        InitializeComponent();
        PasswordEntry.TextColor = AdjustTextColor(PasswordEntry);
    }
    static Color AdjustTextColor(Entry element)
    {

        var elementTextColor = element.TextColor;
        AlphaAdjustment += 0.0000001;

        var adjustedAlpha = elementTextColor.A - AlphaAdjustment;
        if (adjustedAlpha < 0)
        {
            adjustedAlpha = 0;
        }

        return new Color(elementTextColor.R, elementTextColor.G, elementTextColor.B, adjustedAlpha);
    }

@rhaly
Copy link

rhaly commented Oct 8, 2020

It looks like it's solved in native Material Components iOS library.
https://github.com/material-components/material-components-ios/issues/10081

Wouldn't be better to release new binding for Material Components library than weird workaround with colors which does not work in every scenario?

iOS Ready For Work automation moved this from To do to Done Oct 9, 2020
vCurrent (4.8.0) automation moved this from In Progress to Done Oct 9, 2020
@hartez
Copy link
Contributor

hartez commented Oct 14, 2020

It looks like it's solved in native Material Components iOS library.
material-components/material-components-ios#10081

Wouldn't be better to release new binding for Material Components library than weird workaround with colors which does not work in every scenario?

@rhaly That's absolutely the ideal scenario, and we're looking into it. Believe me, the color workaround is not our first choice. But it's the option that we could get out the door quickly while we figure out whether we can do a material components update, verify that it fixes the problem, and figure out timings/releases.

@nikkla19
Copy link

In my case the workaround doesn't fix the problem... I tested to change the visual to default but it did not help me..
I don't know whats going on here..

@janschoelchAtOK
Copy link

janschoelchAtOK commented Oct 21, 2020

Why is this even closed? @samhouts @hartez

  • There might be a workaround but this is not a fix at all. Shouldn't this ticket be held open until a verified, solid and stable fix is out? I did not find any issue in Issues stating that there is a need for a proper fix.
  • material-components/material-components-ios#10081 is a confirmed fix. Is there an issue for following-up the status of the binding update? I did not find any.
  • The workaround might work, but only in most basic scenarios. For instance, setting a CharacterSpacing on the Entry makes the app freeze again. This prevents almost all of our (few thousand) iOS users from signing in.

What is your advice for developers here?

  • Moving from XF4.6 to XF4.8 means breaking changes for us. In almost every other case the team states that backwards compatibility is most important, but in this case, conventions seem to be ignored.
  • Will the workaround - as this issue is closed - be around forever now? The release notes state that that this is an "Issue Fixed".

@rhaly
Copy link

rhaly commented Oct 21, 2020

@janschoelchAtOK in our team we decided to downgrade Xcode to 11.7 and Xamarin.iOS to 13.20.2.2.

@hartez
Copy link
Contributor

hartez commented Oct 21, 2020

@janschoelchAtOK As I mentioned upthread, we're looking at updating the Material Components. If and when we can do that, we'll remove the color workaround.

The workaround might work, but only in most basic scenarios. For instance, setting a CharacterSpacing on the Entry makes the app freeze again.

We were unaware of this. Could you open a new issue and post the properties you're setting on your Entry and Password controls? And tag me in the issue - I'll take a look. It may be that when the renderer applies the character spacing, it's having to reset some other properties on the native control and it's override the color workaround. Or we may just have to come up with a different workaround.

@hartez
Copy link
Contributor

hartez commented Oct 21, 2020

  • Moving from XF4.6 to XF4.8 means breaking changes for us.

Which breaking changes are you referring to?

@janschoelchAtOK
Copy link

Which breaking changes are you referring to?

We faced crashes and flaky UI when moving to XF4.8 as Brushes now are heavily included in the platform renderers. We still investigate and we will try to create issues for everything we find (+ workarounds).

@janschoelchAtOK
Copy link

We were unaware of this. Could you open a new issue and post the properties you're setting on your Entry and Password controls? And tag me in the issue - I'll take a look. It may be that when the renderer applies the character spacing, it's having to reset some other properties on the native control and it's override the color workaround. Or we may just have to come up with a different workaround.

Thanks for following-up. Will do! Stay tuned as we might need some time to fully investigate what exactly is affected by this bug/workaround and what comes from the XF update.

@NeilN1
Copy link

NeilN1 commented Oct 22, 2020

Did upgrading to 4.8.0.1560 fix this issue for anyone? Still seeing the same freezing behaviour.

@mina5500
Copy link

mina5500 commented Nov 3, 2020

any update ?
@samhouts is it fixed yet ?

@ArtjomP
Copy link

ArtjomP commented Nov 9, 2020

4.8.0.1560 freezing still

@mina5500
Copy link

mina5500 commented Nov 9, 2020

i tested on latest version 4.8.0.1560
and it is working fine

@mina5500
Copy link

mina5500 commented Nov 9, 2020

may be the order of the attributes matter

<H:HEntry FontSize="15" HeightRequest="60" Margin="-3" TextColor="White" Placeholder="User Name" PlaceholderColor="White" x:Name="usernameEntry" Keyboard="Email" BackgroundColor="Transparent" Unfocused="Entry_OnUnfocused" Focused="Entry_OnFocused" ReturnType="Next" TextChanged="usernameEntry_TextChanged" />
<H:HEntry FontSize="15" HeightRequest="60" Margin="-3" TextColor="White" Placeholder="Password" IsPassword="true" PlaceholderColor="White" x:Name="passwordEntry" BackgroundColor="Transparent"  Unfocused="Entry_OnUnfocused" Focused="Entry_OnFocused" Completed="OnLoginButtonClicked" TextChanged="passwordEntry_TextChanged" />

@Raffro
Copy link

Raffro commented Feb 2, 2022

Any news on this issue?
I am also using visual studio 2022 community and xamarin forms and all labels I define don't display them texts until I define the label textcolor explicitly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/visual e/3 🕒 3 in-progress This issue has an associated pull request that may resolve it! iOS 14 m/high impact ⬛ p/iOS 🍎 t/bug 🐛
Projects
Development

Successfully merging a pull request may close this issue.