react-native-playful-avatar
Version:
Make Playful Avatar for your React Native apps
35 lines (34 loc) • 974 B
JavaScript
;
import { useMemo } from 'react';
import { getIdByAvatarElement } from "./utils/avatarUtils.js";
import Svg from 'react-native-svg';
import { View } from 'react-native';
import Composer from "./composers/Composer.js";
import { jsx as _jsx } from "react/jsx-runtime";
const PlayfulElement = ({
style,
element,
colorProps
}) => {
const color = useMemo(() => {
return colorProps === undefined ? element.type === 'haircut' ? '#422d2d' : '#C99589' : colorProps;
}, [colorProps, element]);
const id = useMemo(() => {
return getIdByAvatarElement(element);
}, [element]);
return /*#__PURE__*/_jsx(View, {
style: style,
children: /*#__PURE__*/_jsx(Svg, {
height: '100%',
width: '100%',
viewBox: "0 0 1300 1300",
children: /*#__PURE__*/_jsx(Composer, {
id: id,
color: color,
element: element
})
})
});
};
export default PlayfulElement;
//# sourceMappingURL=PlayfulElement.js.map