xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.87k forks source link

[Bug] Application.Current.RequestedTheme value changes when Application.Current.UserAppTheme is called before it #15664

Open CostasAthan opened 1 year ago

CostasAthan commented 1 year ago

The value of Application.Current.RequestedTheme should carry the OS Dark Mode setting and shouldn't change as long as the OS Dark mode setting hasn't been changed. But when Application.Current.UserAppTheme is set to either OSAppTheme.Light or OSAppTheme.Dark the value of Application.Current.RequestedTheme changes respectively to the same value Application.Current.UserAppTheme is changed to.

Steps to Reproduce:

  1. Enable Android's Dark mode / Disable Androids dark mode
  2. Run:
Application.Current.UserAppTheme = OSAppTheme.Light;
var theme = Application.Current.RequestedTheme;

or run:

Application.Current.UserAppTheme = OSAppTheme.Dark;
var theme = Application.Current.RequestedTheme;

respectively.

In case Dark Mode is enabled the value of Application.Current.RequestedTheme should be OSAppTheme.Dark and when Dark Mode is disabled it should be OSAppTheme.Light

The values of Application.Current.RequestedTheme are the opposite from the ones expected.

Basic Information

leapse commented 1 year ago

Any updates related to this issue? Facing the same problem with MAUI.

CostasAthan commented 1 year ago

@leapse Nothing at all. It's most probably a bug that needs fixing.