@momo-kits/avatar 0.167.1-duotest.1 → 0.167.1-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.tsx +5 -5
  2. package/package.json +15 -15
  3. package/styles.ts +11 -0
package/index.tsx CHANGED
@@ -43,8 +43,8 @@ const Avatar: FC<AvatarProps> = ({
43
43
  const {theme} = useContext(ApplicationContext);
44
44
  const borderRadius = rounded ? size / 2 : Spacing.XS;
45
45
 
46
- const getShortName = (name: string) => {
47
- const words = name.split(' ');
46
+ const getShortName = (fullName: string) => {
47
+ const words = fullName.split(' ');
48
48
  const lastTwoWords = words.slice(-2);
49
49
  return lastTwoWords.map(word => word.charAt(0).toUpperCase()).join('');
50
50
  };
@@ -94,8 +94,8 @@ const Avatar: FC<AvatarProps> = ({
94
94
  backgroundColor: Colors.pink_09,
95
95
  borderColor: theme.colors.border.default,
96
96
  borderRadius: borderRadius,
97
- overflow: Platform.OS === 'web' ? 'hidden' : undefined,
98
97
  },
98
+ Platform.OS === 'web' && styles.webOverflow,
99
99
  ]}
100
100
  accessibilityLabel={componentId}>
101
101
  {!!name && !image && (
@@ -129,14 +129,14 @@ const Avatar: FC<AvatarProps> = ({
129
129
  {shouldShowIconTop && (
130
130
  <Image
131
131
  source={{uri: logo}}
132
- style={[styles.icon, supportIconSize, {top: -1, right: -1}]}
132
+ style={[styles.icon, supportIconSize, styles.iconTop]}
133
133
  accessibilityLabel={componentId + '|top-icon'}
134
134
  />
135
135
  )}
136
136
  {shouldShowIconBottom && (
137
137
  <Image
138
138
  source={{uri: iconSupport}}
139
- style={[styles.icon, supportIconSize, {bottom: -1, right: -1}]}
139
+ style={[styles.icon, supportIconSize, styles.iconBottom]}
140
140
  accessibilityLabel={componentId + '|bottom-icon'}
141
141
  />
142
142
  )}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
- "name": "@momo-kits/avatar",
3
- "version": "0.167.1-duotest.1",
4
- "private": false,
5
- "main": "index.tsx",
6
- "peerDependencies": {
7
- "@momo-kits/foundation": "latest",
8
- "react": "*",
9
- "react-native": "*"
10
- },
11
- "license": "MoMo",
12
- "publishConfig": {
13
- "registry": "https://registry.npmjs.org/"
14
- },
15
- "dependencies": {}
16
- }
2
+ "name": "@momo-kits/avatar",
3
+ "version": "0.167.1-rc.2",
4
+ "private": false,
5
+ "main": "index.tsx",
6
+ "peerDependencies": {
7
+ "@momo-kits/foundation": "latest",
8
+ "react": "*",
9
+ "react-native": "*"
10
+ },
11
+ "license": "MoMo",
12
+ "publishConfig": {
13
+ "registry": "https://registry.npmjs.org/"
14
+ },
15
+ "dependencies": {}
16
+ }
package/styles.ts CHANGED
@@ -15,4 +15,15 @@ export default StyleSheet.create({
15
15
  width: '100%',
16
16
  height: '100%',
17
17
  },
18
+ webOverflow: {
19
+ overflow: 'hidden',
20
+ },
21
+ iconTop: {
22
+ top: -1,
23
+ right: -1,
24
+ },
25
+ iconBottom: {
26
+ bottom: -1,
27
+ right: -1,
28
+ },
18
29
  });