Open History to see the last commit
1type NativeGlassHeaderItem = {
2 readonly type: "button" | "menu";
3 readonly glassEffect?: boolean;
4 readonly hidesSharedBackground?: boolean;
5 readonly sharesBackground?: boolean;
6 readonly variant?: "plain" | "done" | "prominent";
7 readonly width?: number;
8};
9
10/**
11 * iOS 26/27 Mail-style header controls need the native glass button
12 * shared background configuration when they are not part of a larger toolbar.
13 * Do not enable `glassEffect` for normal bar-button items: react-native-screens
14 * renders that as a custom UIButton, which creates a second skinny capsule.
15 */
16export function withNativeGlassHeaderItem<T extends NativeGlassHeaderItem>(
17 item: T,
18 options: {
19 readonly hidesSharedBackground?: boolean;
20 readonly sharesBackground?: boolean;
21 readonly width?: number;
22 } = {},
23): T {
24 const sharesBackground = options.sharesBackground ?? item.sharesBackground ?? true;
25 return {
26 ...item,
27 glassEffect: item.glassEffect ?? false,
28 hidesSharedBackground: options.hidesSharedBackground ?? item.hidesSharedBackground ?? false,
29 sharesBackground,
30 variant: item.variant ?? "plain",
31 width: options.width ?? item.width,
32 } as T;
33}