@momo-kits/foundation 0.162.2-beta.17 → 0.162.2-beta.19

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.
package/Button/index.tsx CHANGED
@@ -49,12 +49,6 @@ export interface ButtonProps extends TouchableOpacityProps {
49
49
  iconRight?: string;
50
50
  iconLeft?: string;
51
51
  title: string;
52
- /**
53
- * When true, hides the label and renders only the centered icon.
54
- * `title` stays required and is used as the accessibility label.
55
- * Icon-only buttons hug their icon, so the `full` prop is ignored.
56
- */
57
- iconOnly?: boolean;
58
52
  tintColor?: string;
59
53
  loading?: boolean;
60
54
  onPress: () => void;
@@ -68,7 +62,6 @@ const Button: FC<ButtonProps> = ({
68
62
  full = true,
69
63
  iconRight,
70
64
  iconLeft,
71
- iconOnly = false,
72
65
  loading = false,
73
66
  title = 'Button',
74
67
  params,
@@ -270,8 +263,8 @@ const Button: FC<ButtonProps> = ({
270
263
  {
271
264
  width: iconSize,
272
265
  height: iconSize,
273
- marginRight: !iconOnly && isLeft ? space : 0,
274
- marginLeft: !iconOnly && !isLeft ? space : 0,
266
+ marginRight: isLeft ? space : 0,
267
+ marginLeft: isLeft ? 0 : space,
275
268
  },
276
269
  ];
277
270
 
@@ -319,14 +312,10 @@ const Button: FC<ButtonProps> = ({
319
312
  const sizeStyle = getSizeStyle();
320
313
  const typeStyle = getTypeStyle();
321
314
  const containerStyle: ViewStyle = StyleSheet.flatten([
322
- full && !iconOnly && { width: '100%' },
315
+ full && { width: '100%' },
323
316
  loading && { opacity: 0.75 },
324
317
  ]);
325
- const buttonStyle = StyleSheet.flatten([
326
- sizeStyle,
327
- typeStyle,
328
- iconOnly && styles.iconOnly,
329
- ]);
318
+ const buttonStyle = StyleSheet.flatten([sizeStyle, typeStyle]);
330
319
 
331
320
  const animatedStyle = useAnimatedStyle(() => {
332
321
  return {
@@ -363,8 +352,8 @@ const Button: FC<ButtonProps> = ({
363
352
  onPressOut={animateOut}
364
353
  >
365
354
  <Reanimated.View style={[buttonStyle, animatedStyle]}>
366
- {renderIcon('left')}
367
- {!iconOnly && renderTitle()}
355
+ {renderIcon('left')}
356
+ {renderTitle()}
368
357
  {renderIcon('right')}
369
358
  {gradientPros && (
370
359
  <LinearGradient {...gradientPros} style={styles.gradientView} />
package/Button/styles.ts CHANGED
@@ -29,9 +29,6 @@ export default StyleSheet.create({
29
29
  paddingHorizontal: 8,
30
30
  minWidth: 60,
31
31
  },
32
- iconOnly: {
33
- minWidth: 0,
34
- },
35
32
  leading: {
36
33
  overflow: 'hidden',
37
34
  alignItems: 'center',
@@ -28,7 +28,12 @@ export interface IconButtonProps extends TouchableOpacityProps {
28
28
  /**
29
29
  * Optional. Defines the size of the IconButton.
30
30
  */
31
- size?: 'large' | 'small';
31
+ size?: 'large' | 'medium' | 'small';
32
+
33
+ /**
34
+ * Optional. Defines the shape of the IconButton.
35
+ */
36
+ shape?: 'circle' | 'square';
32
37
 
33
38
  /**
34
39
  * Optional. Params auto tracking component.
@@ -40,6 +45,7 @@ const IconButton: React.FC<IconButtonProps> = ({
40
45
  type = 'primary',
41
46
  icon,
42
47
  size,
48
+ shape = 'circle',
43
49
  params,
44
50
  ...rest
45
51
  }) => {
@@ -52,10 +58,21 @@ const IconButton: React.FC<IconButtonProps> = ({
52
58
  * get size icon button
53
59
  */
54
60
  const getSizeStyle = () => {
55
- if (size === 'small') {
56
- return styles.small;
61
+ switch (size) {
62
+ case 'small':
63
+ return styles.small;
64
+ case 'medium':
65
+ return styles.medium;
66
+ default:
67
+ return styles.large;
57
68
  }
58
- return styles.large;
69
+ };
70
+
71
+ /**
72
+ * get shape icon button
73
+ */
74
+ const getShapeStyle = () => {
75
+ return shape === 'square' ? styles.square : styles.circle;
59
76
  };
60
77
 
61
78
  /**
@@ -117,8 +134,13 @@ const IconButton: React.FC<IconButtonProps> = ({
117
134
  };
118
135
 
119
136
  const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
120
- const buttonStyle = StyleSheet.flatten([getTypeStyle(), getSizeStyle()]);
121
- const iconSize = size === 'small' ? 16 : 24;
137
+ const buttonStyle = StyleSheet.flatten([
138
+ getTypeStyle(),
139
+ styles.base,
140
+ getSizeStyle(),
141
+ getShapeStyle(),
142
+ ]);
143
+ const iconSize = size === 'small' || size === 'medium' ? 16 : 24;
122
144
 
123
145
  return (
124
146
  <ComponentContext.Provider
@@ -2,19 +2,27 @@ import { StyleSheet } from 'react-native';
2
2
  import { Radius, Colors } from '../Consts';
3
3
 
4
4
  export default StyleSheet.create({
5
+ base: {
6
+ justifyContent: 'center',
7
+ alignItems: 'center',
8
+ },
5
9
  large: {
6
10
  width: 48,
7
11
  height: 48,
8
- borderRadius: Radius.XL,
9
- justifyContent: 'center',
10
- alignItems: 'center',
12
+ },
13
+ medium: {
14
+ width: 36,
15
+ height: 36,
11
16
  },
12
17
  small: {
13
- width: 40,
14
- height: 40,
18
+ width: 28,
19
+ height: 28,
20
+ },
21
+ circle: {
15
22
  borderRadius: Radius.XL,
16
- justifyContent: 'center',
17
- alignItems: 'center',
23
+ },
24
+ square: {
25
+ borderRadius: Radius.S,
18
26
  },
19
27
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
20
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.162.2-beta.17",
3
+ "version": "0.162.2-beta.19",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -8,19 +8,19 @@
8
8
  "@momo-kits/foundation"
9
9
  ],
10
10
  "dependencies": {
11
+ "react-native-fast-image": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
11
12
  "@react-navigation/bottom-tabs": "7.4.2",
12
13
  "@react-navigation/core": "7.12.1",
13
14
  "@react-navigation/elements": "2.5.2",
14
15
  "@react-navigation/native": "7.1.14",
15
16
  "@react-navigation/routers": "7.4.1",
16
17
  "@react-navigation/stack": "7.4.2",
17
- "@shopify/flash-list": "2.1.0",
18
- "lottie-react-native": "7.2.4",
19
- "react-native-fast-image": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
20
18
  "react-native-gesture-handler": "2.27.1",
21
19
  "react-native-linear-gradient": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
22
20
  "react-native-reanimated": "4.2.2",
23
- "react-native-safe-area-context": "5.5.2"
21
+ "react-native-safe-area-context": "5.5.2",
22
+ "@shopify/flash-list": "2.1.0",
23
+ "lottie-react-native": "7.2.4"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react-native": "*"
@@ -32,4 +32,4 @@
32
32
  "registry": "https://registry.npmjs.org/"
33
33
  },
34
34
  "license": "MoMo"
35
- }
35
+ }