@momo-kits/avatar 0.81.21 → 0.81.22

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 +3 -29
  2. package/package.json +2 -2
  3. package/styles.ts +1 -1
package/index.tsx CHANGED
@@ -34,24 +34,6 @@ const Avatar: FC<AvatarProps> = ({
34
34
  return lastTwoWords.map(word => word.charAt(0).toUpperCase()).join('');
35
35
  };
36
36
 
37
- const getIconPosition = () => {
38
- let position = 2;
39
-
40
- if (size === 56) {
41
- position = 0;
42
- }
43
-
44
- if (size < 56) {
45
- position = 0;
46
- }
47
-
48
- if (size < 32) {
49
- position = -2;
50
- }
51
-
52
- return position;
53
- };
54
-
55
37
  const getIconSize = () => {
56
38
  switch (size) {
57
39
  case 24: {
@@ -78,13 +60,13 @@ const Avatar: FC<AvatarProps> = ({
78
60
  }
79
61
  };
80
62
 
81
- const iconPosition = getIconPosition();
82
63
  const iconSize = getIconSize();
83
64
  const shouldShowIconTop = showIconMomo && rounded;
84
65
  const shouldShowIconBottom = showIconSupport && rounded;
85
66
  const supportIconSize = {
86
67
  width: getIconSize() / 2,
87
68
  height: getIconSize() / 2,
69
+ borderRadius: getIconSize() / 4,
88
70
  };
89
71
 
90
72
  return (
@@ -102,11 +84,7 @@ const Avatar: FC<AvatarProps> = ({
102
84
  {shouldShowIconTop && (
103
85
  <Image
104
86
  source={{uri: logo}}
105
- style={[
106
- styles.icon,
107
- supportIconSize,
108
- {top: iconPosition, right: iconPosition},
109
- ]}
87
+ style={[styles.icon, supportIconSize, {top: 0, right: 0}]}
110
88
  />
111
89
  )}
112
90
  {!!name && !image && (
@@ -131,11 +109,7 @@ const Avatar: FC<AvatarProps> = ({
131
109
  {shouldShowIconBottom && (
132
110
  <Image
133
111
  source={{uri: iconSupport}}
134
- style={[
135
- styles.icon,
136
- supportIconSize,
137
- {bottom: iconPosition, right: iconPosition},
138
- ]}
112
+ style={[styles.icon, supportIconSize, {bottom: 0, right: 0}]}
139
113
  />
140
114
  )}
141
115
  </View>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/avatar",
3
- "version": "0.81.21",
3
+ "version": "0.81.22",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {
@@ -14,4 +14,4 @@
14
14
  },
15
15
  "license": "MoMo",
16
16
  "dependencies": {}
17
- }
17
+ }
package/styles.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {StyleSheet} from 'react-native';
2
- import {Radius} from '@momo-kits/foundation';
2
+ import {Colors, Radius} from '@momo-kits/foundation';
3
3
  export default StyleSheet.create({
4
4
  icon: {
5
5
  position: 'absolute',