Skip to content

Commit

Permalink
chore: Wait for initialization to complete
Browse files Browse the repository at this point in the history
(cherry picked from commit 4188b5f)
  • Loading branch information
MartinZikmund authored and mergify[bot] committed Feb 11, 2025
1 parent 27845a6 commit fe873d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/Uno.UI/UI/Xaml/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,10 @@ private void SetRequestedTheme(ApplicationTheme requestedTheme)

internal void OnRequestedThemeChanged()
{
ApplySystemOverlaysTheming();
if (InitializationComplete)
{
ApplySystemOverlaysTheming();
}
OnResourcesChanged(ResourceUpdateReason.ThemeResource);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ internal void ApplySystemOverlaysTheming()
if ((int)Android.OS.Build.VERSION.SdkInt >= 35)
{
// In edge-to-edge experience we want to adjust the theming of status bar to match the app theme.
if ((ContextHelper.Current is Activity activity) &&
activity.Window?.DecorView is { FitsSystemWindows: false } decorView)
if ((ContextHelper.TryGetCurrent(out var context)) &&
context is Activity activity &&
activity.Window?.DecorView is { FitsSystemWindows: false } decorView)
{
var requestedTheme = Microsoft.UI.Xaml.Application.Current.RequestedTheme;

Expand Down

0 comments on commit fe873d1

Please sign in to comment.