Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

native-mail-search-toolbar.ts

36 lines1.3 KB

1import type { HeaderBarButtonMailSearchToolbarItem } from "react-native-screens";
2​
3import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
4​
5/**
6 * The patched mail-style toolbar is built natively from iOS 26 Liquid Glass
7 * UIKit (`UIGlassEffect`) with no earlier fallback: pre-26 the native side
8 * silently drops the item and hides the navigation toolbar entirely. Screens
9 * that send it must fall back to standard search/toolbar primitives when this
10 * is false.
11 */
12export const NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED = NATIVE_LIQUID_GLASS_SUPPORTED;
13​
14type NativeMailSearchToolbarInput = Omit<
15 HeaderBarButtonMailSearchToolbarItem,
16 "type" | "useFallbackSearchField"
17>;
18​
19/**
20 * Builds the patched react-native-screens Mail-style bottom search toolbar.
21 *
22 * Keeping this behind an app-level helper makes the iOS-only RNS patch an
23 * explicit layout primitive instead of a per-screen object literal. Android can
24 * keep using platform-specific header/search primitives without depending on
25 * this helper.
26 */
27export function createNativeMailSearchToolbarItem(
28 input: NativeMailSearchToolbarInput,
29): HeaderBarButtonMailSearchToolbarItem {
30 return {
31 placeholder: "Search",
32 ...input,
33 type: "mailSearchToolbar",
34 useFallbackSearchField: true,
35 };