xamarin/Xamarin.Forms

[iOS] After Cell.ForceUpdateSize(), contained Entry has odd text entry behaviour

Open

#4,067 opened on Oct 11, 2018

 (2 comments) (2 reactions) (0 assignees)C# (1,926 forks)batch import
a/listviewe/5 :clock5:excellent-reporthelp wantedinactivep/iOS 🍎t/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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

  • Version with issue: Xamarin.Forms versions 3.2.0.871581, 3.3.0.871608-pre2
  • Last known good version:
  • IDE: VS 15.8.7
  • Platform Target Frameworks:
    • iOS: 12.0.1
    • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices: Tested on an iPhone 7

Screenshots

Reproduction Link

BasicXam.zip

Contributor guide