import { StyleProp, ViewStyle, TextStyle } from 'react-native'; import { ReactNode } from 'react'; export interface TabItem { /** 唯一标识 */ key: string; /** 显示标题 */ title?: string; /** 角标数字 */ badge?: number; /** 是否禁用 */ disabled?: boolean; /** 自定义图标 */ icon?: ReactNode; /** 扩展数据 */ extra?: Record; } export interface DbScrollTabProps { /** Tab项数据 */ tabs: TabItem[]; /** 当前选中的key */ activeKey?: string; /** 默认选中的key */ defaultActiveKey?: string; /** 切换回调 */ onChange?: (key: string, index: number) => void; /** 对齐方式:left左对齐 center居中 space-between平分 */ align?: 'left' | 'center' | 'space-between'; /** 是否显示下划线指示器 */ showIndicator?: boolean; /** 下划线宽度,默认跟随文字宽度,设置数字为固定宽度 */ indicatorWidth?: number | 'auto'; /** 下划线高度 */ indicatorHeight?: number; /** 下划线颜色 */ indicatorColor?: string; /** 下划线圆角 */ indicatorRadius?: number; /** Tab项之间的间距 */ tabGap?: number; /** 左右内边距 */ horizontalPadding?: number; /** 容器样式 */ style?: StyleProp; /** Tab项容器样式 */ tabStyle?: StyleProp; /** Tab文字样式 */ tabTextStyle?: StyleProp; /** 选中Tab文字样式 */ activeTabTextStyle?: StyleProp; /** 禁用Tab文字样式 */ disabledTabTextStyle?: StyleProp; /** 下划线是否有动画 */ animated?: boolean; /** 是否可滚动,false时平分宽度 */ scrollable?: boolean; /** * 自定义渲染Tab内容 * @param item Tab项数据 * @param isActive 是否选中 * @param index 索引 * @returns ReactNode */ renderTab?: (item: TabItem, isActive: boolean, index: number) => ReactNode; /** 滚动时选中项是否靠左对齐 */ scrollToLeft?: boolean; /** 选中项距离左边的偏移量 (scrollToLeft=true时生效) */ scrollLeftOffset?: number; }