@umituz/react-native-settings 4.20.57 → 4.20.59
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/.github/ISSUE_TEMPLATE/bug_report.md +51 -0
- package/.github/ISSUE_TEMPLATE/documentation.md +52 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +63 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +84 -0
- package/AI_AGENT_GUIDELINES.md +367 -0
- package/ARCHITECTURE.md +246 -0
- package/CHANGELOG.md +67 -0
- package/CODE_OF_CONDUCT.md +75 -0
- package/CONTRIBUTING.md +107 -0
- package/DOCUMENTATION_MIGRATION.md +319 -0
- package/DOCUMENTATION_TEMPLATE.md +155 -0
- package/LICENSE +21 -0
- package/README.md +321 -498
- package/SECURITY.md +98 -0
- package/SETTINGS_SCREEN_GUIDE.md +185 -0
- package/TESTING.md +358 -0
- package/package.json +13 -2
- package/src/__tests__/setup.ts +1 -4
- package/src/application/README.md +85 -271
- package/src/domains/about/README.md +85 -440
- package/src/domains/about/presentation/hooks/README.md +93 -348
- package/src/domains/appearance/README.md +95 -584
- package/src/domains/appearance/hooks/README.md +95 -303
- package/src/domains/appearance/infrastructure/services/README.md +83 -397
- package/src/domains/appearance/presentation/components/README.md +99 -0
- package/src/domains/cloud-sync/README.md +73 -439
- package/src/domains/cloud-sync/presentation/components/README.md +95 -493
- package/src/domains/dev/README.md +71 -457
- package/src/domains/disclaimer/README.md +77 -411
- package/src/domains/disclaimer/presentation/components/README.md +95 -392
- package/src/domains/faqs/README.md +86 -574
- package/src/domains/feedback/README.md +79 -553
- package/src/domains/feedback/presentation/hooks/README.md +93 -426
- package/src/domains/legal/README.md +88 -537
- package/src/domains/rating/README.md +73 -440
- package/src/domains/rating/presentation/components/README.md +95 -475
- package/src/domains/video-tutorials/README.md +77 -470
- package/src/domains/video-tutorials/presentation/components/README.md +95 -431
- package/src/infrastructure/README.md +78 -425
- package/src/infrastructure/repositories/README.md +88 -420
- package/src/infrastructure/services/README.md +74 -460
- package/src/presentation/components/README.md +97 -480
- package/src/presentation/components/SettingsErrorBoundary/README.md +48 -442
- package/src/presentation/components/SettingsFooter/README.md +48 -427
- package/src/presentation/components/SettingsItemCard/README.md +153 -392
- package/src/presentation/components/SettingsItemCard/STRATEGY.md +164 -0
- package/src/presentation/components/SettingsSection/README.md +47 -401
- package/src/presentation/hooks/README.md +95 -389
- package/src/presentation/hooks/mutations/README.md +99 -376
- package/src/presentation/hooks/queries/README.md +111 -353
- package/src/presentation/navigation/README.md +70 -502
- package/src/presentation/navigation/components/README.md +70 -295
- package/src/presentation/navigation/hooks/README.md +75 -367
- package/src/presentation/navigation/utils/README.md +100 -380
- package/src/presentation/screens/README.md +53 -504
- package/src/presentation/screens/components/SettingsContent/README.md +53 -382
- package/src/presentation/screens/components/SettingsHeader/README.md +48 -303
- package/src/presentation/screens/components/sections/CustomSettingsList/README.md +47 -359
- package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +81 -176
- package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +40 -297
- package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +47 -451
- package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +45 -361
- package/src/presentation/screens/hooks/README.md +64 -354
- package/src/presentation/screens/types/README.md +79 -409
- package/src/presentation/screens/utils/README.md +65 -255
|
@@ -1,475 +1,95 @@
|
|
|
1
|
-
# StarRating
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
| `emptyIcon` | `IconName` | `'star-outline'` | Empty star icon |
|
|
97
|
-
| `style` | `ViewStyle` | `undefined` | Custom container style |
|
|
98
|
-
|
|
99
|
-
## Component Structure
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
StarRating
|
|
103
|
-
└── Star Container (flex row)
|
|
104
|
-
├── Star 1
|
|
105
|
-
├── Star 2
|
|
106
|
-
├── Star 3
|
|
107
|
-
├── Star 4
|
|
108
|
-
└── Star 5
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Examples
|
|
112
|
-
|
|
113
|
-
### Standard Rating
|
|
114
|
-
|
|
115
|
-
```tsx
|
|
116
|
-
function ProductRating() {
|
|
117
|
-
const [rating, setRating] = useState(0);
|
|
118
|
-
|
|
119
|
-
return (
|
|
120
|
-
<View>
|
|
121
|
-
<Text>Rate this product:</Text>
|
|
122
|
-
<StarRating
|
|
123
|
-
rating={rating}
|
|
124
|
-
onRatingChange={setRating}
|
|
125
|
-
/>
|
|
126
|
-
<Text>Rating: {rating}/5</Text>
|
|
127
|
-
</View>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### With Half Stars (Simulated)
|
|
133
|
-
|
|
134
|
-
```tsx
|
|
135
|
-
function HalfStarRating() {
|
|
136
|
-
const [rating, setRating] = useState(0);
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<View>
|
|
140
|
-
<StarRating
|
|
141
|
-
rating={Math.ceil(rating)}
|
|
142
|
-
maxStars={10}
|
|
143
|
-
size={12}
|
|
144
|
-
onRatingChange={(value) => setRating(value / 2)}
|
|
145
|
-
/>
|
|
146
|
-
<Text>{rating}/5</Text>
|
|
147
|
-
</View>
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Large Display Rating
|
|
153
|
-
|
|
154
|
-
```tsx
|
|
155
|
-
function RatingSummary({ averageRating, totalRatings }) {
|
|
156
|
-
return (
|
|
157
|
-
<View style={styles.container}>
|
|
158
|
-
<StarRating
|
|
159
|
-
rating={averageRating}
|
|
160
|
-
size={32}
|
|
161
|
-
readonly={true}
|
|
162
|
-
/>
|
|
163
|
-
<Text style={styles.ratingText}>
|
|
164
|
-
{averageRating.toFixed(1)} out of 5
|
|
165
|
-
</Text>
|
|
166
|
-
<Text style={styles.totalText}>
|
|
167
|
-
{totalRatings} ratings
|
|
168
|
-
</Text>
|
|
169
|
-
</View>
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Custom Star Style
|
|
175
|
-
|
|
176
|
-
```tsx
|
|
177
|
-
function CustomStyleRating() {
|
|
178
|
-
const [rating, setRating] = useState(0);
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<StarRating
|
|
182
|
-
rating={rating}
|
|
183
|
-
onRatingChange={setRating}
|
|
184
|
-
maxStars={6}
|
|
185
|
-
size={30}
|
|
186
|
-
color="#E91E63"
|
|
187
|
-
emptyColor="#FCE4EC"
|
|
188
|
-
spacing={8}
|
|
189
|
-
icon="heart"
|
|
190
|
-
emptyIcon="heart-outline"
|
|
191
|
-
/>
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### With Rating Labels
|
|
197
|
-
|
|
198
|
-
```tsx
|
|
199
|
-
function LabeledRating() {
|
|
200
|
-
const [rating, setRating] = useState(0);
|
|
201
|
-
|
|
202
|
-
const labels = ['Poor', 'Fair', 'Good', 'Very Good', 'Excellent'];
|
|
203
|
-
|
|
204
|
-
return (
|
|
205
|
-
<View>
|
|
206
|
-
<StarRating
|
|
207
|
-
rating={rating}
|
|
208
|
-
onRatingChange={setRating}
|
|
209
|
-
/>
|
|
210
|
-
{rating > 0 && (
|
|
211
|
-
<Text style={styles.label}>
|
|
212
|
-
{labels[rating - 1]}
|
|
213
|
-
</Text>
|
|
214
|
-
)}
|
|
215
|
-
</View>
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### Feedback Form Rating
|
|
221
|
-
|
|
222
|
-
```tsx
|
|
223
|
-
function FeedbackRating() {
|
|
224
|
-
const [rating, setRating] = useState(0);
|
|
225
|
-
|
|
226
|
-
return (
|
|
227
|
-
<View style={styles.container}>
|
|
228
|
-
<Text style={styles.question}>
|
|
229
|
-
How would you rate your experience?
|
|
230
|
-
</Text>
|
|
231
|
-
|
|
232
|
-
<StarRating
|
|
233
|
-
rating={rating}
|
|
234
|
-
size={40}
|
|
235
|
-
spacing={12}
|
|
236
|
-
color="#FFD700"
|
|
237
|
-
onRatingChange={setRating}
|
|
238
|
-
/>
|
|
239
|
-
|
|
240
|
-
{rating === 0 && (
|
|
241
|
-
<Text style={styles.hint}>
|
|
242
|
-
Tap a star to rate
|
|
243
|
-
</Text>
|
|
244
|
-
)}
|
|
245
|
-
|
|
246
|
-
{rating > 0 && rating <= 2 && (
|
|
247
|
-
<Text style={styles.message}>
|
|
248
|
-
We're sorry to hear that. How can we improve?
|
|
249
|
-
</Text>
|
|
250
|
-
)}
|
|
251
|
-
|
|
252
|
-
{rating >= 4 && (
|
|
253
|
-
<Text style={styles.message}>
|
|
254
|
-
Glad you liked it! Tell us more.
|
|
255
|
-
</Text>
|
|
256
|
-
)}
|
|
257
|
-
</View>
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### With Animation Delay
|
|
263
|
-
|
|
264
|
-
```tsx
|
|
265
|
-
function AnimatedRatingDisplay() {
|
|
266
|
-
const [rating, setRating] = useState(0);
|
|
267
|
-
|
|
268
|
-
const handleRatingChange = (newRating) => {
|
|
269
|
-
// Animate each star
|
|
270
|
-
for (let i = 1; i <= newRating; i++) {
|
|
271
|
-
setTimeout(() => {
|
|
272
|
-
setRating(i);
|
|
273
|
-
}, (i - 1) * 100);
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
return (
|
|
278
|
-
<StarRating
|
|
279
|
-
rating={rating}
|
|
280
|
-
onRatingChange={handleRatingChange}
|
|
281
|
-
/>
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
## Styling
|
|
287
|
-
|
|
288
|
-
### Default Styles
|
|
289
|
-
|
|
290
|
-
```typescript
|
|
291
|
-
const styles = StyleSheet.create({
|
|
292
|
-
container: {
|
|
293
|
-
flexDirection: 'row',
|
|
294
|
-
alignItems: 'center',
|
|
295
|
-
},
|
|
296
|
-
star: {
|
|
297
|
-
marginRight: 4,
|
|
298
|
-
},
|
|
299
|
-
});
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
### Custom Styled Container
|
|
303
|
-
|
|
304
|
-
```tsx
|
|
305
|
-
<StarRating
|
|
306
|
-
rating={rating}
|
|
307
|
-
onRatingChange={setRating}
|
|
308
|
-
style={{
|
|
309
|
-
backgroundColor: '#f5f5f5',
|
|
310
|
-
padding: 15,
|
|
311
|
-
borderRadius: 10,
|
|
312
|
-
}}
|
|
313
|
-
/>
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### With Background
|
|
317
|
-
|
|
318
|
-
```tsx
|
|
319
|
-
function RatingWithBackground() {
|
|
320
|
-
return (
|
|
321
|
-
<View style={styles.backgroundContainer}>
|
|
322
|
-
<StarRating
|
|
323
|
-
rating={rating}
|
|
324
|
-
onRatingChange={setRating}
|
|
325
|
-
size={48}
|
|
326
|
-
color="#FFFFFF"
|
|
327
|
-
/>
|
|
328
|
-
</View>
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
const styles = StyleSheet.create({
|
|
333
|
-
backgroundContainer: {
|
|
334
|
-
backgroundColor: '#2196F3',
|
|
335
|
-
padding: 20,
|
|
336
|
-
borderRadius: 15,
|
|
337
|
-
alignItems: 'center',
|
|
338
|
-
},
|
|
339
|
-
});
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
## Accessibility
|
|
343
|
-
|
|
344
|
-
### Accessibility Labels
|
|
345
|
-
|
|
346
|
-
```tsx
|
|
347
|
-
<StarRating
|
|
348
|
-
rating={rating}
|
|
349
|
-
onRatingChange={setRating}
|
|
350
|
-
accessible={true}
|
|
351
|
-
accessibilityLabel={`Rating: ${rating} out of 5 stars`}
|
|
352
|
-
accessibilityHint="Swipe up or down to change rating"
|
|
353
|
-
/>
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
### Accessibility Value
|
|
357
|
-
|
|
358
|
-
```tsx
|
|
359
|
-
<StarRating
|
|
360
|
-
rating={rating}
|
|
361
|
-
onRatingChange={setRating}
|
|
362
|
-
accessibilityValue={{
|
|
363
|
-
min: 0,
|
|
364
|
-
max: 5,
|
|
365
|
-
now: rating,
|
|
366
|
-
}}
|
|
367
|
-
/>
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
## Touch Handling
|
|
371
|
-
|
|
372
|
-
### Tap to Rate
|
|
373
|
-
|
|
374
|
-
```tsx
|
|
375
|
-
function TapToRate() {
|
|
376
|
-
return (
|
|
377
|
-
<StarRating
|
|
378
|
-
rating={rating}
|
|
379
|
-
onRatingChange={setRating}
|
|
380
|
-
maxStars={5}
|
|
381
|
-
/>
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
### Swipe to Rate
|
|
387
|
-
|
|
388
|
-
```tsx
|
|
389
|
-
function SwipeToRate() {
|
|
390
|
-
const handleSwipe = (gestureState) => {
|
|
391
|
-
const { dx } = gestureState;
|
|
392
|
-
const swipeDistance = Math.abs(dx);
|
|
393
|
-
|
|
394
|
-
if (swipeDistance > 50) {
|
|
395
|
-
const newRating = dx > 0 ? Math.min(5, rating + 1) : Math.max(0, rating - 1);
|
|
396
|
-
setRating(newRating);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
return (
|
|
401
|
-
<PanGestureRecognizer onHandlerStateChange={handleSwipe}>
|
|
402
|
-
<StarRating rating={rating} onRatingChange={setRating} />
|
|
403
|
-
</PanGestureRecognizer>
|
|
404
|
-
);
|
|
405
|
-
}
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
## Rating Statistics
|
|
409
|
-
|
|
410
|
-
### Rating Distribution
|
|
411
|
-
|
|
412
|
-
```tsx
|
|
413
|
-
function RatingDistribution({ ratings }) {
|
|
414
|
-
const distribution = useMemo(() => {
|
|
415
|
-
return [5, 4, 3, 2, 1].map(star => ({
|
|
416
|
-
star,
|
|
417
|
-
count: ratings.filter(r => r === star).length,
|
|
418
|
-
percentage: (ratings.filter(r => r === star).length / ratings.length) * 100,
|
|
419
|
-
}));
|
|
420
|
-
}, [ratings]);
|
|
421
|
-
|
|
422
|
-
return (
|
|
423
|
-
<View>
|
|
424
|
-
{distribution.map(({ star, count, percentage }) => (
|
|
425
|
-
<View key={star} style={styles.row}>
|
|
426
|
-
<Text>{star} ★</Text>
|
|
427
|
-
<View style={styles.bar}>
|
|
428
|
-
<View style={[styles.fill, { width: `${percentage}%` }]} />
|
|
429
|
-
</View>
|
|
430
|
-
<Text>{count}</Text>
|
|
431
|
-
</View>
|
|
432
|
-
))}
|
|
433
|
-
</View>
|
|
434
|
-
);
|
|
435
|
-
}
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
### Average Rating
|
|
439
|
-
|
|
440
|
-
```tsx
|
|
441
|
-
function AverageRating({ ratings }) {
|
|
442
|
-
const average = useMemo(() => {
|
|
443
|
-
if (ratings.length === 0) return 0;
|
|
444
|
-
const sum = ratings.reduce((acc, rating) => acc + rating, 0);
|
|
445
|
-
return sum / ratings.length;
|
|
446
|
-
}, [ratings]);
|
|
447
|
-
|
|
448
|
-
return (
|
|
449
|
-
<View>
|
|
450
|
-
<StarRating rating={Math.round(average)} readonly={true} />
|
|
451
|
-
<Text>{average.toFixed(1)} average</Text>
|
|
452
|
-
</View>
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
## Best Practices
|
|
458
|
-
|
|
459
|
-
1. **Clear Purpose**: Make the rating purpose clear
|
|
460
|
-
2. **Feedback**: Provide immediate visual feedback
|
|
461
|
-
3. **Labels**: Use labels when appropriate
|
|
462
|
-
4. **Read-Only**: Use readonly mode for display
|
|
463
|
-
5. **Accessibility**: Add proper accessibility labels
|
|
464
|
-
6. **Validation**: Validate rating before submission
|
|
465
|
-
7. **Animation**: Use smooth animations
|
|
466
|
-
|
|
467
|
-
## Related
|
|
468
|
-
|
|
469
|
-
- **Rating Domain**: Rating domain documentation
|
|
470
|
-
- **Feedback Form**: Feedback form component
|
|
471
|
-
- **useFeedbackForm**: Feedback form hook
|
|
472
|
-
|
|
473
|
-
## License
|
|
474
|
-
|
|
475
|
-
MIT
|
|
1
|
+
# StarRating Component
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Interactive star rating component with customizable appearance, behavior, and animations. Provides an intuitive, accessible way for users to rate items and display existing ratings with visual polish.
|
|
6
|
+
|
|
7
|
+
## File Paths
|
|
8
|
+
|
|
9
|
+
- **StarRating**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/rating/presentation/components/StarRating.tsx`
|
|
10
|
+
- **Rating Components**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/rating/presentation/components/`
|
|
11
|
+
- **Rating Screen**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/rating/presentation/screens/RatingScreen.tsx`
|
|
12
|
+
|
|
13
|
+
## Strategy
|
|
14
|
+
|
|
15
|
+
1. **Dual Mode Operation**: Supports both interactive rating input (writable) and read-only display modes, making it versatile for collecting and displaying ratings throughout the app.
|
|
16
|
+
|
|
17
|
+
2. **Accessibility Excellence**: Implements comprehensive accessibility features including labels, hints, and semantic values to ensure screen reader users can understand and interact with ratings.
|
|
18
|
+
|
|
19
|
+
3. **Visual Customization**: Provides extensive customization options for size, colors, spacing, and icons while maintaining consistent visual design through the design system.
|
|
20
|
+
|
|
21
|
+
4. **Smooth Animations**: Includes default animations for rating changes to provide delightful user feedback, with the option to disable animations for performance or preference.
|
|
22
|
+
|
|
23
|
+
5. **Flexible Icon System**: Supports custom icon types beyond stars (hearts, thumbs up, etc.) to adapt to different rating contexts and branding requirements.
|
|
24
|
+
|
|
25
|
+
## Restrictions
|
|
26
|
+
|
|
27
|
+
### ❌ DO NOT
|
|
28
|
+
|
|
29
|
+
- Use for non-rating purposes (likes, votes, etc.)
|
|
30
|
+
- Display fractional ratings without clear indication
|
|
31
|
+
- Mix different icon styles within the same rating context
|
|
32
|
+
- Override accessibility properties
|
|
33
|
+
- Use excessive star counts (keep under 10)
|
|
34
|
+
|
|
35
|
+
### ❌ NEVER
|
|
36
|
+
|
|
37
|
+
- Allow negative ratings or ratings exceeding maxStars
|
|
38
|
+
- Display invalid or undefined rating values
|
|
39
|
+
- Bypass readonly mode for display-only ratings
|
|
40
|
+
- Use without proper accessibility labels
|
|
41
|
+
- Create circular dependencies with form components
|
|
42
|
+
|
|
43
|
+
### ❌ AVOID
|
|
44
|
+
|
|
45
|
+
- Very small star sizes that are hard to tap (minimum 24px)
|
|
46
|
+
- Clashing color schemes that reduce accessibility
|
|
47
|
+
- Over-animated ratings that distract users
|
|
48
|
+
- Inconsistent rating scales across the app
|
|
49
|
+
- Confusing half-star implementations
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
### ✅ ALWAYS
|
|
54
|
+
|
|
55
|
+
- Use readonly mode for displaying existing ratings
|
|
56
|
+
- Provide clear accessibility labels describing the rating
|
|
57
|
+
- Ensure sufficient touch target size (minimum 44x44)
|
|
58
|
+
- Maintain consistent rating scale throughout the app
|
|
59
|
+
- Show rating values numerically alongside stars
|
|
60
|
+
|
|
61
|
+
### ✅ MUST
|
|
62
|
+
|
|
63
|
+
- Pass rating prop as a number between 0 and maxStars
|
|
64
|
+
- Include onRatingChange handler for interactive ratings
|
|
65
|
+
- Use appropriate colors that meet contrast standards
|
|
66
|
+
- Display rating text/labels for clarity
|
|
67
|
+
- Test both light and dark theme appearances
|
|
68
|
+
|
|
69
|
+
### ✅ SHOULD
|
|
70
|
+
|
|
71
|
+
- Use 5 stars as the default rating scale
|
|
72
|
+
- Include rating labels (Poor, Fair, Good, etc.) when appropriate
|
|
73
|
+
- Animate rating changes for better UX
|
|
74
|
+
- Show average ratings when displaying multiple ratings
|
|
75
|
+
- Collect ratings after meaningful interactions
|
|
76
|
+
- Consider implementing "tap to rate" hints for first-time users
|
|
77
|
+
|
|
78
|
+
## AI Agent Guidelines
|
|
79
|
+
|
|
80
|
+
1. **Rating Context**: Use StarRating immediately after meaningful interactions (feature usage, purchase completion, etc.) to capture fresh user feedback. Context-aware ratings are more accurate and valuable.
|
|
81
|
+
|
|
82
|
+
2. **Read-Only Display**: For displaying average ratings or review summaries, always use readonly mode. Combine the star display with numerical ratings (e.g., "4.5 out of 5") for clarity and accessibility.
|
|
83
|
+
|
|
84
|
+
3. **Interactive Collection**: When collecting new ratings, provide clear context about what is being rated. Include labels or hints explaining the rating scale. Consider showing rating descriptions (Poor to Excellent) that update dynamically as users select ratings.
|
|
85
|
+
|
|
86
|
+
4. **Visual Hierarchy**: Make the rating component prominent but not overwhelming. Use appropriate sizes (24-32px for inline, 40-48px for dedicated rating screens). Ensure star colors match the app's primary or accent color for consistency.
|
|
87
|
+
|
|
88
|
+
5. **Feedback Integration**: After rating collection, immediately acknowledge the submission. For low ratings (1-2 stars), consider following up with a feedback form to understand issues. For high ratings (4-5 stars), encourage reviews or referrals.
|
|
89
|
+
|
|
90
|
+
## Reference
|
|
91
|
+
|
|
92
|
+
- **Component Implementation**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/rating/presentation/components/StarRating.tsx`
|
|
93
|
+
- **Rating Screen**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/rating/presentation/screens/RatingScreen.tsx`
|
|
94
|
+
- **Rating Components**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/rating/presentation/components/`
|
|
95
|
+
- **Feedback Domain**: Combine with feedback components for comprehensive user input collection
|