@umituz/react-native-settings 4.20.55 → 4.20.57
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/README.md +145 -3
- package/package.json +1 -2
- package/src/application/README.md +322 -0
- package/src/domains/about/README.md +452 -0
- package/src/domains/about/presentation/hooks/README.md +350 -0
- package/src/domains/appearance/README.md +596 -0
- package/src/domains/appearance/hooks/README.md +366 -0
- package/src/domains/appearance/infrastructure/services/README.md +455 -0
- package/src/domains/cloud-sync/README.md +451 -0
- package/src/domains/cloud-sync/presentation/components/README.md +493 -0
- package/src/domains/dev/README.md +477 -0
- package/src/domains/disclaimer/README.md +421 -0
- package/src/domains/disclaimer/presentation/components/README.md +394 -0
- package/src/domains/faqs/README.md +586 -0
- package/src/domains/feedback/README.md +565 -0
- package/src/domains/feedback/presentation/hooks/README.md +428 -0
- package/src/domains/legal/README.md +549 -0
- package/src/domains/rating/README.md +452 -0
- package/src/domains/rating/presentation/components/README.md +475 -0
- package/src/domains/video-tutorials/README.md +482 -0
- package/src/domains/video-tutorials/presentation/components/README.md +433 -0
- package/src/infrastructure/README.md +509 -0
- package/src/infrastructure/repositories/README.md +475 -0
- package/src/infrastructure/services/README.md +510 -0
- package/src/presentation/components/README.md +482 -0
- package/src/presentation/components/SettingsErrorBoundary/README.md +461 -0
- package/src/presentation/components/SettingsFooter/README.md +446 -0
- package/src/presentation/components/SettingsItemCard/README.md +457 -0
- package/src/presentation/components/SettingsSection/README.md +421 -0
- package/src/presentation/hooks/README.md +413 -0
- package/src/presentation/hooks/mutations/README.md +430 -0
- package/src/presentation/hooks/queries/README.md +441 -0
- package/src/presentation/navigation/README.md +532 -0
- package/src/presentation/navigation/components/README.md +330 -0
- package/src/presentation/navigation/hooks/README.md +399 -0
- package/src/presentation/navigation/utils/README.md +442 -0
- package/src/presentation/screens/README.md +525 -0
- package/src/presentation/screens/components/SettingsContent/README.md +404 -0
- package/src/presentation/screens/components/SettingsHeader/README.md +322 -0
- package/src/presentation/screens/components/sections/CustomSettingsList/README.md +388 -0
- package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +232 -0
- package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +325 -0
- package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +480 -0
- package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +391 -0
- package/src/presentation/screens/hooks/README.md +383 -0
- package/src/presentation/screens/types/README.md +439 -0
- package/src/presentation/screens/utils/README.md +288 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
# StarRating
|
|
2
|
+
|
|
3
|
+
Interactive star rating component with customizable appearance, behavior, and animations.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Interactive**: Tap to rate with visual feedback
|
|
8
|
+
- **Read-Only**: Display existing ratings without interaction
|
|
9
|
+
- **Customizable**: Size, colors, spacing, and star count
|
|
10
|
+
- **Animated**: Smooth animations on rating changes
|
|
11
|
+
- **Accessible**: Full accessibility support
|
|
12
|
+
- **Flexible**: Supports different icon styles
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
This component is part of `@umituz/react-native-settings`.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Basic Interactive Rating
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { StarRating } from '@umituz/react-native-settings';
|
|
24
|
+
|
|
25
|
+
function RatingScreen() {
|
|
26
|
+
const [rating, setRating] = useState(0);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<StarRating
|
|
30
|
+
rating={rating}
|
|
31
|
+
onRatingChange={setRating}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Read-Only Display
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
function RatingDisplay({ rating }) {
|
|
41
|
+
return (
|
|
42
|
+
<StarRating
|
|
43
|
+
rating={4}
|
|
44
|
+
readonly={true}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Custom Size
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
function LargeRating() {
|
|
54
|
+
return (
|
|
55
|
+
<StarRating
|
|
56
|
+
rating={5}
|
|
57
|
+
size={40}
|
|
58
|
+
onRatingChange={setRating}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Custom Colors
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
function CustomColoredRating() {
|
|
68
|
+
return (
|
|
69
|
+
<StarRating
|
|
70
|
+
rating={3}
|
|
71
|
+
color="#FF5722"
|
|
72
|
+
emptyColor="#E0E0E0"
|
|
73
|
+
onRatingChange={setRating}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Props
|
|
80
|
+
|
|
81
|
+
### StarRatingProps
|
|
82
|
+
|
|
83
|
+
| Prop | Type | Default | Description |
|
|
84
|
+
|------|------|---------|-------------|
|
|
85
|
+
| `rating` | `number` | **Required** | Current rating value (0 to maxStars) |
|
|
86
|
+
| `onRatingChange` | `(rating: number) => void` | `undefined` | Rating change handler |
|
|
87
|
+
| `maxStars` | `number` | `5` | Maximum number of stars |
|
|
88
|
+
| `size` | `number` | `24` | Star size in pixels |
|
|
89
|
+
| `color` | `string` | `#FFC107` | Filled star color |
|
|
90
|
+
| `emptyColor` | `string` | `#E0E0E0` | Empty star color |
|
|
91
|
+
| `spacing` | `number` | `4` | Spacing between stars |
|
|
92
|
+
| `readonly` | `boolean` | `false` | Disable interaction |
|
|
93
|
+
| `disabled` | `boolean` | `false` | Disabled state |
|
|
94
|
+
| `animate` | `boolean` | `true` | Enable animations |
|
|
95
|
+
| `icon` | `IconName` | `'star'` | Custom icon name |
|
|
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
|