import { Animated, TextStyle, ViewStyle, StatusBarStyle } from 'react-native'; export interface DbNavBarProps { /*** 导航栏标题 */ title?: string; /*** 左侧图标 */ leftIcon?: React.ReactNode; /*** 右侧图标 */ rightIcon?: React.ReactNode; /*** 左侧图标点击事件 */ onLeftPress?: () => void; /*** 右侧图标点击事件 */ onRightPress?: () => void; /*** 导航栏背景颜色(优先级高于主题色) */ backgroundColor?: string; /*** 标题颜色(优先级高于主题色) */ titleColor?: string; /*** 标题样式 */ titleStyle?: TextStyle; /*** 自定义样式 */ style?: ViewStyle; /*** 是否使用渐变背景 */ useLinearGradient?: boolean; /*** 渐变背景颜色(支持十六进制和 rgba 格式) */ gradientColors?: string[]; /*** 渐变背景属性 */ gradientProps?: object; /** * 是否启用滚动渐隐效果 * 启用后导航栏背景色会随滚动逐渐变透明 * 需要配合 scrollY 传入 ScrollView 的滚动偏移量 * * @example * const scrollY = useRef(new Animated.Value(0)).current; * * */ fadeOnScroll?: boolean; /** * 滚动渐变方向 * - 'fadeOut'(默认):从不透明渐变到透明(适用于普通页面) * - 'fadeIn':从透明渐变到不透明(适用于商品详情等需要初始透明导航栏的页面) * * @example * // 商品详情页:初始透明,滚动后变白色 * 商品标题} * /> */ fadeMode?: 'fadeOut' | 'fadeIn'; /** * 滚动多少像素后完全透明(默认 150) */ fadeDistance?: number; /** * ScrollView 的滚动偏移量(Animated.Value) * 配合 Animated.event 使用,父组件无需 setState,零重渲染 */ scrollY?: Animated.Value; /** * 滚动后显示的自定义导航栏内容 * 随滚动与原始内容交叉渐变(原始内容渐隐,scrolledContent 渐显) * 需要配合 fadeOnScroll + scrollY 使用 * * @example * * 标题 * * } * /> */ scrolledContent?: React.ReactNode; /** * 自定义导航栏内容(完全替换默认的 左图标-标题-右图标 布局) * 传入后 title / leftIcon / rightIcon / onLeftPress / onRightPress 等属性将被忽略 * * @example * * * * * } * /> */ customContent?: React.ReactNode; /** * 导航栏内容区域高度(单位:px),默认 44 * 当自定义内容较多时需要增加高度以避免布局异常 */ navHeight?: number; /** * 自定义导航栏内容渲染函数(可获取主题色) * 传入后 title / leftIcon / rightIcon / onLeftPress / onRightPress 等属性将被忽略 * 与 customContent 同时传入时,renderContent 优先级更高 * * @example * ( * * 自定义标题 * * * )} * /> */ renderContent?: (theme: import('../../core/theme/theme.types').DbThemeConfig) => React.ReactNode; /** * 是否使用全局主题色 * 为 true 时导航栏的 backgroundColor / titleColor 将从 DbThemeProvider 获取 * 默认为 true */ useTheme?: boolean; /** * 状态栏样式(手动指定,覆盖自动推断) */ barStyle?: StatusBarStyle; /** * 导航栏内容区域样式(navRow 区域) */ contentStyle?: ViewStyle; }