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] Cannot insert input in display prompt (DisplayPromptAsync) on Android #15724

Open EeKay opened 1 year ago

EeKay commented 1 year ago

Description

For Xamarin.Forms versions after 5.0.0.2515, on my Android (Samsung A20e, Android 11) phone, I get the following issue:

Given I want to show a dialog so the user can enter a name When I use the following code var test1 = await Application.Current.MainPage.DisplayPromptAsync("Test", "Vul in", maxLength: 100, keyboard: Keyboard.Plain, initialValue:"test"); Then I expect to see it and let the user enter the name Results: The dialog shows but the value is not editable and no keyboard is shown on Android

Steps to Reproduce

  1. Create Xamarin Forms solution with Android target
  2. add my testcode to the mainpage
  3. install a version > 5.0.0.2515

Expected Behavior

Working dialog that allows user to input text

Actual Behavior

Input not working

Basic Information

Environment

Show/Hide Visual Studio info ``` Visual Studio Community 2022 for Mac Version 17.5.3 (build 15) Installation UUID: 0c116af1-9dce-42d5-acbd-affd0872be93 Runtime .NET 7.0.1 (64-bit) Architecture: X64 Microsoft.macOS.Sdk 12.3.2372; git-rev-head:754abbf6a3563f6267e5717ae832b4ac25b1f2fb; git-branch:release/7.0.1xx-xcode13.3 Roslyn (Language Service) 4.5.0-3.23056.2+97881342e427ff5cdcba8f12b12ff8e6f3564431 NuGet Version: 6.4.0.117 .NET SDK (x64) SDK: /usr/local/share/dotnet/sdk/7.0.202/Sdks SDK Versions: 7.0.202 7.0.201 7.0.103 7.0.102 7.0.101 7.0.100 6.0.407 6.0.406 6.0.405 6.0.404 6.0.403 6.0.401 6.0.400 5.0.408 5.0.407 5.0.406 5.0.405 5.0.404 5.0.400 5.0.302 5.0.301 5.0.201 5.0.103 5.0.102 5.0.101 5.0.100 3.1.426 3.1.425 3.1.423 3.1.422 3.1.420 3.1.418 3.1.417 3.1.416 3.1.412 3.1.411 3.1.410 3.1.407 3.1.406 3.1.405 3.1.404 3.1.403 3.1.402 3.1.401 3.1.301 3.1.300 3.1.200 3.1.102 3.1.101 3.1.100 3.0.101 3.0.100 2.1.701 2.1.700 MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks .NET Runtime (x64) Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 7.0.4 7.0.3 7.0.2 7.0.1 7.0.0 6.0.15 6.0.14 6.0.13 6.0.12 6.0.11 6.0.9 6.0.8 5.0.17 5.0.16 5.0.15 5.0.14 5.0.13 5.0.9 5.0.8 5.0.7 5.0.4 5.0.3 5.0.2 5.0.1 5.0.0 3.1.32 3.1.31 3.1.29 3.1.28 3.1.26 3.1.24 3.1.23 3.1.22 3.1.18 3.1.17 3.1.16 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.1 3.0.0 2.1.23 2.1.22 2.1.21 2.1.19 2.1.18 2.1.17 2.1.16 2.1.15 2.1.14 2.1.13 2.1.12 2.1.11 Xamarin.Profiler Version: 1.8.0.49 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler Updater Version: 11 Apple Developer Tools Xcode: 14.2 21534 Build: 14C18 Xamarin.Mac Version: 9.1.0.5 Visual Studio Community Hash: 7738c90c9 Branch: xcode14.2 Build date: 2023-01-25 15:56:14-0500 Xamarin.iOS Version: 16.2.0.5 Visual Studio Community Hash: 7738c90c9 Branch: xcode14.2 Build date: 2023-01-25 15:56:15-0500 Xamarin Designer Version: 17.5.3.47 Hash: e8b5d371c3 Branch: remotes/origin/d17-5 Build date: 2023-03-23 16:21:17 UTC Xamarin.Android Version: 13.2.0.0 (Visual Studio Community) Commit: xamarin-android/d17-5/797e2e1 Android SDK: /Users/eekay/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 6.0 (API level 23) 12.0 (API level 31) 11.0 (API level 30) 10.0 (API level 29) 9.0 (API level 28) 13.0 (API level 33) SDK Command-line Tools Version: 7.0 SDK Platform Tools Version: 34.0.1 SDK Build Tools Version: 32.0.0 Build Information: Mono: 6dd9def Java.Interop: xamarin/java.interop/main@149d70fe SQLite: xamarin/sqlite/3.40.0@fdc1e34 Xamarin.Android Tools: xamarin/xamarin-android-tools/main@9f02d77 Microsoft Build of OpenJDK Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk 11.0.16.1 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL Eclipse Temurin JDK Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk 1.8.0.302 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL Android SDK Manager Version: 17.5.0.33 Hash: f0c0c52 Branch: remotes/origin/d17-5~2 Build date: 2023-03-23 16:21:22 UTC Android Device Manager Version: 0.0.0.1245 Hash: 7f8a990 Branch: 7f8a990 Build date: 2023-03-23 16:21:23 UTC Build Information Release ID: 1705030015 Git revision: c7ec3826dd11045a53fa7f2c08ddbd6bd475c05b Build date: 2023-03-23 16:19:44+00 Build branch: release-17.5 Build lane: release-17.5 Operating System Mac OS X 13.2.1 Darwin 22.3.0 Darwin Kernel Version 22.3.0 Mon Jan 30 20:42:11 PST 2023 root:xnu-8792.81.3~2/RELEASE_X86_64 x86_64 ```

Build Logs

No build issue present.

Screenshots

Screenshot of the input not working for any version after 5.0.0.2515: android_no_input_versionafter2515

Screenshot of the input working and usable for version 5.0.0.2515: android_input_worksversion2515

Workaround

you can uninstall Xamarin.Forms, and install specific version: 5.0.0.2515. This is the last version where the input field is working for me.

softlion commented 1 year ago

You can try this plugin instead

https://github.com/softlion/UserInteraction

await UserInteraction.Input(...);