import type { StyleProp, ViewStyle, Insets, Animated as RNAnimated, } from 'react-native'; import type Animated from 'react-native-reanimated'; import type Presets from './presets'; import type { PresetEnum } from './presets'; export type TabsConfig = { [key in keyof P]: T; }; export interface Space { vertical?: number; horizontal?: number; } interface TabBarItemSpacing { innerVerticalSpace: number; innerHorizontalSpace: number; outerVerticalSpace: number; outerHorizontalSpace: number; } export interface TabBarConfigurableProps { /** * Animation duration. * @default PresetConstants */ duration?: number; /** * Animation easing function. * @default Easing.out(Easing.exp) */ easing?: Animated.EasingFunction; /** * Item padding space. * @default PresetConstants */ itemInnerSpace?: number | Space; /** * Item margin space. * @default PresetConstants */ itemOuterSpace?: number | Space; /** * Item container width. * @default PresetConstants */ itemContainerWidth?: 'auto' | 'fill'; /** * Icon size. * @default PresetConstants */ iconSize?: number; /** * Item layout direction. * @default false */ isRTL?: boolean; /** * Callback when item been long pressed. */ onLongPress?: (index: number) => void; } export interface TabInfo { title: string; key: string; } export type TabBarViewProps = { /** * Selected animated index. */ selectedIndex: Animated.Value; /** * Callback when animated index change. */ animatedOnChange: (index: number) => Animated.Node; /** * Tabs configs. */ tabs: Array; /** * Root container style. */ style?: StyleProp; } & TabBarConfigurableProps & C; export interface TabBarItemProps extends Required< Omit< TabBarConfigurableProps, | 'itemInnerSpace' | 'itemOuterSpace' | 'onLongPress' | 'duration' | 'easing' > > { /** * Animated focus value. */ animatedFocus: Animated.Node; /** * Tab index. */ index: number; /** * Tab label. */ label: string; /** * Tab spacing */ spacing: TabBarItemSpacing; } export type AnimatedTabBarProps = { /** * Animation preset. */ preset?: T; /** * Tabs configurations. */ tabs: TabsConfig; /** * Root container style. */ style?: | StyleProp | RNAnimated.WithAnimatedValue>; /** * React Navigation Props */ state?: any; navigation?: any; descriptors?: any; onTabPress?: any; onTabLongPress?: any; safeAreaInsets?: Insets; } & Omit & ExtractPresetConfig; export type AnimatedTabBarViewProps = { /** * Initial index. */ index: number; /** * Tabs configurations. */ tabs: TabsConfig>; /** * Animation preset. */ preset?: T; /** * Root container style. */ style?: StyleProp; /** * Callback when animated index changes. */ onIndexChange: (index: number) => void; } & TabBarConfigurableProps & ExtractPresetConfig; export type ExtractPresetConfig = { [k in keyof typeof Presets[T]['$c']]: typeof Presets[T]['$c'][k]; };