import { FC, memo, useMemo } from 'react'; import { type TextStyle, type TextProps } from 'react-native'; import { Text } from '../Text'; import { type IconType, type IconProps, Icon } from '../Icon'; import { tabsLabelStyles } from './utils'; const DEFAULT_ICON_SIZE = 24; export type TabLabelProps = { /** * label of the tab * */ label?: string; labelStyle?: TextStyle; labelProps?: Omit; /** * icon properties * */ iconName?: string; iconType?: IconType; iconProps?: Omit; iconStyle?: TextStyle; activeColor?: string; active: boolean; hovered: boolean; variant: 'primary' | 'secondary'; }; const TabLabel = memo((props: TabLabelProps) => { const { activeColor: activeColorProp, iconName, iconStyle: iconStyleProp, iconType, iconProps, labelStyle: labelStyleProp, labelProps, label, active, } = props; // tabsLabelStyles.useVariants({ // variant, // state: resolveStateVariant({ // activeAndHovered: !!active && !!hovered, // hovered, // active, // }), // }) const { labelStyle, iconStyle } = useMemo(() => { const color = active && !!activeColorProp ? { color: activeColorProp } : null; return { labelStyle: [tabsLabelStyles.label, labelStyleProp, color], iconStyle: [tabsLabelStyles.icon, iconStyleProp, color], }; }, [active, activeColorProp, iconStyleProp, labelStyleProp]); return ( <> {iconName && ( )} {label} ); }); TabLabel.displayName = 'TabLabel'; export default TabLabel as unknown as FC>;