import { type FC } from 'react'; import { StyleSheet } from 'react-native'; import { moderateScale } from 'react-native-size-matters'; import { defaultScale } from '../../utils/Common'; import AImage from '../TImage/TImage'; import TTypography from '../TTypography/TTypography'; import { TextAlignment, TypographyVariant, } from '../TTypography/TTypographyEnum'; import { withTheme, useTheme } from '../../core/theming'; import type { Theme } from '../../utils/types'; interface Prop { source?: object; sourceUri?: string; size?: number; backgroundColor?: string; textColor?: string; resizeMode?: any; marginTop?: number; marginRight?: number; marginBottom?: number; marginLeft?: number; cache?: any; label?: string; textVariant?: TypographyVariant; fontSize?: number; borderRadius?: number; theme: Theme; } const defaultSize = 64; const defaultMargin = 0; const TAvatar: FC = ({ source, sourceUri, size, backgroundColor, textColor, resizeMode, marginTop, marginRight, marginBottom, marginLeft, cache, label, textVariant, fontSize, borderRadius, }): any => { const radiusValue = borderRadius !== undefined ? borderRadius : defaultSize / 2; const { colors } = useTheme(); const bgColor = backgroundColor ? backgroundColor : colors.primary; const txtColor = textColor ? textColor : colors.textColor; return ( <> {label && ( )} {sourceUri && ( )} {source && ( )} ); }; const styles = StyleSheet.create({ labelStyle: { overflow: 'hidden', }, }); export default withTheme(TAvatar);