import React, { FC } from "react"; import FastImage from "react-native-fast-image"; import LinearGradient from "react-native-linear-gradient"; import { StyleSheet, View, ViewStyle } from "react-native"; import SkeletonLoader from "./SkeletonLoader"; const styles = StyleSheet.create({ base: { backgroundColor: "#fff", }, ring: { backgroundColor: "#fff", }, xxs: { height: 24, width: 24, borderRadius: 12, }, xs: { height: 40, width: 40, borderRadius: 20, }, sm: { height: 50, width: 50, borderRadius: 25, }, md: { height: 70, width: 70, borderRadius: 35, }, lg: { height: 100, width: 100, borderRadius: 50, }, }); export interface AvatarProps { src: string | null; size: "base" | "ring" | "xxs" | "xs" | "sm" | "md" | "lg"; style: ViewStyle; skeletonLoading: boolean; mainColor: string; secondaryColor: string; } const Avatar: FC = ({ src, size, style, skeletonLoading, mainColor, secondaryColor, }) => skeletonLoading ? ( ) : ( {size === "lg" ? ( {src ? ( ) : null} ) : ( {src ? ( ) : null} )} ); Avatar.defaultProps = { size: "sm", src: null, style: {}, skeletonLoading: false, }; export default Avatar;