import { StyleProp, ViewStyle, TextStyle } from 'react-native'; /** 布局方向 */ export type TitlePairLayout = 'horizontal' | 'vertical' | 'space-between'; /** 对齐方式 */ export type TitlePairAlign = 'left' | 'center' | 'right'; /** 主副标题垂直对齐(horizontal/space-between 布局时有效) */ export type TitlePairVerticalAlign = 'top' | 'center' | 'bottom'; /** 主标题配置 */ export interface MainTitleConfig { /** 主标题文本 */ text?: string; /** 自定义内容(优先于 text) */ content?: React.ReactNode; /** 字号 */ fontSize?: number; /** 颜色 */ color?: string; /** 字重 */ fontWeight?: TextStyle['fontWeight']; /** 行数限制 */ numberOfLines?: number; /** 自定义样式 */ style?: StyleProp; } /** 副标题配置 */ export interface SubTitleConfig { /** 副标题文本 */ text?: string; /** 自定义内容(优先于 text) */ content?: React.ReactNode; /** 字号 */ fontSize?: number; /** 颜色 */ color?: string; /** 字重 */ fontWeight?: TextStyle['fontWeight']; /** 行数限制 */ numberOfLines?: number; /** 自定义样式 */ style?: StyleProp; } /** DbTitlePair 组件属性 */ export interface DbTitlePairProps { /** 主标题(字符串或配置对象) */ title: string | MainTitleConfig; /** 副标题(字符串或配置对象) */ subtitle?: string | SubTitleConfig; /** 布局方向:horizontal=左右并排 vertical=上下 space-between=两端对齐 */ layout?: TitlePairLayout; /** 对齐方式 */ align?: TitlePairAlign; /** 垂直对齐(horizontal/space-between 布局时有效) */ verticalAlign?: TitlePairVerticalAlign; /** 主副标题间距 */ gap?: number; /** 是否翻转顺序(副标题在前) */ reverse?: boolean; /** 统一字号(同时应用于主副标题,优先级低于 titleFontSize/subtitleFontSize) */ fontSize?: number; /** 统一颜色(同时应用于主副标题,优先级低于 titleColor/subtitleColor) */ color?: string; /** 统一字重(同时应用于主副标题,优先级低于 titleFontWeight/subtitleFontWeight) */ fontWeight?: TextStyle['fontWeight']; /** 统一文本样式(同时应用于主副标题,优先级低于 titleStyle/subtitleStyle) */ textStyle?: StyleProp; /** 主标题字号 */ titleFontSize?: number; /** 主标题颜色 */ titleColor?: string; /** 主标题字重 */ titleFontWeight?: TextStyle['fontWeight']; /** 主标题样式 */ titleStyle?: StyleProp; /** * 主标题行数限制(设为 1 可实现单行省略号效果) * 优先级低于 title 对象内的 numberOfLines * * @example * // 单行省略号 * */ titleNumberOfLines?: number; /** 副标题字号 */ subtitleFontSize?: number; /** 副标题颜色 */ subtitleColor?: string; /** 副标题字重 */ subtitleFontWeight?: TextStyle['fontWeight']; /** 副标题样式 */ subtitleStyle?: StyleProp; /** 容器样式 */ style?: StyleProp; /** 左侧额外元素 */ leftExtra?: React.ReactNode; /** 右侧额外元素 */ rightExtra?: React.ReactNode; /** 左侧额外元素与内容间距 */ leftExtraGap?: number; /** 右侧额外元素与内容间距 */ rightExtraGap?: number; /** 点击回调 */ onPress?: () => void; /** 是否显示分割线 */ showDivider?: boolean; /** 分割线样式 */ dividerStyle?: StyleProp; /** 是否必填(显示红色星号) */ required?: boolean; /** 必填星号位置 */ requiredPosition?: 'start' | 'end'; } /** 预设样式类型 */ export type TitlePairPreset = 'default' | 'section' | 'form' | 'list' | 'card';