UNPKG

@replyke/ui-core-react-native

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

39 lines 1.13 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { View, Image, StyleSheet } from "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 (_jsx(View, { style: [ styles.avatarContainer, { width: size, height: size, borderRadius: borderRadius || size / 2, }, ], children: _jsx(Image, { source: { uri: userImg, }, style: [ styles.image, { borderRadius: borderRadius || size / 2, }, ] }) })); }; const styles = StyleSheet.create({ avatarContainer: { overflow: "hidden", borderWidth: 1, borderColor: "#E6E6E6", flexShrink: 0, }, image: { width: "100%", height: "100%", resizeMode: "cover", }, }); export default UserAvatar; //# sourceMappingURL=UserAvatar.js.map