Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sk1llsh0t opened this issue Oct 10, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@sk1llsh0t
Copy link

sk1llsh0t commented Oct 10, 2024

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. (#120) (#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 janusw added the bug Something isn't working label Oct 10, 2024
@janusw
Copy link
Collaborator

janusw commented Oct 10, 2024

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.

@roubachof
Copy link
Owner

should be fixed by v3.1.0, please re-open if it doesn't.

@sk1llsh0t
Copy link
Author

sk1llsh0t commented Oct 22, 2024

The original issue is fixed. Now 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.

Current Version: 3.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants