roubachof / Sharpnado.Tabs

Pure MAUI and Xamarin.Forms Tabs, including fixed tabs, scrollable tabs, bottom tabs, badge, segmented control, custom tabs, button tabs, bendable tabs...
MIT License
483 stars 62 forks source link

[MAUI][ANDROID] Tabs become unresponsive when applying AppThemeBinding (Light/Dark) #127

Open sk1llsh0t opened 2 days ago

sk1llsh0t commented 2 days ago

Platform (please complete the following information):

OS: [Android] Device: Tab Active 3 [Android API Level 31] Sdk Version: Min: 30 Target: 34 MAUI: [NET 8.0][8.0.91]

I have added light/dark AppThemeBinding to my app's style.xaml sheet to handle when the system switches between modes. With the tabhostview, I'm noticing that when the theme switches, the tabs become unresponsive.

Would you have any insights on why this might occur? Not at this time

Maybe similar to these 2 issues but not sure. (https://github.com/roubachof/Sharpnado.Tabs/issues/120) (https://github.com/roubachof/Sharpnado.Tabs/issues/84)

To Reproduce Steps to reproduce the behavior: 1) Create an app with the Tabs control 2) In the Resources/Styles/Styles.xaml, add styling for the various tab components with AppThemeBindings for light and dark modes 3) Run the app. while you are on the page with the tabs, tap around to make sure it is working. 4) Then, from the notification tray, change the theme from light to dark or vice versa. 5) Dismiss the notification tray after the theme has switched so you are back in the app. 6) At this point, the tabs are disabled/unresponsive

One other observation, if i have a main page and navigate to a detail page (with the tab control), then switch the dark/light mode, come back to the app, the tabs are disabled. i can navigate back to the main page and then go back to the detail page and it is working again.

Styles used in my Style.xaml file: (of course change the color StaticResources to match your colors)

 <Style TargetType="sho:TabHostView" x:Key="TabHostView">
        <Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource LightBackground02}, Dark={StaticResource DarkBackground02}}" />
        <Setter Property="SegmentedOutlineColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
        <Setter Property="CornerRadius" Value="10" />
        <Setter Property="TabType" Value="Fixed" />
        <Setter Property="IsSegmented" Value="True" />
        <Setter Property="Orientation" Value="Horizontal" />
        <Setter Property="SegmentedHasSeparator" Value="True" />
    </Style>

    <Style TargetType="sho:UnderlinedTabItem" x:Key="UnderlinedTabItem">
        <Setter Property="SelectedTabColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryLight}}" />
        <Setter Property="UnselectedLabelColor" Value="{AppThemeBinding Light={StaticResource LightSecondaryText}, Dark={StaticResource DarkSecondaryText}}" />
    </Style>

    <Style TargetType="sho:BadgeView" x:Key="BadgeView">
        <Setter Property="Background" Value="{StaticResource Secondary}"></Setter>
    </Style>

Expected Behavior: Tabs can be clicked and views load as expected.

janusw commented 2 days ago

I have added light/dark AppThemeBinding to my app's style.xaml sheet to handle when the system switches between modes. With the tabhostview, I'm noticing that when the theme switches, the tabs become unresponsive.

I can confirm this ...

Maybe similar to these 2 issues but not sure. (#120) (#84)

... and yes, I think all of them are due to the same root cause.