Skip to content

Commit b5f0f66

Browse files
committed
Rename react-native-userpic -> react-native-avatar
1 parent d14a100 commit b5f0f66

File tree

9 files changed

+60
-59
lines changed

9 files changed

+60
-59
lines changed

README.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# React Native Userpic
1+
# React Native Avatar
22

33
<table>
44
<tr>
55
<td width="228">
6-
<img width="200" src="https://github.com/kolking/react-native-userpic/assets/4656448/877fbd1b-7040-41d4-a29b-80958b9b7cdd" />
6+
<img width="200" src="https://github.com/kolking/react-native-avatar/assets/4656448/877fbd1b-7040-41d4-a29b-80958b9b7cdd" />
77
</td>
88
<td>
99
The ultimate React Native component for displaying user avatars written in TypeScript with a strong focus on performance. This fully featured and highly customizable component allows you to show Gravatar images by providing an email address, fallback to user's initials, fine-tune the shape and size of avatars, add badges and custom statuses to the avatar image.
@@ -13,42 +13,42 @@ The ultimate React Native component for displaying user avatars written in TypeS
1313

1414
---
1515

16-
<img width="200" align="left" src="https://github.com/kolking/react-native-userpic/assets/4656448/53d8eec3-6685-4b6b-9d85-261e7f391b11" />
16+
<img width="200" align="left" src="https://github.com/kolking/react-native-avatar/assets/4656448/53d8eec3-6685-4b6b-9d85-261e7f391b11" />
1717

1818
**Control the shape of the avatars**
1919
The default circular shape can be changed by specifying a custom border radius. The `style` prop enables you to override the default styles.
2020

2121
---
2222

23-
<img width="200" align="left" src="https://github.com/kolking/react-native-userpic/assets/4656448/d7a4a923-fb79-4734-8092-7531835876ce" />
23+
<img width="200" align="left" src="https://github.com/kolking/react-native-avatar/assets/4656448/d7a4a923-fb79-4734-8092-7531835876ce" />
2424

2525
**Custom fallback image or emoji**
2626
For users without an image, you have the option to display the default avatar icon, provide a custom fallback image, or even show an emoji.
2727

2828
---
2929

30-
<img width="200" align="left" src="https://github.com/kolking/react-native-userpic/assets/4656448/de5dfe87-37ba-49ad-ba73-1e7828c06468" />
30+
<img width="200" align="left" src="https://github.com/kolking/react-native-avatar/assets/4656448/de5dfe87-37ba-49ad-ba73-1e7828c06468" />
3131

3232
**Fallback to user's initials**
3333
Another option for users without an image is to display their initials. By enabling the `colorize` option, unique color can be generated based on the user's name.
3434

3535
---
3636

37-
<img width="200" align="left" src="https://github.com/kolking/react-native-userpic/assets/4656448/06e2e2e6-10f7-420e-a381-3f2fd154b82a" />
37+
<img width="200" align="left" src="https://github.com/kolking/react-native-avatar/assets/4656448/06e2e2e6-10f7-420e-a381-3f2fd154b82a" />
3838

3939
**Gravatar support**
4040
Include the user's email address to display their Gravatar image. This can be combined with your own avatar image to provide a fallback option.
4141

4242
---
4343

44-
<img width="200" align="left" src="https://github.com/kolking/react-native-userpic/assets/4656448/91f3bab9-f1cd-4d4d-9965-967ca524f484" />
44+
<img width="200" align="left" src="https://github.com/kolking/react-native-avatar/assets/4656448/91f3bab9-f1cd-4d4d-9965-967ca524f484" />
4545

4646
**Numeric badges**
4747
You can add a badge to display the count of unread messages or the online/offline status of the user. The position of the badge can also be customized.
4848

4949
---
5050

51-
<img width="200" align="left" src="https://github.com/kolking/react-native-userpic/assets/4656448/9b7a07b9-b988-492c-b9d0-e74e3e3208ed" />
51+
<img width="200" align="left" src="https://github.com/kolking/react-native-avatar/assets/4656448/9b7a07b9-b988-492c-b9d0-e74e3e3208ed" />
5252

5353
**Custom badges**
5454
Another option for utilizing avatar badges is to display a custom status icon, such as an emoji, for example.
@@ -59,23 +59,23 @@ Another option for utilizing avatar badges is to display a custom status icon, s
5959

