@umituz/react-native-settings 4.20.43 → 4.20.46
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
CHANGED
|
@@ -20,7 +20,7 @@ npm install @umituz/react-native-settings
|
|
|
20
20
|
## Peer Dependencies
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npm install zustand
|
|
23
|
+
npm install zustand @umituz/react-native-storage @umituz/react-native-design-system @umituz/react-native-localization @react-navigation/native @react-navigation/stack react-native-safe-area-context expo-linear-gradient
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
@@ -43,8 +43,8 @@ const MyComponent = () => {
|
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<View>
|
|
46
|
-
<
|
|
47
|
-
<
|
|
46
|
+
<AtomicText>Current Theme: {settings?.theme}</AtomicText>
|
|
47
|
+
<AtomicButton onPress={handleThemeChange}>Toggle Theme</AtomicButton>
|
|
48
48
|
</View>
|
|
49
49
|
);
|
|
50
50
|
};
|
|
@@ -55,98 +55,51 @@ const MyComponent = () => {
|
|
|
55
55
|
```tsx
|
|
56
56
|
import { SettingsScreen } from '@umituz/react-native-settings';
|
|
57
57
|
|
|
58
|
-
// Basic usage
|
|
58
|
+
// Basic usage in navigation
|
|
59
59
|
<Stack.Screen name="Settings" component={SettingsScreen} />
|
|
60
|
-
|
|
61
|
-
// With user profile header
|
|
62
|
-
<SettingsScreen
|
|
63
|
-
showUserProfile={true}
|
|
64
|
-
userProfile={{
|
|
65
|
-
displayName: "John Doe",
|
|
66
|
-
userId: "user123",
|
|
67
|
-
isGuest: false,
|
|
68
|
-
accountSettingsRoute: "AccountSettings",
|
|
69
|
-
}}
|
|
70
|
-
config={{
|
|
71
|
-
appearance: true,
|
|
72
|
-
notifications: true,
|
|
73
|
-
about: true,
|
|
74
|
-
legal: true,
|
|
75
|
-
}}
|
|
76
|
-
/>
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Appearance Screen
|
|
80
|
-
|
|
81
|
-
```tsx
|
|
82
|
-
import { AppearanceScreen } from '@umituz/react-native-settings';
|
|
83
|
-
|
|
84
|
-
// In your navigation stack
|
|
85
|
-
<Stack.Screen name="Appearance" component={AppearanceScreen} />
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Language Selection Screen
|
|
89
|
-
|
|
90
|
-
```tsx
|
|
91
|
-
import { LanguageSelectionScreen } from '@umituz/react-native-settings';
|
|
92
|
-
|
|
93
|
-
// In your navigation stack
|
|
94
|
-
<Stack.Screen name="LanguageSelection" component={LanguageSelectionScreen} />
|
|
95
60
|
```
|
|
96
61
|
|
|
97
|
-
###
|
|
62
|
+
### Settings Item Card
|
|
98
63
|
|
|
99
64
|
```tsx
|
|
100
|
-
import {
|
|
101
|
-
import { Palette, Bell } from 'lucide-react-native';
|
|
65
|
+
import { SettingsItemCard } from '@umituz/react-native-settings';
|
|
102
66
|
|
|
103
67
|
// Basic setting item
|
|
104
|
-
<
|
|
105
|
-
icon=
|
|
68
|
+
<SettingsItemCard
|
|
69
|
+
icon="brush-outline"
|
|
106
70
|
title="Appearance"
|
|
107
|
-
|
|
71
|
+
description="Theme and language settings"
|
|
108
72
|
onPress={() => navigation.navigate('Appearance')}
|
|
109
73
|
/>
|
|
110
74
|
|
|
111
75
|
// With switch
|
|
112
|
-
<
|
|
113
|
-
icon=
|
|
76
|
+
<SettingsItemCard
|
|
77
|
+
icon="notifications-outline"
|
|
114
78
|
title="Notifications"
|
|
115
79
|
showSwitch={true}
|
|
116
80
|
switchValue={enabled}
|
|
117
81
|
onSwitchChange={setEnabled}
|
|
118
82
|
/>
|
|
119
|
-
|
|
120
|
-
// Custom colors
|
|
121
|
-
<SettingItem
|
|
122
|
-
icon={Palette}
|
|
123
|
-
title="Appearance"
|
|
124
|
-
iconColor="#F59E0B"
|
|
125
|
-
titleColor="#F59E0B"
|
|
126
|
-
onPress={() => {}}
|
|
127
|
-
/>
|
|
128
83
|
```
|
|
129
84
|
|
|
130
|
-
### Settings Section
|
|
85
|
+
### Settings Section
|
|
131
86
|
|
|
132
87
|
```tsx
|
|
133
|
-
import { SettingsSection,
|
|
134
|
-
import { Palette, Bell } from 'lucide-react-native';
|
|
88
|
+
import { SettingsSection, SettingsItemCard } from '@umituz/react-native-settings';
|
|
135
89
|
|
|
136
90
|
<SettingsSection title="APP SETTINGS">
|
|
137
|
-
<
|
|
138
|
-
icon=
|
|
91
|
+
<SettingsItemCard
|
|
92
|
+
icon="brush-outline"
|
|
139
93
|
title="Appearance"
|
|
140
|
-
|
|
94
|
+
description="Theme and language settings"
|
|
141
95
|
onPress={() => navigation.navigate('Appearance')}
|
|
142
96
|
/>
|
|
143
|
-
<
|
|
144
|
-
icon=
|
|
97
|
+
<SettingsItemCard
|
|
98
|
+
icon="notifications-outline"
|
|
145
99
|
title="Notifications"
|
|
146
100
|
showSwitch={true}
|
|
147
101
|
switchValue={enabled}
|
|
148
102
|
onSwitchChange={setEnabled}
|
|
149
|
-
isLast={true}
|
|
150
103
|
/>
|
|
151
104
|
</SettingsSection>
|
|
152
105
|
```
|
|
@@ -264,21 +217,22 @@ Appearance settings screen with language and theme controls.
|
|
|
264
217
|
|
|
265
218
|
Language selection screen with search functionality.
|
|
266
219
|
|
|
267
|
-
### `
|
|
220
|
+
### `SettingsItemCard`
|
|
268
221
|
|
|
269
|
-
Modern
|
|
222
|
+
Modern settings item component with Ionicons support and switch support.
|
|
270
223
|
|
|
271
224
|
**Props:**
|
|
272
|
-
- `icon:
|
|
225
|
+
- `icon: IconName` - Icon name from Ionicons
|
|
273
226
|
- `title: string` - Main title text
|
|
274
|
-
- `
|
|
227
|
+
- `description?: string` - Optional description/value text (shown below title)
|
|
275
228
|
- `onPress?: () => void` - Callback when pressed
|
|
276
229
|
- `showSwitch?: boolean` - Show switch instead of chevron
|
|
277
230
|
- `switchValue?: boolean` - Switch value
|
|
278
231
|
- `onSwitchChange?: (value: boolean) => void` - Switch change handler
|
|
279
|
-
- `isLast?: boolean` - Is last item (no divider)
|
|
280
232
|
- `iconColor?: string` - Custom icon color
|
|
281
|
-
- `
|
|
233
|
+
- `iconBgColor?: string` - Custom icon background color
|
|
234
|
+
- `rightIcon?: IconName` - Custom right icon (defaults to chevron-forward)
|
|
235
|
+
- `disabled?: boolean` - Disable the item
|
|
282
236
|
|
|
283
237
|
### `SettingsSection`
|
|
284
238
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.20.
|
|
3
|
+
"version": "4.20.46",
|
|
4
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",
|
|
@@ -68,34 +68,33 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
|
68
68
|
return Wrapper;
|
|
69
69
|
}, [config, appInfo.version, showUserProfile, userProfile, devSettings, customSections]);
|
|
70
70
|
|
|
71
|
-
const
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
}, [t]);
|
|
71
|
+
const notificationTranslations = useMemo(
|
|
72
|
+
() => ({
|
|
73
|
+
screenTitle: t("settings.notifications.title"),
|
|
74
|
+
masterToggleTitle: t("settings.notifications.masterToggleTitle"),
|
|
75
|
+
masterToggleDescription: t("settings.notifications.masterToggleDescription"),
|
|
76
|
+
soundTitle: t("settings.notifications.soundTitle"),
|
|
77
|
+
soundDescription: t("settings.notifications.soundDescription"),
|
|
78
|
+
vibrationTitle: t("settings.notifications.vibrationTitle"),
|
|
79
|
+
vibrationDescription: t("settings.notifications.vibrationDescription"),
|
|
80
|
+
remindersTitle: t("settings.notifications.remindersTitle"),
|
|
81
|
+
remindersDescription: t("settings.notifications.remindersDescription"),
|
|
82
|
+
quietHoursTitle: t("settings.notifications.quietHoursTitle"),
|
|
83
|
+
quietHoursDescription: t("settings.notifications.quietHoursDescription"),
|
|
84
|
+
}),
|
|
85
|
+
[t]
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const quietHoursTranslations = useMemo(
|
|
89
|
+
() => ({
|
|
90
|
+
title: t("settings.notifications.quietHours.title"),
|
|
91
|
+
description: t("settings.notifications.quietHours.description"),
|
|
92
|
+
startTimeLabel: t("settings.notifications.quietHours.startTimeLabel"),
|
|
93
|
+
endTimeLabel: t("settings.notifications.quietHours.endTimeLabel"),
|
|
94
|
+
enabledLabel: t("settings.notifications.quietHours.enabledLabel"),
|
|
95
|
+
}),
|
|
96
|
+
[t]
|
|
97
|
+
);
|
|
99
98
|
|
|
100
99
|
const LegalScreenWrapper = useMemo(() => {
|
|
101
100
|
const Wrapper = () => (
|
|
@@ -164,13 +163,19 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
|
164
163
|
|
|
165
164
|
<Stack.Screen
|
|
166
165
|
name="Notifications"
|
|
167
|
-
component={NotificationSettingsWrapper}
|
|
168
166
|
options={{
|
|
169
167
|
headerShown: true,
|
|
170
168
|
headerTitle: t("settings.notifications.title"),
|
|
171
169
|
headerTitleAlign: "center",
|
|
172
170
|
}}
|
|
173
|
-
|
|
171
|
+
>
|
|
172
|
+
{() => (
|
|
173
|
+
<NotificationSettingsScreen
|
|
174
|
+
translations={notificationTranslations}
|
|
175
|
+
quietHoursTranslations={quietHoursTranslations}
|
|
176
|
+
/>
|
|
177
|
+
)}
|
|
178
|
+
</Stack.Screen>
|
|
174
179
|
|
|
175
180
|
{faqData && faqData.categories.length > 0 && (
|
|
176
181
|
<Stack.Screen
|