Skip to content

Commit 4188b5f

Browse files
committed
chore: Wait for initialization to complete
1 parent b890d24 commit 4188b5f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Uno.UI/UI/Xaml/Application.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,10 @@ private void SetRequestedTheme(ApplicationTheme requestedTheme)
444444

445445
internal void OnRequestedThemeChanged()
446446
{
447-
ApplySystemOverlaysTheming();
447+
if (InitializationComplete)
448+
{
449+
ApplySystemOverlaysTheming();
450+
}
448451
OnResourcesChanged(ResourceUpdateReason.ThemeResource);
449452
}
450453

src/Uno.UI/UI/Xaml/Window/Native/NativeWindowWrapper.Android.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ internal void ApplySystemOverlaysTheming()
199199
if ((int)Android.OS.Build.VERSION.SdkInt >= 35)
200200
{
201201
// In edge-to-edge experience we want to adjust the theming of status bar to match the app theme.
202-
if ((ContextHelper.Current is Activity activity) &&
203-
activity.Window?.DecorView is { FitsSystemWindows: false } decorView)
202+
if ((ContextHelper.TryGetCurrent(out var context)) &&
203+
context is Activity activity &&
204+
activity.Window?.DecorView is { FitsSystemWindows: false } decorView)
204205
{
205206
var requestedTheme = Microsoft.UI.Xaml.Application.Current.RequestedTheme;
206207

0 commit comments

Comments
 (0)