6060
### yarn
6161
```sh
62-
yarn add react-native-userpic
62+
yarn add @kolking/react-native-avatar
6363
```
6464
### npm
6565
```sh
66-
npm install react-native-userpic
66+
npm install @kolking/react-native-avatar
6767
```
6868

6969
## Basic Example
7070

7171
```jsx
7272
import React from 'react';
7373
import { View, StyleSheet } from 'react-native';
74-
import { Userpic } from 'react-native-userpic';
74+
import { Avatar } from '@kolking/react-native-avatar';
7575

7676
const MyComponent = ({ userImage, userEmail }) => (
7777
<View style={styles.wrapper}>
78-
<Userpic source={{ uri: userImage }} email={userEmail} />
78+
<Avatar source={{ uri: userImage }} email={userEmail} />
7979
</View>
8080
);
8181

@@ -95,7 +95,7 @@ export default MyComponent;
9595
```jsx
9696
import React from 'react';
9797
import { View, StyleSheet } from 'react-native';
98-
import { Userpic } from 'react-native-userpic';
98+
import { Avatar } from '@kolking/react-native-avatar';
9999

100100
const defaultImage = require('./assets/defaultAvatar.png');
101101
const badgeProps = {
@@ -106,7 +106,7 @@ const badgeProps = {
106106

107107
const MyComponent = ({ userImage, userEmail, userName, unreadCount }) => (
108108
<View style={styles.wrapper}>
109-
<Userpic
109+
<Avatar
110110
size={60}
111111
defaultSource={defaultImage}
112112
source={{ uri: userImage }}
@@ -152,7 +152,7 @@ Prop | Type | Default | Description
152152

153153
## Badge Component
154154

155-
<img width="200" align="left" src="https://github.com/kolking/react-native-userpic/assets/4656448/6ee48b43-d2ac-40bb-ab21-152a93637e4a" />
155+
<img width="200" align="left" src="https://github.com/kolking/react-native-avatar/assets/4656448/6ee48b43-d2ac-40bb-ab21-152a93637e4a" />
156156

157157
The badge can be used as a standalone component. The font size of the badge text value is calculated based on the `size` prop, so you normally don't have to specify it. By default, the badge appears with a spring animation, which can be disabled using the `animate` prop. To position the badge absolutely over its parent, use the `position` prop along with the `parentRadius` prop.
158158

@@ -161,7 +161,7 @@ The badge can be used as a standalone component. The font size of the badge text
161161
```jsx
162162
import React, { useState } from 'react';
163163
import { StyleSheet, Text, TouchableHighlight, View } from 'react-native';
164-
import { Badge } from 'react-native-userpic';
164+
import { Badge } from '@kolking/react-native-avatar';
165165

166166
const MyComponent = () => {
167167
const [badge, setBadge] = useState(0);
@@ -225,7 +225,7 @@ Prop | Type | Default | Description
225225

226226
## Feedback
227227

228-
I appreciate your feedback, so please star the repository if you like it. This is the best motivation for me to maintain the package and add new features. If you have any feature requests, found a bug, or have ideas for improvement, feel free to [open an issue](https://github.com/kolking/react-native-userpic/issues).
228+
I appreciate your feedback, so please star the repository if you like it. This is the best motivation for me to maintain the package and add new features. If you have any feature requests, found a bug, or have ideas for improvement, feel free to [open an issue](https://github.com/kolking/react-native-avatar/issues).
229229

230230
## License
231231

example/App.tsx

+26-26
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
TouchableHighlight,
99
View,
1010
} from 'react-native';
11-
import { Badge, Userpic, UserpicProps } from 'react-native-userpic';
11+
import { Badge, Avatar, AvatarProps } from '@kolking/react-native-avatar';
1212

1313
StatusBar.setBarStyle('light-content');
1414

@@ -50,61 +50,61 @@ const App = () => {
5050
<View style={styles.container}>
5151
<View style={styles.row}>
5252
<Text style={styles.label}>Shape</Text>
53-
<Userpic radius={0} />
54-
<Userpic radius={15} />
55-
<Userpic />
53+
<Avatar radius={0} />
54+
<Avatar radius={15} />
55+
<Avatar />
5656
</View>
5757
<View style={styles.row}>
5858
<Text style={styles.label} onPress={toggleBadImage}>
5959
No image
6060
</Text>
61-
<Userpic source={badImage} />
62-
<Userpic defaultSource={require('./assets/custom.png')} />
63-
<Userpic name="👩" />
61+
<Avatar source={badImage} />
62+
<Avatar defaultSource={require('./assets/custom.png')} />
63+
<Avatar name="👩" />
6464
</View>
6565
<View style={styles.row}>
6666
<Text style={styles.label}>Initials</Text>
67-
<Userpic name="Nick" color="gray" />
68-
<Userpic name="Jason Smith" colorize={true} />
69-
<Userpic name="Emma Miller" email="[email protected]" colorize={true} />
67+
<Avatar name="Nick" color="gray" />
68+
<Avatar name="Jason Smith" colorize={true} />
69+
<Avatar name="Emma Miller" email="[email protected]" colorize={true} />
7070
</View>
7171
<View style={styles.row}>
7272
<Text style={styles.label} onPress={toggleImage}>
7373
Image
7474
</Text>
75-
<Userpic source={IMAGES[image]} />
76-
<Userpic source={IMAGES[3]} />
77-
<Userpic source={IMAGES[6]} />
75+
<Avatar source={IMAGES[image]} />
76+
<Avatar source={IMAGES[3]} />
77+
<Avatar source={IMAGES[6]} />
7878
</View>
7979
<View style={styles.row}>
8080
<Text style={styles.label}>Gravatar</Text>
81-
<Userpic radius={10} email="[email protected]" />
82-
<Userpic radius={10} email="[email protected]" />
83-
<Userpic radius={10} email="[email protected]" />
81+
<Avatar radius={10} email="[email protected]" />
82+
<Avatar radius={10} email="[email protected]" />
83+
<Avatar radius={10} email="[email protected]" />
8484
</View>
8585
<View style={styles.row}>
8686
<Text style={styles.label} onPress={toggleBadge}>
8787
Badge
8888
</Text>
89-
<Userpic email="[email protected]" badge={!!badge} badgeColor="#34c759" />
90-
<Userpic radius={15} email="[email protected]" badge={badge} badgeColor="#007aff" />
91-
<Userpic
89+
<Avatar email="[email protected]" badge={!!badge} badgeColor="#34c759" />
90+
<Avatar radius={15} email="[email protected]" badge={badge} badgeColor="#007aff" />
91+
<Avatar
9292
radius={10}
9393
9494
badge={badge ? badge + 100 : undefined}
9595
/>
9696
</View>
9797
<View style={styles.row}>
9898
<Text style={styles.label}>Status</Text>
99-
<Userpic email="[email protected]" badge="👋" badgeProps={statusBadgeProps} />
100-
<Userpic email="[email protected]" badge="😀" badgeProps={statusBadgeProps} />
101-
<Userpic email="[email protected]" badge="🐵" badgeProps={statusBadgeProps} />
99+
<Avatar email="[email protected]" badge="👋" badgeProps={statusBadgeProps} />
100+
<Avatar email="[email protected]" badge="😀" badgeProps={statusBadgeProps} />
101+
<Avatar email="[email protected]" badge="🐵" badgeProps={statusBadgeProps} />
102102
</View>
103103
<View style={styles.row}>
104104
<Text style={styles.label}>Size</Text>
105-
<Userpic radius={8} size={30} email="[email protected]" />
106-
<Userpic radius={12} size={50} email="[email protected]" />
107-
<Userpic radius={18} size={75} email="[email protected]" />
105+
<Avatar radius={8} size={30} email="[email protected]" />
106+
<Avatar radius={12} size={50} email="[email protected]" />
107+
<Avatar radius={18} size={75} email="[email protected]" />
108108
</View>
109109
<TouchableHighlight
110110
style={styles.button}
@@ -165,7 +165,7 @@ const styles = StyleSheet.create({
165165
},
166166
});
167167

168-
const statusBadgeProps: UserpicProps['badgeProps'] = {
168+
const statusBadgeProps: AvatarProps['badgeProps'] = {
169169
size: 22,
170170
position: 'bottom-right',
171171
style: styles.badgeStyle,

example/App2.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { useCallback, useState } from 'react';
22
import { Pressable, StyleSheet, View } from 'react-native';
3-
import { Userpic, UserpicProps } from 'react-native-userpic';
3+
import { Avatar, AvatarProps } from '@kolking/react-native-avatar';
44

5-
const badgeProps: UserpicProps[] = [
5+
const badgeProps: AvatarProps[] = [
66
{
77
defaultSource: require('./assets/custom.png'),
88
},
@@ -79,7 +79,7 @@ const App = () => {
7979
return (
8080
<View style={styles.wrapper}>
8181
<Pressable onPress={toggleProps}>
82-
<Userpic size={100} color="#636366" {...badgeProps[props]} />
82+
<Avatar size={100} color="#636366" {...badgeProps[props]} />
8383
</Pressable>
8484
</View>
8585
);

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"name": "react-native-userpic",
2+
"name": "@kolking/react-native-avatar",
33
"version": "2.0.3",
44
"description": "Display user avatars in React Native like a pro with support for Gravatar, user initials, unique colors, badges, statuses, and more.",
55
"author": "Nick Seryakov (https://github.com/kolking)",
66
"license": "MIT",
7-
"homepage": "https://github.com/kolking/react-native-userpic#readme",
7+
"homepage": "https://github.com/kolking/react-native-avatar#readme",
88
"repository": {
99
"type": "git",
10-
"url": "git+https://[email protected]/kolking/react-native-userpic.git"
10+
"url": "git+https://[email protected]/kolking/react-native-avatar.git"
1111
},
1212
"bugs": {
13-
"url": "https://github.com/kolking/react-native-userpic/issues"
13+
"url": "https://github.com/kolking/react-native-avatar/issues"
1414
},
1515
"keywords": [
1616
"react-native",
@@ -19,6 +19,7 @@
1919
"userpic",
2020
"avatar",
2121
"gravatar",
22+
"avatar image",
2223
"user picture",
2324
"user image",
2425
"user avatar",

src/Userpic.tsx src/Avatar.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface Props extends ViewProps {
3333
badgeProps?: Omit<BadgeProps, 'value' | 'color' | 'parentRadius'>;
3434
}
3535

36-
const Userpic = ({
36+
const Avatar = ({
3737
size = 50,
3838
name,
3939
email,
@@ -64,7 +64,7 @@ const Userpic = ({
6464
setImageSource(defaultSource);
6565
}, [defaultSource]);
6666

67-
// debug('RENDER <Userpic>', name || email || imageSource);
67+
// debug('RENDER <Avatar>', name || email || imageSource);
6868

6969
return (
7070
<View {...props} style={[styles.root, { width: size, height: size }]}>
@@ -108,4 +108,4 @@ const styles = StyleSheet.create({
108108
},
109109
});
110110

111-
export default React.memo(Userpic);
111+
export default React.memo(Avatar);

src/__tests__/Userpic.tsx src/__tests__/Avatar.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import TestRenderer, { act } from 'react-test-renderer';
77
/**
88
* Under test
99
*/
10-
import { Userpic, UserpicProps } from '../';
10+
import { Avatar, AvatarProps } from '../';
1111
import { getGravatarSource, getInitials, getStringColor } from '../helpers';
1212

13-
const createElement = (props: Partial<UserpicProps>) => <Userpic {...props} />;
13+
const createElement = (props: Partial<AvatarProps>) => <Avatar {...props} />;
1414

15-
const createRenderer = (props: Partial<UserpicProps>) => TestRenderer.create(createElement(props));
15+
const createRenderer = (props: Partial<AvatarProps>) => TestRenderer.create(createElement(props));
1616

1717
it('should match snapshot', () => {
1818
expect(createRenderer({ badge: 35 })).toMatchSnapshot();

src/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { default as Badge } from './Badge';
2-
export { default as Userpic } from './Userpic';
2+
export { default as Avatar } from './Avatar';
33
export type { Props as BadgeProps } from './Badge';
4-
export type { Props as UserpicProps } from './Userpic';
4+
export type { Props as AvatarProps } from './Avatar';

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compilerOptions": {
44
"baseUrl": "./",
55
"paths": {
6-
"react-native-userpic": ["./src/index"]
6+
"@kolking/react-native-avatar": ["./src/index"]
77
}
88
}
99
}

0 commit comments

Comments
 (0)