@umituz/react-native-settings 3.0.0 → 4.0.0
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 +13 -13
- package/src/index.ts +10 -0
- package/src/presentation/components/CloudSyncSetting.tsx +2 -2
- package/src/presentation/components/StorageClearSetting.tsx +2 -2
- package/src/presentation/components/UserProfileHeader.tsx +3 -3
- package/src/presentation/navigation/SettingsStackNavigator.tsx +95 -0
- package/src/presentation/screens/components/AboutLegalSection.tsx +3 -3
- package/src/presentation/screens/components/AppearanceSection.tsx +2 -2
- package/src/presentation/screens/components/LanguageSection.tsx +2 -2
- package/src/presentation/screens/components/NotificationsSection.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Settings management for React Native apps - user preferences, theme, language, notifications",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"url": "https://github.com/umituz/react-native-settings"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@react-navigation/native": "
|
|
30
|
-
"@
|
|
31
|
-
"@umituz/react-native-
|
|
32
|
-
"@umituz/react-native-design-system
|
|
33
|
-
"@umituz/react-native-design-system-
|
|
34
|
-
"@umituz/react-native-design-system-
|
|
35
|
-
"@umituz/react-native-design-system-
|
|
36
|
-
"@umituz/react-native-design-system-
|
|
37
|
-
"@umituz/react-native-design-system-
|
|
38
|
-
"@umituz/react-native-
|
|
39
|
-
"@umituz/react-native-
|
|
29
|
+
"@react-navigation/native": ">=6.0.0",
|
|
30
|
+
"@react-navigation/stack": ">=6.0.0",
|
|
31
|
+
"@umituz/react-native-appearance": "*",
|
|
32
|
+
"@umituz/react-native-design-system": "*",
|
|
33
|
+
"@umituz/react-native-design-system-atoms": "*",
|
|
34
|
+
"@umituz/react-native-design-system-molecules": "*",
|
|
35
|
+
"@umituz/react-native-design-system-organisms": "*",
|
|
36
|
+
"@umituz/react-native-design-system-responsive": "*",
|
|
37
|
+
"@umituz/react-native-design-system-theme": "*",
|
|
38
|
+
"@umituz/react-native-design-system-typography": "*",
|
|
39
|
+
"@umituz/react-native-localization": "*",
|
|
40
|
+
"@umituz/react-native-storage": "*",
|
|
40
41
|
"@expo/vector-icons": ">=14.0.0",
|
|
41
|
-
"expo-linear-gradient": "^15.0.7",
|
|
42
42
|
"react": ">=18.2.0",
|
|
43
43
|
"react-native": ">=0.74.0",
|
|
44
44
|
"react-native-safe-area-context": "~5.6.0",
|
package/src/index.ts
CHANGED
|
@@ -36,6 +36,16 @@ export { SettingsScreen } from './presentation/screens/SettingsScreen';
|
|
|
36
36
|
export type { SettingsScreenProps } from './presentation/screens/SettingsScreen';
|
|
37
37
|
export { AppearanceScreen } from './presentation/screens/AppearanceScreen';
|
|
38
38
|
|
|
39
|
+
// =============================================================================
|
|
40
|
+
// PRESENTATION LAYER - Navigation
|
|
41
|
+
// =============================================================================
|
|
42
|
+
|
|
43
|
+
export { SettingsStackNavigator } from './presentation/navigation/SettingsStackNavigator';
|
|
44
|
+
export type {
|
|
45
|
+
SettingsStackNavigatorProps,
|
|
46
|
+
SettingsStackParamList
|
|
47
|
+
} from './presentation/navigation/SettingsStackNavigator';
|
|
48
|
+
|
|
39
49
|
// =============================================================================
|
|
40
50
|
// PRESENTATION LAYER - Types
|
|
41
51
|
// =============================================================================
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useCallback } from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { Feather } from "@expo/vector-icons";
|
|
8
8
|
import { SettingItem } from "./SettingItem";
|
|
9
9
|
import type { SettingItemProps } from "./SettingItem";
|
|
10
10
|
|
|
@@ -46,7 +46,7 @@ export const CloudSyncSetting: React.FC<CloudSyncSettingProps> = ({
|
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
48
|
<SettingItem
|
|
49
|
-
icon={
|
|
49
|
+
icon={(props) => <Feather name={"cloud" as any} {...props} />}
|
|
50
50
|
title={title || "cloud_sync"}
|
|
51
51
|
value={displayDescription}
|
|
52
52
|
onPress={onPress}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import React from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { Feather } from "@expo/vector-icons";
|
|
9
9
|
import { SettingItem } from "./SettingItem";
|
|
10
10
|
|
|
11
11
|
export interface StorageClearSettingProps {
|
|
@@ -37,7 +37,7 @@ export const StorageClearSetting: React.FC<StorageClearSettingProps> = ({
|
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<SettingItem
|
|
40
|
-
icon={
|
|
40
|
+
icon={(props) => <Feather name={"trash-2" as any} {...props} />}
|
|
41
41
|
title={defaultTitle}
|
|
42
42
|
value={defaultDescription}
|
|
43
43
|
onPress={onPress}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import React, { useState, useCallback } from "react";
|
|
8
8
|
import { View, TouchableOpacity, StyleSheet, Image } from "react-native";
|
|
9
|
-
import {
|
|
9
|
+
import { Feather } from "@expo/vector-icons";
|
|
10
10
|
import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
|
|
11
11
|
import { AtomicText } from "@umituz/react-native-design-system-atoms";
|
|
12
12
|
import { useNavigation } from "@react-navigation/native";
|
|
@@ -54,7 +54,7 @@ export const UserProfileHeader: React.FC<UserProfileHeaderProps> = ({
|
|
|
54
54
|
|
|
55
55
|
const finalDisplayName = displayName || (isGuest ? guestDisplayName || defaultGuestDisplayName || "Guest" : defaultUserDisplayName || "User");
|
|
56
56
|
const avatarName = isGuest ? guestDisplayName || defaultGuestDisplayName || defaultGuestDisplayName || "Guest" : finalDisplayName;
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
const defaultAvatarService = avatarServiceUrl || "https://ui-avatars.com/api";
|
|
59
59
|
const finalAvatarUrl =
|
|
60
60
|
(imageError ? null : avatarUrl) ||
|
|
@@ -115,7 +115,7 @@ export const UserProfileHeader: React.FC<UserProfileHeaderProps> = ({
|
|
|
115
115
|
</View>
|
|
116
116
|
{shouldShowChevron && (
|
|
117
117
|
<View style={[styles.chevronContainer, { marginLeft: spacing.sm }]}>
|
|
118
|
-
<
|
|
118
|
+
<Feather name="chevron-right" size={22} color={colors.textSecondary} />
|
|
119
119
|
</View>
|
|
120
120
|
)}
|
|
121
121
|
</>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings Stack Navigator
|
|
3
|
+
*
|
|
4
|
+
* Base stack navigator for settings screens
|
|
5
|
+
* Can be extended by apps to add custom screens
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { createStackNavigator } from "@react-navigation/stack";
|
|
10
|
+
import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
|
|
11
|
+
import { SettingsScreen } from "../screens/SettingsScreen";
|
|
12
|
+
import { AppearanceScreen } from "../screens/AppearanceScreen";
|
|
13
|
+
import type { SettingsConfig } from "../screens/types";
|
|
14
|
+
|
|
15
|
+
// Default param list - can be extended by apps
|
|
16
|
+
export type SettingsStackParamList = {
|
|
17
|
+
Settings: { config?: SettingsConfig };
|
|
18
|
+
Appearance: undefined;
|
|
19
|
+
// About and Legal screens will be handled by external packages
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface SettingsStackNavigatorProps {
|
|
23
|
+
/**
|
|
24
|
+
* Settings configuration
|
|
25
|
+
*/
|
|
26
|
+
config?: SettingsConfig;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Additional screens to register
|
|
30
|
+
* Apps can add their own screens here
|
|
31
|
+
*/
|
|
32
|
+
additionalScreens?: Array<{
|
|
33
|
+
name: string;
|
|
34
|
+
component: React.ComponentType<any>;
|
|
35
|
+
options?: any;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const Stack = createStackNavigator<SettingsStackParamList>();
|
|
40
|
+
|
|
41
|
+
export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
42
|
+
config = {},
|
|
43
|
+
additionalScreens = [],
|
|
44
|
+
}) => {
|
|
45
|
+
const tokens = useAppDesignTokens();
|
|
46
|
+
|
|
47
|
+
const screenOptions = {
|
|
48
|
+
headerStyle: {
|
|
49
|
+
backgroundColor: tokens.colors.surface,
|
|
50
|
+
borderBottomColor: tokens.colors.borderLight,
|
|
51
|
+
borderBottomWidth: 1,
|
|
52
|
+
},
|
|
53
|
+
headerTitleStyle: {
|
|
54
|
+
fontSize: 18,
|
|
55
|
+
fontWeight: "600" as const,
|
|
56
|
+
color: tokens.colors.textPrimary,
|
|
57
|
+
},
|
|
58
|
+
headerTintColor: tokens.colors.textPrimary,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Stack.Navigator screenOptions={screenOptions}>
|
|
63
|
+
<Stack.Screen
|
|
64
|
+
name="Settings"
|
|
65
|
+
options={{
|
|
66
|
+
headerShown: false,
|
|
67
|
+
title: "Settings",
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{() => <SettingsScreen config={config} />}
|
|
71
|
+
</Stack.Screen>
|
|
72
|
+
|
|
73
|
+
<Stack.Screen
|
|
74
|
+
name="Appearance"
|
|
75
|
+
component={AppearanceScreen}
|
|
76
|
+
options={{
|
|
77
|
+
headerShown: true,
|
|
78
|
+
headerTitle: "Appearance",
|
|
79
|
+
headerTitleAlign: "center",
|
|
80
|
+
headerBackTitle: "Settings",
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
{/* Render additional screens */}
|
|
85
|
+
{additionalScreens.map((screen) => (
|
|
86
|
+
<Stack.Screen
|
|
87
|
+
key={screen.name}
|
|
88
|
+
name={screen.name as any}
|
|
89
|
+
component={screen.component}
|
|
90
|
+
options={screen.options}
|
|
91
|
+
/>
|
|
92
|
+
))}
|
|
93
|
+
</Stack.Navigator>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { Feather } from "@expo/vector-icons";
|
|
8
8
|
import { useNavigation } from "@react-navigation/native";
|
|
9
9
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
10
10
|
import type { NavigationProp } from "@react-navigation/native";
|
|
@@ -54,7 +54,7 @@ export const AboutLegalSection: React.FC<AboutLegalSectionProps> = ({
|
|
|
54
54
|
<SettingsSection title={t("settings.sections.about")}>
|
|
55
55
|
{showAbout && (
|
|
56
56
|
<SettingItem
|
|
57
|
-
icon={
|
|
57
|
+
icon={(props) => <Feather name={"info" as any} {...props} />}
|
|
58
58
|
title={aboutTitle}
|
|
59
59
|
value={aboutDescription}
|
|
60
60
|
onPress={() => navigation.navigate(aboutRoute as string)}
|
|
@@ -62,7 +62,7 @@ export const AboutLegalSection: React.FC<AboutLegalSectionProps> = ({
|
|
|
62
62
|
)}
|
|
63
63
|
{showLegal && (
|
|
64
64
|
<SettingItem
|
|
65
|
-
icon={
|
|
65
|
+
icon={(props) => <Feather name={"file-text" as any} {...props} />}
|
|
66
66
|
title={legalTitle}
|
|
67
67
|
value={legalDescription}
|
|
68
68
|
onPress={() => navigation.navigate(legalRoute as string)}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { Feather } from "@expo/vector-icons";
|
|
8
8
|
import { useNavigation } from "@react-navigation/native";
|
|
9
9
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
10
10
|
import { SettingItem } from "../../components/SettingItem";
|
|
@@ -28,7 +28,7 @@ export const AppearanceSection: React.FC<AppearanceSectionProps> = ({
|
|
|
28
28
|
return (
|
|
29
29
|
<SettingsSection title={t("settings.sections.app.title")}>
|
|
30
30
|
<SettingItem
|
|
31
|
-
icon={
|
|
31
|
+
icon={(props) => <Feather name={"droplet" as any} {...props} />}
|
|
32
32
|
title={title}
|
|
33
33
|
value={description}
|
|
34
34
|
onPress={() => navigation.navigate(route as never)}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { Feather } from "@expo/vector-icons";
|
|
8
8
|
import { useNavigation } from "@react-navigation/native";
|
|
9
9
|
import { useLocalization, getLanguageByCode } from "@umituz/react-native-localization";
|
|
10
10
|
import { SettingItem } from "../../components/SettingItem";
|
|
@@ -34,7 +34,7 @@ export const LanguageSection: React.FC<LanguageSectionProps> = ({
|
|
|
34
34
|
return (
|
|
35
35
|
<SettingsSection title={t("settings.sections.app.title")}>
|
|
36
36
|
<SettingItem
|
|
37
|
-
icon={
|
|
37
|
+
icon={(props) => <Feather name={"globe" as any} {...props} />}
|
|
38
38
|
title={title}
|
|
39
39
|
value={languageDisplay}
|
|
40
40
|
onPress={() => navigation.navigate(route as never)}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useState, useEffect, useCallback } from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { Feather } from "@expo/vector-icons";
|
|
8
8
|
import { useNavigation } from "@react-navigation/native";
|
|
9
9
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
10
10
|
import { SettingItem } from "../../components/SettingItem";
|
|
@@ -75,7 +75,7 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
75
75
|
<SettingsSection title={t("settings.sections.general")}>
|
|
76
76
|
{showToggle ? (
|
|
77
77
|
<SettingItem
|
|
78
|
-
icon={
|
|
78
|
+
icon={(props) => <Feather name={"bell" as any} {...props} />}
|
|
79
79
|
title={title}
|
|
80
80
|
showSwitch={true}
|
|
81
81
|
switchValue={notificationsEnabled}
|
|
@@ -84,7 +84,7 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
84
84
|
/>
|
|
85
85
|
) : (
|
|
86
86
|
<SettingItem
|
|
87
|
-
icon={
|
|
87
|
+
icon={(props) => <Feather name={"bell" as any} {...props} />}
|
|
88
88
|
title={title}
|
|
89
89
|
value={description}
|
|
90
90
|
onPress={handlePress}
|