import { Image, View, Text } from 'react-native'; import type { AvatarProps, FCCWD } from '../../types'; import { applyDefaults } from '../../core/KitraProvider'; import OcticonsIcon from '../Icons/Octicons'; import Badge from '../Badge/Badge'; const Avatar : FCCWD = ( { typography, theme, source, size = 'medium', borderStyle, containerStyle, badgeContent = 'circular', avatarIcon = , label, labelStyle, badgeStyle, badgePosition }, ) => { const splitName = (string:string) => { const avatarText = string.trim().replace(/ {1,9}/g, ' ').split(' ').reduce((accumulator, currentValue:any) => accumulator.concat(currentValue[0]), ''); return avatarText; }; return ( {(() => { if (source) { return ( ); } if (label) { return ( {splitName(label)} ); } return ( avatarIcon ); })()} {badgePosition && ( )} ); }; export default applyDefaults(Avatar); export const sizes = { medium: { width: 100, height: 100, iconSize: 30, borderRadius: 100, fontSize: 28, }, small: { width: 30, height: 30, iconSize: 10, borderRadius: 15, fontSize: 12, }, };