@replyke/ui-core-react-native
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
41 lines • 1.28 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_native_1 = require("react-native");
const UserAvatar = ({ user, size = 32, borderRadius, }) => {
if (!user)
return null;
const userImg = user.avatar
? user.avatar
: `https://api.dicebear.com/9.x/thumbs/png?seed=${user.id}`;
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
styles.avatarContainer,
{
width: size,
height: size,
borderRadius: borderRadius || size / 2,
},
], children: (0, jsx_runtime_1.jsx)(react_native_1.Image, { source: {
uri: userImg,
}, style: [
styles.image,
{
borderRadius: borderRadius || size / 2,
},
] }) }));
};
const styles = react_native_1.StyleSheet.create({
avatarContainer: {
overflow: "hidden",
borderWidth: 1,
borderColor: "#E6E6E6",
flexShrink: 0,
},
image: {
width: "100%",
height: "100%",
resizeMode: "cover",
},
});
exports.default = UserAvatar;
//# sourceMappingURL=UserAvatar.js.map
;