Sharpnado.Tabs: [MAUI][ANDROID] TabHostView Text Colors Don't Change Switching Light/Dark Mode

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 notice the text colors for selected and unselected tabs aren’t switching when the dark/light mode changes. The background color changes and the segmentedoutlinecolor changes. Something isn’t working right with the text colors though when switching dark/light mode.

This issue was introduced after the fix for this issue (https://github.com/roubachof/Sharpnado.Tabs/issues/127#)

I’m currently on sharpnado.tabs 3.1.1

To Reproduce Steps to reproduce the behavior:

- Create an app with the Tabs control
- In the Resources/Styles/Styles.xaml, add styling for the various tab components with AppThemeBindings for light and dark modes
- Run the app and navigate to the page with the tab control
- Then, from the notification tray, change the theme from light to dark or vice versa.
- Dismiss the notification tray after the theme has switched so you are back in the app.
- You'll notice as you switch the dark/light mode, the text colors in the tabhostview aren't changing

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: Tab text colors change to their respective dark/light theme color

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 24 (10 by maintainers)

Most upvoted comments

The issue was introduced in this commit: (https://github.com/roubachof/Sharpnado.Tabs/commit/c60990f72d523c38df60776d7a0004fff791256d)

In the TabHostView class, the frame control was changed to a border. Changing it back to a frame makes the app theme colors work again.

To figure it out, i grabbed the previous good commit, and started adding each changed code section 1 at a time until it broke. Since the border was the last thing i thought would break something like this, it was the last remaining thing to check. Anyway, there you go.

nope. Already tried what you suggested unfortunately