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] After Cell.ForceUpdateSize(), contained Entry has odd text entry behaviour #4067

Open rkone opened 6 years ago

rkone commented 6 years ago

Description

After calling ForceUpdateSize() on a ViewCell with an Entry control, the keyboard hides after typing a character. If the Entry Text is bound, it only accepts 1 character.

Sample XAML:

<ListView x:Name="listView" HasUnevenRows="True">
    <ListView.ItemsSource>
        <x:Array Type="{x:Type x:String}">
            <x:String>A</x:String>
            <x:String>B</x:String>
        </x:Array>
    </ListView.ItemsSource>
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <Entry />
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

Codebehind calls ForceUpdateSize() on the first entry in MainPage_OnAppearing: listView.TemplatedItems.First().ForceUpdateSize();

Steps to Reproduce

  1. Compile and run attached iOS solution
  2. Select first Entry in ListView, try enter text.
  3. Notice second Entry in ListView behaves normally.

Expected Behavior

Keyboard should remain open, and bound data should reflect typed data.

Actual Behavior

Keyboard closes after single character entry, bound data is cleared and set to last typed character (multiple times).

Basic Information

Screenshots

Reproduction Link

BasicXam.zip

hartez commented 6 years ago

This might be the same bug as reported in #3964.

itsTurk commented 5 years ago

I am experiencing this issue on iOS both in 3.3.0.967583 and the latest prerelease, 3.4.0.987044-pre1 I can confirm the issue does not exist on Xamarin.Forms 3.1.0.697729. Looking forward to a fix.