import { Animated, Pressable, type PressableProps as NativeProps, type StyleProp, type ViewStyle } from 'react-native'; import { Icon } from '../../components/wui-icon'; import { Text } from '../../components/wui-text'; import useAnimatedValue from '../../hooks/useAnimatedValue'; import { useTheme } from '../../hooks/useTheme'; import type { ColorType, IconType, SizeType } from '../../utils/TypesUtil'; import styles from './styles'; import { FlexView } from '../../layout/wui-flex'; const AnimatedPressable = Animated.createAnimatedComponent(Pressable); export type LinkProps = NativeProps & { children: string; disabled?: boolean; iconLeft?: IconType; iconRight?: IconType; style?: StyleProp; size?: Exclude; color?: ColorType; }; export function Link({ children, disabled, iconLeft, iconRight, onPress, style, size = 'sm', color, ...rest }: LinkProps) { const Theme = useTheme(); const _color = (disabled ? 'fg-300' : color ?? 'accent-100') as ColorType; const iconSize = size === 'md' ? 'sm' : 'xs'; const { animatedValue, setStartValue, setEndValue } = useAnimatedValue( 'transparent', Theme['gray-glass-010'] ); return ( {iconLeft && ( )} {children} {iconRight && ( )} ); }