import { Animated, Pressable, View, type StyleProp, type ViewStyle } from 'react-native'; import { Image } from '../../components/wui-image'; import { Text } from '../../components/wui-text'; import useAnimatedValue from '../../hooks/useAnimatedValue'; import { useTheme } from '../../hooks/useTheme'; import { UiUtil } from '../../utils/UiUtil'; import { Avatar } from '../wui-avatar'; import { IconBox } from '../wui-icon-box'; import styles from './styles'; const AnimatedPressable = Animated.createAnimatedComponent(Pressable); export interface AccountButtonProps { networkSrc?: string; imageHeaders?: Record; avatarSrc?: string; address?: string; isProfileName?: boolean; balance?: string; onPress?: () => void; disabled?: boolean; style?: StyleProp; testID?: string; } export function AccountButton({ networkSrc, imageHeaders, avatarSrc, address, isProfileName, balance, onPress, disabled, style, testID }: AccountButtonProps) { const Theme = useTheme(); const { animatedValue, setStartValue, setEndValue } = useAnimatedValue( Theme['gray-glass-002'], Theme['gray-glass-010'] ); function balanceTemplate() { if (balance) { const network = networkSrc ? ( ) : ( ); return ( {network} {balance} ); } return null; } return ( {balanceTemplate()} {address && ( {UiUtil.getTruncateString({ string: address, charsStart: isProfileName ? 18 : 4, charsEnd: isProfileName ? 0 : 6, truncate: isProfileName ? 'end' : 'middle' })} )} ); }