xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.
MIT License
1.59k stars 471 forks source link

[Bug] [Android] TabIndicator doesn't follow selected TabViewItem #980

Open SeRgI1982 opened 3 years ago

SeRgI1982 commented 3 years ago

Description

I would like to have a chance preselect different TabItem than the first on when navigate to page with TabView. It works on Android when you bind SelectedIndex to your ViewModel and set a proper index inside ViewModel, but indicator behaves strange when you try change to another tab.

Steps to Reproduce

  1. Create Page with TabView and a few TabViewItem's
  2. Bind TabView.SelectedIndex to your ViewModel.SelectedTabIndex
  3. Try to set ViewModel.SelectedTabIndex to correct value
  4. When Page appears, everything should look good
  5. Try to tap another TabViewItem on the right side from currently selected

Expected Behavior

TabIndicator appears in a correct place in reference to currently selected TabViewItem.

Actual Behavior

TabIndicator not always appears in correct place. Is not in-sync with currently selected TabViewItem.

Basic Information

Sample app below:

Steps:

  1. Run sample app,
  2. On OnboardingPage set slider to value = 2
  3. Click Button
  4. TabViewItem with index 2 should be selected - indicator is on right place
  5. Try to select TabViewItem with index 3 - indicator is not in right place

TabViewTest.zip

Cfun1 commented 3 years ago

Could be caused by the same issue in https://github.com/xamarin/XamarinCommunityToolkit/issues/979#issuecomment-785892672

SeRgI1982 commented 3 years ago

It is hard to tell if it is the same issue because #979 says about TabView.SelectedIndex on iOS where nothing is working and here we have Android where this property works <- a proper content of tapped TabViewItem is visible but indicator is showing something else.

sandesh-interserv commented 3 years ago

IsTabTransitionEnabled="False" is a workaround for me. Although there is no transition, the indicator behaves properly.

CZEMacLeod commented 3 years ago

Not sure if this is the same problem, but I have a tabview with bound tabitemssource, and it works and shows the correct indicator icon when tapping to change tab. However if you swipe to move between tabs, the indicator does not update. [Android]