xamarin / Xamarin.Forms

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

[iOS] Keyboard language reset with 2 entries "IsPassword = true" #5452

Open PauchardThomas opened 5 years ago

PauchardThomas commented 5 years ago

Description

I made a french mobile app = keyboard language : Azerty. In my register page, i got 3 entries where the last 2 entries got IsPassword property set to True. When the user is in the first entry, could be anything (Email entry for instance), the keyboard is in Azerty configuration (OK). But when i switch to another entry ( with IsPassword set to True), the keyboard configuration change to Qwerty ! (KO).

Steps to Reproduce

1- Create new project. In a page, put 3 entries :

Expected Behavior

Keyboard language should stay on Azerty.

Actual Behavior

Keyboard switch to qwerty

Basic Information

Screenshots

Reproduction Link

Reproduction repo

Any workaround ? I need it quick for my production app. It's really disturbing for the users.

kingces95 commented 5 years ago

Hm, this does not reproduce on 4.0.0. Can try on the latest nightly? Is this a regression for you?

PauchardThomas commented 5 years ago

Hi, it's no a regression it's a new app, but am I obliged to update XF to 4.0.0 ?

Kingamattack commented 5 years ago

Hi, I'm facing the same issue and I figured out that it only occurred when both password controls are below each other.

On my side if I put my 1st Entry (the one with IsPassword = false) between the 2 others, the keyboard is staying to AZERTY but as long as there is one under the other one I also got the QWERTY

I'm on XF 4.1.0.581479

webphar commented 4 years ago

Hello,

We have the exact same issue. We are looking every update of Xamarin.forms but even the last one (4.4.991265) doesn't resolve that issue ... I had the problem on iOS 12 and still now on iOS 13.

Like said before this happen with 2 Entry set on "IsPassword = true" on the same page. The first Entry is in AZERTY but the second one in QWERTY. If i take off the IsPassword property on one of the 2 Entry this work perfectly.

If that can help you, this issue occurs only on iOS. We have also an android app and this not happen.

Have you found a workaround or a fix ?

Thanks you

PauchardThomas commented 4 years ago

Hi @webphar,

Indeed I found a solution, I had to play around keyboard settings.... Following code sample worked for me

.xaml side

<FlexLayout>
    <Entry x:Name="enEmail" Keyboard="Email" Placeholder="My email"  />
    <Entry x:Name="enPassword" Focused="Entry_Focused" IsPassword="True" Placeholder="My password">
        <!--  Fix iOS bug https://github.com/xamarin/Xamarin.Forms/issues/5452  -->
        <Entry.Keyboard>
            <OnPlatform iOS="Numeric" />
        </Entry.Keyboard>
    </Entry>
    <Entry x:Name="enConfirmPassword" IsPassword="True" Placeholder="Confirm password"  />
    <Button Text="Create my account" />
</FlexLayout>

AND

.cs side

 private void Entry_Focused(object sender, FocusEventArgs e)
        {
            if (Device.RuntimePlatform == Device.iOS)
            {
                Entry en = (Entry)sender;
                en.IsTextPredictionEnabled = false;
                en.Keyboard = Keyboard.Create(KeyboardFlags.CapitalizeNone);
            }
        }