@hoddy-ui/core 2.5.36 → 2.5.37
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/package.json +1 -1
- package/src/Components/StarRating.tsx +10 -2
- package/src/types.ts +2 -0
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ import Typography from "./Typography";
|
|
|
17
17
|
export const RatingStars: FC<RatingStarsProps> = ({
|
|
18
18
|
rating = 0,
|
|
19
19
|
size = 16,
|
|
20
|
+
color = "#FFD700",
|
|
20
21
|
}) => {
|
|
21
22
|
const colors = useColors();
|
|
22
23
|
|
|
@@ -29,7 +30,12 @@ export const RatingStars: FC<RatingStarsProps> = ({
|
|
|
29
30
|
return (
|
|
30
31
|
<View style={styles.root}>
|
|
31
32
|
{[...Array(Math.floor(rating))].map((_, index) => (
|
|
32
|
-
<Ionicons
|
|
33
|
+
<Ionicons
|
|
34
|
+
key={index}
|
|
35
|
+
name="star"
|
|
36
|
+
size={size}
|
|
37
|
+
color={colors[color as keyof typeof colors]?.main || color}
|
|
38
|
+
/>
|
|
33
39
|
))}
|
|
34
40
|
{[...Array(5 - Math.floor(rating))].map((_, index) => (
|
|
35
41
|
<Ionicons
|
|
@@ -47,6 +53,7 @@ export const RatingInput: FC<RatingInputProps> = ({
|
|
|
47
53
|
onSubmit: _onSubmit,
|
|
48
54
|
rating = 0,
|
|
49
55
|
size = 16,
|
|
56
|
+
color = "primary",
|
|
50
57
|
}) => {
|
|
51
58
|
const [showReviewsModal, setShowReviewsModal] = useState(false);
|
|
52
59
|
const [rate, setRate] = useState(0);
|
|
@@ -107,7 +114,7 @@ export const RatingInput: FC<RatingInputProps> = ({
|
|
|
107
114
|
style={{ marginLeft: 10 }}
|
|
108
115
|
name={index < rate ? "star" : "star-outline"}
|
|
109
116
|
size={size}
|
|
110
|
-
color={colors
|
|
117
|
+
color={colors[color as keyof typeof colors]?.main || color}
|
|
111
118
|
/>
|
|
112
119
|
</TouchableOpacity>
|
|
113
120
|
))
|
|
@@ -144,6 +151,7 @@ export const RatingInput: FC<RatingInputProps> = ({
|
|
|
144
151
|
value={review}
|
|
145
152
|
onChangeText={(text) => setReview(text)}
|
|
146
153
|
placeholder="Type review here.."
|
|
154
|
+
verticalAlign="top"
|
|
147
155
|
/>
|
|
148
156
|
</View>
|
|
149
157
|
<Button
|
package/src/types.ts
CHANGED
|
@@ -311,6 +311,7 @@ export interface OTPInputProps {
|
|
|
311
311
|
export interface RatingStarsProps {
|
|
312
312
|
rating: number;
|
|
313
313
|
size: number;
|
|
314
|
+
color?: colorTypes | (string & {});
|
|
314
315
|
}
|
|
315
316
|
|
|
316
317
|
export interface RatingInputProps {
|
|
@@ -318,6 +319,7 @@ export interface RatingInputProps {
|
|
|
318
319
|
noReview?: boolean;
|
|
319
320
|
size?: number;
|
|
320
321
|
onSubmit?: (data: { rating: number; review: string }) => Promise<void>;
|
|
322
|
+
color?: colorTypes | (string & {});
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
export interface DividerProps {
|