xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] iOS App freezes when password is entered after email (not completely fixed) #14969

Open JPZV opened 2 years ago

JPZV commented 2 years ago

Description

12246 (and #12868) not completely fixed

Steps to Reproduce

  1. Implement a functional SignUp page either using Associated Domains plus Keychain, or using an Authentication provider like Firebase
  2. Add Xamarin.Materials in all the textboxes
  3. Launch the app, go to SignUp, put any email, set the password
  4. Try to press anything else (e.g. the Email Textbox or the buttons)

Expected Behavior

Focus changes to tapped control

Actual Behavior

No focus change, buttons can't be tapped

Basic Information

Environment

Show/Hide Visual Studio info ``` === Visual Studio Community 2019 for Mac === Version 8.10.14 (build 17) Installation UUID: e6e3270b-7e46-4d83-bc0f-5ff11be68740 GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638) Package version: 612000140 === Mono Framework MDK === Runtime: Mono 6.12.0.140 (2020-02/51d876a041e) (64-bit) Package version: 612000140 === Roslyn (Language Service) === 3.10.0-4.21269.26+029847714208ebe49668667c60ea5b0a294e0fcb === NuGet === Version: 5.9.0.7134 === .NET Core SDK === SDK: /usr/local/share/dotnet/sdk/5.0.403/Sdks SDK Versions: 5.0.403 5.0.402 5.0.401 5.0.400 5.0.302 5.0.301 5.0.203 5.0.202 5.0.201 3.1.415 3.1.414 3.1.413 3.1.412 3.1.411 3.1.410 3.1.409 3.1.408 3.1.407 MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks === .NET Core Runtime === Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 5.0.12 5.0.11 5.0.10 5.0.9 5.0.8 5.0.7 5.0.6 5.0.5 5.0.4 3.1.21 3.1.20 3.1.19 3.1.18 3.1.17 3.1.16 3.1.15 3.1.14 3.1.13 === .NET Core 3.1 SDK === SDK: 3.1.415 === Xamarin.Profiler === Version: 1.6.15.68 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler === Updater === Version: 11 === Apple Developer Tools === Xcode 13.1 (19466) Build 13A1030d === Xamarin.Mac === Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version. === Xamarin.iOS === Version: 15.2.0.17 (Visual Studio Community) Hash: 738fde344 Branch: xcode13.1 Build date: 2021-11-09 02:45:16-0500 === Xamarin.Android === Version: 12.0.0.3 (Visual Studio Community) Commit: xamarin-android/d16-11/f0e3c2d Android SDK: /Users/juanp/Library/Android/sdk Supported Android versions: None installed SDK Tools Version: 26.1.1 SDK Platform Tools Version: 30.0.4 SDK Build Tools Version: 30.0.2 Build Information: Mono: c633fe9 Java.Interop: xamarin/java.interop/d16-11@476bb5b ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.35.4@85460d3 Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@87af37b === Eclipse Temurin JDK === Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home 1.8.0.302 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL === Android SDK Manager === Version: 16.10.0.13 Hash: 1b81df5 Branch: remotes/origin/d16-10 Build date: 2021-11-12 01:17:32 UTC === Android Device Manager === Version: 16.10.0.15 Hash: 89dcc0b Branch: remotes/origin/d16-10 Build date: 2021-11-12 01:17:52 UTC === Xamarin Designer === Version: 16.11.0.39 Hash: cd672761d Branch: remotes/origin/d16-11 Build date: 2021-10-06 21:09:18 UTC === Build Information === Release ID: 810140017 Git revision: 6f93cf55df3b7747288286e2006057c7f088b838 Build date: 2021-11-12 09:50:18-05 Build branch: release-8.10 === Operating System === Mac OS X 11.6.0 Darwin 20.6.0 Darwin Kernel Version 20.6.0 Mon Aug 30 06:12:21 PDT 2021 root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64 ```

Video

Demo

Reproduction Link

Issue12868.zip (Using Associated Domain)

Workaround

Option 1: Enter the password before the email (user-side)

Option 2: Remove Material textboxes (dev-side)

JPZV commented 2 years ago

New info regarding this issue:

1) This only happens when iOS suggests you a strong password 2) Rejecting the strong password clears the entry visually, BUT the model/binding stills has the suggested password stored. For some reason iOS set the text property on the first focus, but then it doesn't update that property when rejecting the password. 3) As noted originally in #12246, this only happens if one of the password entries uses Material. I.e. if you set the first entry with the default style and the second one with Material, the app will hang if you press on the second entry. If both entries don't use Material style, the app will work fine even if the previous entries have Material. 4) For some reason this doesn't happen if you only type one character. In other words, if you set a password of you or more characters, the app will hang, but if you just type one character, then swipe to the other entry, the app will not hang 5) There's a workaround for now, but only from the app's code: You have to disable the iOS feature for suggesting a password. Supposedly you can do that by setting TextContentType to Password but I wasn't capable to do that on Xamarin code for some reason. So, the another way is setting a dummy control between the first and the second password entries. This HAS to be another entry, otherwise iOS will prompt the password anyway. This is my new code idea:

Before:

<StackLayout>
    <Entry Text="{Binding Path=FirstName, Mode=TwoWay}" Placeholder="First Name" Visual="Material"/>
    <Entry Text="{Binding Path=Email, Mode=TwoWay}" Placeholder="Email" Visual="Material"/>
    <Entry Text="{Binding Path=Password, Mode=TwoWay}" Placeholder="Password" IsPassword="True" Visual="Material"/>
    <Entry Text="{Binding Path=PasswordCheck, Mode=TwoWay}" Placeholder="Repeat password" IsPassword="True" Visual="Material"/>
</StackLayout>

Now:

<StackLayout>
    <Entry Text="{Binding Path=FirstName, Mode=TwoWay}" Placeholder="First Name" Visual="Material"/>
    <Entry Text="{Binding Path=Email, Mode=TwoWay}" Placeholder="Email" Visual="Material"/>
    <Entry Text="{Binding Path=Password, Mode=TwoWay}" Placeholder="Password" IsPassword="True" Visual="Material"/>
    <Entry Scale="0.0000001" HeightRequest="1" Text=""/> 
    <Entry Text="{Binding Path=PasswordCheck, Mode=TwoWay}" Placeholder="Repeat password" IsPassword="True" Visual="Material"/>
</StackLayout>

NOTE: The dummy entry HAS to be "visible" even for a single pixel, otherwise iOS will know that there is no entry between both passwords, that's why I used Scale and HeightRequest instead of IsVisible.

While this workaround works, it's far of being ideal. It also breaks another things like the Suggested Password feature itself, or the ability to switch to the next entry with the "Entry" key, so we still need a real fix for this issue.