@umituz/react-native-settings 4.17.16 → 4.17.17
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.17.
|
|
4
|
-
"description": "Complete settings hub for React Native apps - consolidated package with settings, about, legal, appearance, feedback, and
|
|
3
|
+
"version": "4.17.17",
|
|
4
|
+
"description": "Complete settings hub for React Native apps - consolidated package with settings, about, legal, appearance, feedback, FAQs, and rating",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"appearance",
|
|
25
25
|
"feedback",
|
|
26
26
|
"faqs",
|
|
27
|
+
"rating",
|
|
27
28
|
"consolidated"
|
|
28
29
|
],
|
|
29
30
|
"author": "Ümit UZ <umit@umituz.com>",
|
|
@@ -42,7 +43,6 @@
|
|
|
42
43
|
"@umituz/react-native-localization": "latest",
|
|
43
44
|
"@umituz/react-native-notifications": "latest",
|
|
44
45
|
"@umituz/react-native-onboarding": "latest",
|
|
45
|
-
"@umituz/react-native-rating": "latest",
|
|
46
46
|
"@umituz/react-native-sentry": "latest",
|
|
47
47
|
"@umituz/react-native-storage": "latest",
|
|
48
48
|
"react": ">=19.0.0",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"@umituz/react-native-localization": "latest",
|
|
62
62
|
"@umituz/react-native-notifications": "latest",
|
|
63
63
|
"@umituz/react-native-onboarding": "latest",
|
|
64
|
-
"@umituz/react-native-rating": "latest",
|
|
65
64
|
"@umituz/react-native-storage": "latest",
|
|
66
65
|
"react": "19.1.0",
|
|
67
66
|
"react-native": "0.81.5",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type RatingValue = 0 | 1 | 2 | 3 | 4 | 5;
|
|
2
|
+
|
|
3
|
+
export interface Rating {
|
|
4
|
+
id: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
entityId: string;
|
|
7
|
+
entityType: string;
|
|
8
|
+
value: RatingValue;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface RatingStats {
|
|
14
|
+
average: number;
|
|
15
|
+
count: number;
|
|
16
|
+
distribution: Record<RatingValue, number>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rating Domain
|
|
3
|
+
* Star ratings, user reviews, and statistics
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// DOMAIN LAYER - Entities
|
|
8
|
+
// =============================================================================
|
|
9
|
+
|
|
10
|
+
export type {
|
|
11
|
+
RatingValue,
|
|
12
|
+
Rating,
|
|
13
|
+
RatingStats,
|
|
14
|
+
} from './domain/entities/Rating';
|
|
15
|
+
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// PRESENTATION LAYER - Components
|
|
18
|
+
// =============================================================================
|
|
19
|
+
|
|
20
|
+
export { StarRating } from './presentation/components/StarRating';
|
|
21
|
+
export type { StarRatingProps } from './presentation/components/StarRating';
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, ViewStyle } from "react-native";
|
|
3
|
+
import { useAppDesignTokens, AtomicIcon } from "@umituz/react-native-design-system";
|
|
4
|
+
|
|
5
|
+
export interface StarRatingProps {
|
|
6
|
+
rating: number;
|
|
7
|
+
maxRating?: number;
|
|
8
|
+
onRatingChange?: (rating: number) => void;
|
|
9
|
+
size?: number;
|
|
10
|
+
activeColor?: string;
|
|
11
|
+
inactiveColor?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
style?: ViewStyle;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const StarRating: React.FC<StarRatingProps> = ({
|
|
17
|
+
rating,
|
|
18
|
+
maxRating = 5,
|
|
19
|
+
onRatingChange,
|
|
20
|
+
size = 24,
|
|
21
|
+
activeColor,
|
|
22
|
+
inactiveColor,
|
|
23
|
+
disabled = false,
|
|
24
|
+
style,
|
|
25
|
+
}) => {
|
|
26
|
+
const tokens = useAppDesignTokens();
|
|
27
|
+
const [internalRating, setInternalRating] = useState(rating);
|
|
28
|
+
|
|
29
|
+
const filledColor = activeColor || tokens.colors.warning || "#FFD700";
|
|
30
|
+
const emptyColor = inactiveColor || tokens.colors.border || "#E0E0E0";
|
|
31
|
+
|
|
32
|
+
const handlePress = (index: number) => {
|
|
33
|
+
if (disabled) return;
|
|
34
|
+
const newRating = index + 1;
|
|
35
|
+
setInternalRating(newRating);
|
|
36
|
+
onRatingChange?.(newRating);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<View style={[styles.container, style]}>
|
|
41
|
+
{Array.from({ length: maxRating }).map((_, index) => (
|
|
42
|
+
<TouchableOpacity
|
|
43
|
+
key={index}
|
|
44
|
+
onPress={() => handlePress(index)}
|
|
45
|
+
disabled={disabled}
|
|
46
|
+
activeOpacity={0.7}
|
|
47
|
+
style={styles.starContainer}
|
|
48
|
+
>
|
|
49
|
+
<AtomicIcon
|
|
50
|
+
name={index < (onRatingChange ? internalRating : rating) ? "star" : "star-outline"}
|
|
51
|
+
customSize={size}
|
|
52
|
+
customColor={index < (onRatingChange ? internalRating : rating) ? filledColor : emptyColor}
|
|
53
|
+
/>
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
))}
|
|
56
|
+
</View>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
container: {
|
|
62
|
+
flexDirection: "row",
|
|
63
|
+
alignItems: "center",
|
|
64
|
+
gap: 4,
|
|
65
|
+
},
|
|
66
|
+
starContainer: {
|
|
67
|
+
padding: 4,
|
|
68
|
+
},
|
|
69
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -99,6 +99,9 @@ export * from './domains/feedback';
|
|
|
99
99
|
// FAQs Domain - Frequently asked questions
|
|
100
100
|
export * from './domains/faqs';
|
|
101
101
|
|
|
102
|
+
// Rating Domain - Star ratings, reviews, statistics
|
|
103
|
+
export * from './domains/rating';
|
|
104
|
+
|
|
102
105
|
// =============================================================================
|
|
103
106
|
// PRESENTATION LAYER - Re-exports from Dependencies
|
|
104
107
|
// =============================================================================
|