Skip to content

TabHostView does not update background color in dark mode #94

@jbachelor

Description

@jbachelor

First and Foremost:
Thank you so much for this awesome library... I sincerely appreciate all the hard work you've put into it!

Platform (please complete the following information):

  • OS: Both
  • Device: iPhone 11 simulator running 13.2; Android Pixel 2 emulator running 10.0/API 29
  • Xamarin.Forms: [4.2.0.815419 and 4.4.0.991265]

Describe the bug
In my efforts to implement Dark Mode support for Android and iOS along with a Sharpnado tab bar, I've found that the tab bar does not seem to update its color after it is initially set, while other components do update.

To Reproduce -- Short version

  1. Grab my modified Sharpnado sample here.
  2. When you run the app on an iOS or Android device that supports dark mode, try switching from light to dark. Notice that the ContentPage will update to a new color, but the tab bar remains in the original light color.
    • See this gif for a look at a demo on an iOS simulator running iOS 13.2.

The long version of how to reproduce:
In my sample project (link below), I'm using the standard Sharpnado sample app with the following modifications:

  • Added a dependency service to find out whether the phone is in light or dark mode (IDeviceThemeService, DeviceThemeService_Android, DeviceThemeService_iOS).
  • Added code to App.xaml.cs to set the app theme from OnStart and OnResume (SetAppThemeAsync).
  • Moved all styles from App.xaml to Styles/ThemeIndependent.xaml.
  • Added new ResourceDictionaries called "Styles/LightMode.xaml" and "Styles/DarkMode.xaml". Each of these merges with the ThemeIndependent ResourceDictionary.
  • Added one color to the DarkMode and LightMode ResourceDictionaries (key="TabBarBackground").
  • Set the BackgroundColor properties of the ContentPage itself and the TabHostView both to be set to "TabBarBackground" as a DynamicResource.
  • Run the app on a device (iOS or Android) that supports dark mode. Notice that the ContentPage will change color depending on light/dark mode of the phone, but the tab bar will not.

Exceptions (if applicable)
n/a

Screenshots (if applicable)

  • Setting background colors of ContentPage and TabHostView to the same dynamic resource:

image

  • Light mode: Both ContentPage and TabHostView are light-yellow.
    image

  • Dark mode: Only the ContentPage gets the updated color.
    image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions