XamarinCommunityToolkit icon indicating copy to clipboard operation
XamarinCommunityToolkit copied to clipboard

TabIndicator not showing when landing on page - iOS Only

Open LeoJHarris opened this issue 3 years ago • 7 comments

Appears like a bug that when landing on a page with the TabView that the TabIndicatorColor is not showing initially, when I select another tab then the color changes. The color of the TabIndicatorColor is referenced as a DynamicResource in XAML.

Expected Behavior

Color of the TabIndicatorColor should show when page appeared

Actual Behavior

The TabIndicatorColor does not show when page appear and only shows when selecting a new tab then the TabIndicatorColor indicated the correct color for the selected tab

Basic Information

  • Version with issue:
  • Last known good version: NA
  • IDE:VS community 2019
  • Platform Target Frameworks:
    • iOS: iOS 14.4
    • Android: NA
    • UWP: NA
  • Android Support Library Version: NA
  • Nuget Packages: NA
  • Affected Devices: Simulator and iphone

Workaround

NONE

Reproduction imagery

When page is first appeared the TabIndicatorColor is not shown:

Capture

When selecting the next tab it then shows:

Capture1

Reproduction Link

LeoJHarris avatar Mar 04 '21 02:03 LeoJHarris

I also have noticed this bug many times, but I cannot say why...

Actually, anytime I sign out / sign in again to my app, then I'm able to the the TabIndicatorColor once landing on page !

I guess it could be something related to events ordering, BindingContext initializations... I'll comment more in case I get it.

Kapusch avatar Mar 04 '21 21:03 Kapusch

Hi @LeoJHarris ,

Did you try just setting "SelectedIndex" property with a default value ? SelectedIndex="0"

Kapusch avatar Apr 03 '21 09:04 Kapusch

@Kapusch yes same issue occurs

LeoJHarris avatar Apr 27 '21 00:04 LeoJHarris

@Kapusch If this is only occurring on iOS and not on android then how could events ordering, BindingContext initializations be factors are these handled differently on iOS?

LeoJHarris avatar May 25 '21 04:05 LeoJHarris

I am also having this issue on my app.

I have noticed that this this bug is only happening when the TabView page is opened using Application.Current.MainPage.Navigation.PushAsync

When setting the page directly as Application.Current.MainPage the TabIndicatorColor is showing correctly.

Mirksar avatar Jun 06 '21 05:06 Mirksar

Hi @LeoJHarris , I'm facing this issue once again, and I may have found a workaround. Could you try to set the SelectedIndex in the view "OnAppearing" event ? (not working if set in the view constructor)

Of course, this supposes to work on ContentPage views, I'm still trying to find a way to make it work for my ContentView views.

Kapusch avatar Feb 13 '22 11:02 Kapusch

@Kapusch there is a better work around to set the TabIndicatorView yourself in XAML as shown below.

<xct:TabView>
        <xct:TabView.TabIndicatorView>
            <BoxView
                WidthRequest="{Binding Source={x:Reference tabItemBase}, Path=Width}" />
        </xct:TabView.TabIndicatorView>

        <xct:TabViewItem
            x:Name="tabItemBase"

LeoJHarris avatar Apr 07 '22 21:04 LeoJHarris