Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

1.1 KB
Raw Blame
type NativeGlassHeaderItem = {
  readonly type: "button" | "menu";
  readonly glassEffect?: boolean;
  readonly hidesSharedBackground?: boolean;
  readonly sharesBackground?: boolean;
  readonly variant?: "plain" | "done" | "prominent";
  readonly width?: number;
};

/**
 * iOS 26/27 Mail-style header controls need the native glass button
 * shared background configuration when they are not part of a larger toolbar.
 * Do not enable `glassEffect` for normal bar-button items: react-native-screens
 * renders that as a custom UIButton, which creates a second skinny capsule.
 */
export function withNativeGlassHeaderItem<T extends NativeGlassHeaderItem>(
  item: T,
  options: {
    readonly hidesSharedBackground?: boolean;
    readonly sharesBackground?: boolean;
    readonly width?: number;
  } = {},
): T {
  const sharesBackground = options.sharesBackground ?? item.sharesBackground ?? true;

  return {
    ...item,
    glassEffect: item.glassEffect ?? false,
    hidesSharedBackground: options.hidesSharedBackground ?? item.hidesSharedBackground ?? false,
    sharesBackground,
    variant: item.variant ?? "plain",
    width: options.width ?? item.width,
  };
}