1import type { HeaderBarButtonMailSearchToolbarItem } from "react-native-screens";
2
3import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
4
5/**
6 * Group search, filtering, and composition on platforms with Liquid Glass.
7 * The v5 header adapter turns this intent into UISearchController and native
8 * toolbar items. Earlier iOS versions use separate search and toolbar options.
9 */
10export const NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED = NATIVE_LIQUID_GLASS_SUPPORTED;
11
12/** Clearance for scroll content that must come to rest above the floating toolbar. */
13export const NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET = 56;
14
15type NativeMailSearchToolbarInput = Omit<
16 HeaderBarButtonMailSearchToolbarItem,
17 "type" | "useFallbackSearchField"
18>;
19
20/**
21 * Describe the thread-list search and actions for the native header adapter.
22 */
23export function createNativeMailSearchToolbarItem(
24 input: NativeMailSearchToolbarInput,
25): HeaderBarButtonMailSearchToolbarItem {
26 return {
27 placeholder: "Search",
28 ...input,
29 type: "mailSearchToolbar",
30 useFallbackSearchField: true,
31 };
32}