XamarinCommunityToolkit icon indicating copy to clipboard operation
XamarinCommunityToolkit copied to clipboard

[Bug] Hard to select ListView's items when used in TabViewItem

Open ghuynguyen opened this issue 3 years ago • 3 comments

Description

When using ListView in TabViewItem, after change tab, it's hard to select ListView's items

Link to Reproduction Sample

https://github.com/ghuynguyen/tabview_bug

Steps to Reproduce

  1. Switch to Tab 2
  2. Switch back to Tab 1
  3. Select an item in ListView

Expected Behavior

Item selected by 1 tap

Actual Behavior

Item selected by multi tap

Basic Information

  • Version with issue: 1.3.1, 2.0.1
  • Last known good version:
  • IDE: Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.1.0
  • Platform Target Frameworks:
    • iOS: not test
    • Android: 11
  • Nuget Packages:
    • Xamarin.Community Toolkit 1.3.1
    • Xamarin.Community Toolkit 2.0.1
    • Xamarin.Forms 5.0.0.2337
  • Affected Devices: Tested on Android Emulator API 28( Android 9 ) and Physical Android 11

Workaround

Refresh the list at TAB 1 when switch to TAB 2 and vice versa.

Reproduction imagery

Animation

ghuynguyen avatar Mar 23 '22 04:03 ghuynguyen

i have same issue, any updates on this ?

dungngo27696 avatar Mar 29 '22 09:03 dungngo27696

Update: This bug only appears on Android. Works fine on iOS

ghuynguyen avatar Apr 07 '22 07:04 ghuynguyen

Workaround In my case, using the MVVM pattern, when the TAB index changes (TabView.SelectedIndex), it is sufficient to update the ItemSource of the ListView by calling OnPropertyChanged(nameof(ListItemSource)), for example, when the ListView is specified as: ItemSource="{Binding ListItemSource}". This allows fixing the bug depicted in the video issue for android too.

MeinLiX avatar Apr 24 '23 08:04 MeinLiX