UNPKG

@fruits-chain/react-native-xiaoshu

Version:
38 lines (37 loc) • 1.04 kB
"use strict"; import React, { useMemo, memo } from 'react'; import { PlaceholderMedia } from 'rn-placeholder'; import Theme from "../theme/index.js"; import SkeletonActive from "./skeleton-active.js"; import { varCreator } from "./style.js"; import { jsx as _jsx } from "react/jsx-runtime"; const SkeletonAvatar = ({ theme, active = true, size = 40, shape = 'circle', testID }) => { const [CV] = Theme.useStyle({ varCreator, theme }); const style = useMemo(() => ({ height: size, width: size, backgroundColor: CV.skeleton_color, borderRadius: shape === 'circle' ? size / 2 : CV.skeleton_avatar_border_radius }), [CV.skeleton_avatar_border_radius, CV.skeleton_color, shape, size]); const nodeJSX = /*#__PURE__*/_jsx(PlaceholderMedia, { testID: testID, style: style }); if (active) { return /*#__PURE__*/_jsx(SkeletonActive, { children: nodeJSX }); } return nodeJSX; }; export default /*#__PURE__*/memo(SkeletonAvatar); //# sourceMappingURL=skeleton-avatar.js.map