@momo-kits/rating 0.169.7 → 0.169.9

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/index.tsx CHANGED
@@ -1,7 +1,11 @@
1
1
  import { Colors, Icon } from '@momo-kits/foundation';
2
2
  import React, { FC } from 'react';
3
3
  import { StyleSheet, TouchableOpacity, View } from 'react-native';
4
- import { RatingProps } from './type';
4
+ import { RatingProps } from './types';
5
+
6
+ const LARGE_STAR_SIZE = 24;
7
+ const MEDIUM_STAR_SIZE = 20;
8
+ const SMALL_STAR_SIZE = 16;
5
9
 
6
10
  /** Parses a number prop that may be a string with a comma decimal (`'4,5'`). */
7
11
  const toNumber = (value: number | string) => {
@@ -46,11 +50,11 @@ const Rating: FC<RatingProps> = ({
46
50
  return Colors.black_07;
47
51
  };
48
52
 
49
- let sizes = 24;
53
+ let starSize = LARGE_STAR_SIZE;
50
54
  if (size === 'small') {
51
- sizes = 16;
55
+ starSize = SMALL_STAR_SIZE;
52
56
  } else if (size === 'medium') {
53
- sizes = 20;
57
+ starSize = MEDIUM_STAR_SIZE;
54
58
  }
55
59
 
56
60
  return (
@@ -64,7 +68,7 @@ const Rating: FC<RatingProps> = ({
64
68
  >
65
69
  <Icon
66
70
  source={renderStar(index)}
67
- size={sizes}
71
+ size={starSize}
68
72
  color={tintColor(index)}
69
73
  />
70
74
  </TouchableOpacity>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/rating",
3
- "version": "0.169.7",
3
+ "version": "0.169.9",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {
@@ -1,4 +1,4 @@
1
- import {TouchableOpacityProps} from 'react-native';
1
+ import { TouchableOpacityProps } from 'react-native';
2
2
 
3
3
  export interface RatingProps extends TouchableOpacityProps {
4
4
  /**
@@ -19,7 +19,7 @@ export interface RatingProps extends TouchableOpacityProps {
19
19
 
20
20
  /**
21
21
  * `size`: Optional. Represents the size of the Rating component.
22
- * Defaults to `large` is 24 if not provided.
22
+ * Defaults to `large` (24) if not provided.
23
23
  */
24
24
  size?: 'small' | 'medium' | 'large';
25
25
  }