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:
More details in: https://forums.xamarin.com/discussion/185124/xcode12-ios-14-breaking-entry-controls
Focus is not locked and all controls react to taps normally
Focus is locked on the password control and nothing else on the screen can be tapped
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.
I am too, Faced the same issue.
Same issue here.
When a fix?
In our business application we can't have a different style for some Entries.
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?
Same Problem here. I'cant release my app unless it is fixed. Without Visual = "Material"
the app is not so pretty...
I have tested it on a real device (iPhone SE 2020) on iOS 14.0.0 and 14.0.1.
Plus one for me - also getting it with the password entries. It's super nasty
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?
I'm facing the same issue both on simulator and real device. Urgent fix needed!
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)
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
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).
@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>
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..
@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 I have changed color between entrys, but It's not work. 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 :((( Someone help me ?
@Baophp1805e I haven't tested the text color workaround yet, but even following the steps I mentioned earlier (first entering the password and then email) the first time it works, but if I go back to the login page and focus on the password control again these steps no longer work and the app freezes.
Delete Visual Material, It works.
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 ...
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 .. :joy:
Any idea when this will be fixed? As due to this reason, users are unable to log in to the app..
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.
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.
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);
}
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?
It looks like it's solved in native Material Components iOS library.
material-components/material-components-ios#10081Wouldn'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.
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..
Why is this even closed? @samhouts @hartez
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?
@janschoelchAtOK in our team we decided to downgrade Xcode to 11.7 and Xamarin.iOS to 13.20.2.2.
@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.
- Moving from XF4.6 to XF4.8 means breaking changes for us.
Which breaking changes are you referring to?
Which breaking changes are you referring to?
We faced crashes and flaky UI when moving to XF4.8 as Brush
es now are heavily included in the platform renderers. We still investigate and we will try to create issues for everything we find (+ workarounds).
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.
Did upgrading to 4.8.0.1560 fix this issue for anyone? Still seeing the same freezing behaviour.
any update ?
@samhouts is it fixed yet ?
4.8.0.1560 freezing still
i tested on latest version 4.8.0.1560
and it is working fine
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" />
Most helpful comment
Well, this is a weird one.
Here's my repro for this:
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
toColor.Purple.A
, the issue pops up again).