Skip to content

Commit ec06e94

Browse files
Copilothaavamoa
andcommitted
Explicitly configure UIToolbarAppearance to fix Liquid Glass on standalone UIToolbar
Co-authored-by: haavamoa <2527084+haavamoa@users.noreply.github.com>
1 parent aeb2b6a commit ec06e94

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

src/library/DIPS.Mobile.UI/Components/Toolbar/iOS/ToolbarHandler.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,26 @@ namespace DIPS.Mobile.UI.Components.Toolbar;
77

88
public partial class ToolbarHandler : ViewHandler<Toolbar, UIToolbar>
99
{
10-
protected override UIToolbar CreatePlatformView()
11-
{
12-
// Use the default UIToolbar system appearance — do NOT set BarTintColor or Translucent = false,
13-
// as that overrides the system-provided translucent material (Liquid Glass on iOS 26+,
14-
// blurred translucent bar on earlier versions).
15-
return new UIToolbar();
16-
}
10+
protected override UIToolbar CreatePlatformView() => new UIToolbar();
1711

1812
protected override void ConnectHandler(UIToolbar platformView)
1913
{
2014
base.ConnectHandler(platformView);
15+
16+
// Explicitly apply the default system appearance so iOS renders the correct
17+
// material: Liquid Glass on iOS 26+, translucent blurred bar on earlier versions.
18+
// ConfigureWithDefaultBackground() is required for standalone toolbars (i.e. not
19+
// managed by UINavigationController) to opt into the platform glass material.
20+
var appearance = new UIToolbarAppearance();
21+
appearance.ConfigureWithDefaultBackground();
22+
platformView.StandardAppearance = appearance;
23+
platformView.CompactAppearance = appearance;
24+
platformView.ScrollEdgeAppearance = appearance;
25+
26+
// Ensure no residual background from MAUI's setup path is blocking the glass layer.
27+
platformView.BackgroundColor = null;
28+
platformView.Layer.BackgroundColor = null;
29+
2130
UpdateButtons();
2231
}
2332

0 commit comments

Comments
 (0)