import type { ComponentType } from 'react'; import type { IconProps } from '@unif/react-native-icons'; import type { ReactNode } from 'react'; import type { StyleProp, ViewStyle } from 'react-native'; export type NavBarAction = { icon: ComponentType; onPress: () => void; /** 屏幕阅读器读出的非空功能描述。 */ accessibilityLabel: string; }; export type NavBarSlot = NavBarAction | ReactNode; type NavBarContentProps = | { /** 主标题 */ title: string; /** 副标题(可选,主标题下方一行) */ subtitle?: string; /** 左侧槽位:传 NavBarAction 自动用 IconButton 渲染 / 传 ReactNode 自定义 */ left?: NavBarSlot; /** 右侧槽位:同 left */ right?: NavBarSlot; children?: never; } | { /** 替换整条内容;保留节点的交互、ref 和无障碍语义。 */ children: Exclude; title?: never; subtitle?: never; left?: never; right?: never; }; export type NavBarProps = NavBarContentProps & { /** * 视觉变体,默认 'transparent': * - `default`:系统玻璃表面 + hairline 底边 * - `brand`:品牌橙底 + 白字(登录 / 启动场景) * - `transparent`:完全透明 + 深字(c.foreground)+ 无 border —— 浮在浅色 hero * 渐变之上的子页(我的名片 / 等)。若需白字深色浮层场景,后续加 * 'transparentLight' variant。 */ variant?: 'default' | 'brand' | 'transparent'; /** 容器附加样式(margin / position 等布局微调)。 */ style?: StyleProp; /** E2E / 测试定位 */ testID?: string; };