@umituz/react-native-settings 4.21.17 → 4.21.19

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-settings",
3
- "version": "4.21.17",
3
+ "version": "4.21.19",
4
4
  "description": "Complete settings hub for React Native apps - consolidated package with settings, about, legal, appearance, feedback, FAQs, rating, and gamification",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -6,7 +6,13 @@
6
6
  */
7
7
 
8
8
  import React, { useMemo, useCallback } from "react";
9
- import { ScreenLayout, useAppDesignTokens } from "@umituz/react-native-design-system";
9
+ // @ts-ignore - Optional peer dependency
10
+ import { useNavigation } from "@react-navigation/native";
11
+ import {
12
+ ScreenLayout,
13
+ useAppDesignTokens,
14
+ NavigationHeader
15
+ } from "@umituz/react-native-design-system";
10
16
  import { useLocalization } from "@umituz/react-native-localization";
11
17
  import { useAppearance, useAppearanceActions } from "../../hooks";
12
18
  import {
@@ -33,6 +39,7 @@ export const AppearanceScreen: React.FC<AppearanceScreenProps> = ({
33
39
  showColorsSection = true,
34
40
  showPreviewSection = true,
35
41
  }) => {
42
+ const navigation = useNavigation();
36
43
  const tokens = useAppDesignTokens();
37
44
  const { t } = useLocalization();
38
45
  const { themeMode } = useAppearance();
@@ -152,7 +159,15 @@ export const AppearanceScreen: React.FC<AppearanceScreenProps> = ({
152
159
  ]);
153
160
 
154
161
  return (
155
- <ScreenLayout hideScrollIndicator>
162
+ <ScreenLayout
163
+ hideScrollIndicator
164
+ header={
165
+ <NavigationHeader
166
+ title={t("settings.appearance.title")}
167
+ onBackPress={() => navigation.goBack()}
168
+ />
169
+ }
170
+ >
156
171
  {headerComponentMemo}
157
172
  {themeSectionMemo}
158
173
  {colorsSectionMemo}
@@ -5,7 +5,16 @@
5
5
 
6
6
  import React from 'react';
7
7
  import { View } from 'react-native';
8
- import { AtomicCard, ScreenLayout, AtomicSpinner } from '@umituz/react-native-design-system';
8
+ // @ts-ignore - Optional peer dependency
9
+ import { useNavigation } from '@react-navigation/native';
10
+ import {
11
+ AtomicCard,
12
+ ScreenLayout,
13
+ AtomicSpinner,
14
+ NavigationHeader,
15
+ useAppDesignTokens
16
+ } from '@umituz/react-native-design-system';
17
+ import { useLocalization } from '@umituz/react-native-localization';
9
18
  import { QuietHoursCard } from '../../quietHours/presentation/components/QuietHoursCard';
10
19
  import { SettingRow } from '../components/SettingRow';
11
20
  import { RemindersNavRow } from '../components/RemindersNavRow';
@@ -15,7 +24,6 @@ import { useReminders } from '../../reminders/infrastructure/storage/RemindersSt
15
24
  import { useQuietHoursActions } from '../../quietHours/infrastructure/hooks/useQuietHoursActions';
16
25
  import type { NotificationSettingsTranslations, QuietHoursTranslations } from '../../infrastructure/services/types';
17
26
  import { createStyles } from './NotificationSettingsScreen.styles';
18
- import { useAppDesignTokens } from '@umituz/react-native-design-system';
19
27
  // @ts-ignore - Optional peer dependency
20
28
  import DateTimePicker from '@react-native-community/datetimepicker';
21
29
 
@@ -30,7 +38,9 @@ export const NotificationSettingsScreen: React.FC<NotificationSettingsScreenProp
30
38
  quietHoursTranslations,
31
39
  onHapticFeedback,
32
40
  }) => {
41
+ const navigation = useNavigation();
33
42
  const tokens = useAppDesignTokens();
43
+ const { t } = useLocalization();
34
44
  const styles = createStyles(tokens);
35
45
  const reminders = useReminders();
36
46
  const { setStartTime, setEndTime } = useQuietHoursActions();
@@ -55,16 +65,33 @@ export const NotificationSettingsScreen: React.FC<NotificationSettingsScreenProp
55
65
  // Navigate to reminders screen when implemented
56
66
  };
57
67
 
68
+ const headerTitle = translations.screenTitle || t("settings.notifications.title");
69
+
58
70
  if (isLoading) {
59
71
  return (
60
- <ScreenLayout>
72
+ <ScreenLayout
73
+ header={
74
+ <NavigationHeader
75
+ title={headerTitle}
76
+ onBackPress={() => navigation.goBack()}
77
+ />
78
+ }
79
+ >
61
80
  <AtomicSpinner size="lg" color="primary" fullContainer />
62
81
  </ScreenLayout>
63
82
  );
64
83
  }
65
84
 
66
85
  return (
67
- <ScreenLayout hideScrollIndicator>
86
+ <ScreenLayout
87
+ hideScrollIndicator
88
+ header={
89
+ <NavigationHeader
90
+ title={headerTitle}
91
+ onBackPress={() => navigation.goBack()}
92
+ />
93
+ }
94
+ >
68
95
  <View style={styles.container}>
69
96
  <AtomicCard style={styles.card}>
70
97
  <SettingRow
@@ -99,7 +99,7 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
99
99
  <Stack.Screen
100
100
  name="Appearance"
101
101
  component={AppearanceScreen}
102
- options={{ headerTitle: t("settings.appearance.title") }}
102
+ options={{ headerShown: false }}
103
103
  />
104
104
 
105
105
  <Stack.Screen name="About" options={{ headerTitle: t("settings.about.title") }}>
@@ -112,7 +112,7 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
112
112
 
113
113
  <Stack.Screen
114
114
  name="Notifications"
115
- options={{ headerTitle: t("settings.notifications.title") }}
115
+ options={{ headerShown: false }}
116
116
  >
117
117
  {() => (
118
118
  <NotificationSettingsScreen
@@ -166,10 +166,11 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
166
166
 
167
167
  <Stack.Screen
168
168
  name="LanguageSelection"
169
- options={{ headerTitle: t("settings.language.title") }}
169
+ options={{ headerShown: false }}
170
170
  >
171
171
  {() => (
172
172
  <LanguageSelectionScreen
173
+ headerTitle={t("settings.language.title")}
173
174
  searchPlaceholder={t("settings.languageSelection.searchPlaceholder")}
174
175
  />
175
176
  )}
@@ -51,6 +51,8 @@ export interface SettingsScreenProps {
51
51
  };
52
52
  /** Dev settings (only shown in __DEV__ mode) */
53
53
  devSettings?: DevSettingsProps;
54
+ /** Gamification configuration */
55
+ gamificationConfig?: import("../../domains/gamification").GamificationSettingsConfig;
54
56
  /** Show header (default: true) */
55
57
  showHeader?: boolean;
56
58
  }
@@ -68,6 +70,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
68
70
  onClose,
69
71
  featureOptions,
70
72
  devSettings,
73
+ gamificationConfig,
71
74
  }) => {
72
75
  const navigation = useNavigation();
73
76
  const tokens = useAppDesignTokens();
@@ -94,6 +97,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
94
97
  customSections={customSections}
95
98
  showCloseButton={showCloseButton}
96
99
  devSettings={devSettings}
100
+ gamificationConfig={gamificationConfig}
97
101
  />
98
102
  </SettingsErrorBoundary>
99
103
  </ScreenLayout>
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ // @ts-ignore - Optional peer dependency
3
+ import { useNavigation } from "@react-navigation/native";
4
+ import { SettingsItemCard } from "../../components/SettingsItemCard";
5
+ import type { IconName } from "@umituz/react-native-design-system";
6
+ import { useGamification } from "../../../domains/gamification";
7
+
8
+ export interface GamificationSettingsItemProps {
9
+ config: any;
10
+ gamificationConfig?: any;
11
+ t: (key: string) => string;
12
+ }
13
+
14
+ export const GamificationSettingsItem: React.FC<GamificationSettingsItemProps> = ({
15
+ config,
16
+ gamificationConfig,
17
+ t
18
+ }) => {
19
+ const navigation = useNavigation();
20
+ const { level } = useGamification(gamificationConfig);
21
+
22
+ const handlePress = () => {
23
+ if (config.route) {
24
+ navigation.navigate(config.route as never);
25
+ } else {
26
+ navigation.navigate("Gamification" as never);
27
+ }
28
+ };
29
+
30
+ const icon = (config.icon || "trophy-outline") as IconName;
31
+ const title = config.title || t("settings.gamification.title");
32
+
33
+ // Dynamic description showing current level and points
34
+ const description = config.description ||
35
+ t("settings.gamification.description")
36
+ .replace("{level}", level.currentLevel.toString())
37
+ .replace("{points}", level.currentPoints.toString());
38
+
39
+ return (
40
+ <SettingsItemCard
41
+ title={title}
42
+ description={description}
43
+ icon={icon}
44
+ onPress={handlePress}
45
+ sectionTitle={config.sectionTitle}
46
+ />
47
+ );
48
+ };
@@ -1,6 +1,5 @@
1
1
  import React, { useMemo } from "react";
2
2
  import { View, StyleSheet } from "react-native";
3
- import { useNavigation } from "@react-navigation/native";
4
3
  import { useLocalization } from "@umituz/react-native-localization";
5
4
  import { SettingsFooter } from "../../components/SettingsFooter";
6
5
  import { SettingsSection } from "../../components/SettingsSection";
@@ -10,49 +9,14 @@ import { ProfileSectionLoader } from "./sections/ProfileSectionLoader";
10
9
  import { FeatureSettingsSection } from "./sections/FeatureSettingsSection";
11
10
  import { IdentitySettingsSection } from "./sections/IdentitySettingsSection";
12
11
  import { SupportSettingsSection } from "./sections/SupportSettingsSection";
13
- import { SettingsItemCard } from "../../components/SettingsItemCard";
14
- import type { IconName } from "@umituz/react-native-design-system";
15
12
  import { CustomSettingsList } from "./sections/CustomSettingsList";
16
13
  import type { NormalizedConfig } from "../utils/normalizeConfig";
17
- import type { CustomSettingsSection, WalletConfig } from "../types";
18
-
19
- const WalletSettingsItem: React.FC<{ config: WalletConfig; t: (key: string) => string }> = ({ config, t }) => {
20
- const navigation = useNavigation();
21
- const handlePress = () => {
22
- if (config.route) {
23
- navigation.navigate(config.route as never);
24
- }
25
- };
26
- return (
27
- <SettingsItemCard
28
- title={config.title || t("wallet.title")}
29
- description={config.description || t("wallet.description")}
30
- icon={(config.icon || "wallet") as IconName}
31
- onPress={handlePress}
32
- sectionTitle={config.sectionTitle}
33
- />
34
- );
35
- };
14
+ import type { CustomSettingsSection } from "../types";
36
15
 
37
- const SubscriptionSettingsItem: React.FC<{ config: any; t: (key: string) => string }> = ({ config, t }) => {
38
- const navigation = useNavigation();
39
- const handlePress = () => {
40
- if (config.route) {
41
- navigation.navigate(config.route as never);
42
- } else if (config.onPress) {
43
- config.onPress();
44
- }
45
- };
46
- return (
47
- <SettingsItemCard
48
- title={config.title || t("settings.subscription.title")}
49
- description={config.description || t("settings.subscription.description")}
50
- icon={(config.icon || "star") as IconName}
51
- onPress={handlePress}
52
- sectionTitle={config.sectionTitle}
53
- />
54
- );
55
- };
16
+ // Extracted Item Components
17
+ import { SubscriptionSettingsItem } from "./SubscriptionSettingsItem";
18
+ import { WalletSettingsItem } from "./WalletSettingsItem";
19
+ import { GamificationSettingsItem } from "./GamificationSettingsItem";
56
20
 
57
21
  interface SettingsContentProps {
58
22
  normalizedConfig: NormalizedConfig;
@@ -70,6 +34,7 @@ interface SettingsContentProps {
70
34
  faqs: boolean;
71
35
  subscription: boolean;
72
36
  wallet: boolean;
37
+ gamification: boolean;
73
38
  };
74
39
  showUserProfile?: boolean;
75
40
  userProfile?: any;
@@ -79,6 +44,7 @@ interface SettingsContentProps {
79
44
  customSections?: CustomSettingsSection[];
80
45
  showCloseButton?: boolean;
81
46
  devSettings?: DevSettingsProps;
47
+ gamificationConfig?: import("../../../domains/gamification").GamificationSettingsConfig;
82
48
  }
83
49
 
84
50
  export const SettingsContent: React.FC<SettingsContentProps> = ({
@@ -93,6 +59,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
93
59
  customSections = [],
94
60
  showCloseButton = false,
95
61
  devSettings,
62
+ gamificationConfig,
96
63
  }) => {
97
64
  const { t } = useLocalization();
98
65
 
@@ -108,6 +75,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
108
75
  features.faqs ||
109
76
  features.subscription ||
110
77
  features.wallet ||
78
+ features.gamification ||
111
79
  customSections.length > 0,
112
80
  [features, customSections.length]
113
81
  );
@@ -129,6 +97,14 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
129
97
  />
130
98
  )}
131
99
 
100
+ {features.gamification && (
101
+ <GamificationSettingsItem
102
+ config={normalizedConfig.gamification.config || {}}
103
+ gamificationConfig={gamificationConfig}
104
+ t={t}
105
+ />
106
+ )}
107
+
132
108
  <FeatureSettingsSection normalizedConfig={normalizedConfig} features={features} />
133
109
 
134
110
  <IdentitySettingsSection normalizedConfig={normalizedConfig} features={features} />
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ // @ts-ignore - Optional peer dependency
3
+ import { useNavigation } from "@react-navigation/native";
4
+ import { SettingsItemCard } from "../../components/SettingsItemCard";
5
+ import type { IconName } from "@umituz/react-native-design-system";
6
+
7
+ export interface SubscriptionSettingsItemProps {
8
+ config: any;
9
+ t: (key: string) => string;
10
+ }
11
+
12
+ export const SubscriptionSettingsItem: React.FC<SubscriptionSettingsItemProps> = ({ config, t }) => {
13
+ const navigation = useNavigation();
14
+ const handlePress = () => {
15
+ if (config.route) {
16
+ navigation.navigate(config.route as never);
17
+ } else if (config.onPress) {
18
+ config.onPress();
19
+ }
20
+ };
21
+ return (
22
+ <SettingsItemCard
23
+ title={config.title || t("settings.subscription.title")}
24
+ description={config.description || t("settings.subscription.description")}
25
+ icon={(config.icon || "star") as IconName}
26
+ onPress={handlePress}
27
+ sectionTitle={config.sectionTitle}
28
+ />
29
+ );
30
+ };
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ // @ts-ignore - Optional peer dependency
3
+ import { useNavigation } from "@react-navigation/native";
4
+ import { SettingsItemCard } from "../../components/SettingsItemCard";
5
+ import type { IconName } from "@umituz/react-native-design-system";
6
+
7
+ export interface WalletSettingsItemProps {
8
+ config: any;
9
+ t: (key: string) => string;
10
+ }
11
+
12
+ export const WalletSettingsItem: React.FC<WalletSettingsItemProps> = ({ config, t }) => {
13
+ const navigation = useNavigation();
14
+ const handlePress = () => {
15
+ if (config.route) {
16
+ navigation.navigate(config.route as never);
17
+ }
18
+ };
19
+ return (
20
+ <SettingsItemCard
21
+ title={config.title || t("wallet.title")}
22
+ description={config.description || t("wallet.description")}
23
+ icon={(config.icon || "wallet") as IconName}
24
+ onPress={handlePress}
25
+ sectionTitle={config.sectionTitle}
26
+ />
27
+ );
28
+ };
@@ -60,6 +60,7 @@ export function useFeatureDetection(
60
60
  faqs,
61
61
  subscription,
62
62
  wallet,
63
+ gamification,
63
64
  } = normalizedConfig;
64
65
 
65
66
  const notificationServiceAvailable = !!options?.notificationServiceAvailable;
@@ -114,6 +115,7 @@ export function useFeatureDetection(
114
115
  faqs: faqs.enabled,
115
116
  subscription: subscription.enabled,
116
117
  wallet: wallet.enabled,
118
+ gamification: gamification.enabled,
117
119
  };
118
120
  }, [normalizedConfig, navigation, options]);
119
121
  }
@@ -20,6 +20,7 @@ import type {
20
20
  CloudSyncConfig,
21
21
  SubscriptionConfig,
22
22
  WalletConfig,
23
+ GamificationConfig,
23
24
  } from "./UserFeatureConfig";
24
25
 
25
26
  /**
@@ -130,6 +131,12 @@ export interface SettingsConfig {
130
131
  */
131
132
  wallet?: FeatureVisibility | WalletConfig;
132
133
 
134
+ /**
135
+ * Gamification settings configuration
136
+ * @default false
137
+ */
138
+ gamification?: FeatureVisibility | GamificationConfig;
139
+
133
140
  /**
134
141
  * Custom empty state text when no settings are available
135
142
  */
@@ -139,3 +139,24 @@ export interface WalletConfig {
139
139
  /** Current balance to display */
140
140
  balance?: number;
141
141
  }
142
+
143
+ /**
144
+ * Gamification Settings Configuration
145
+ */
146
+ export interface GamificationConfig {
147
+ /** Show gamification section */
148
+ enabled?: FeatureVisibility;
149
+ /** Custom title for the gamification section */
150
+ title?: string;
151
+ /** Custom label for the gamification item */
152
+ description?: string;
153
+ /** Custom icon name (Ionicons) */
154
+ icon?: string;
155
+ /** Custom section title for grouping */
156
+ sectionTitle?: string;
157
+ /** Navigation route for gamification screen */
158
+ route?: string;
159
+ /** Achievements to display */
160
+ achievementsCount?: number;
161
+ }
162
+
@@ -17,6 +17,7 @@ import type {
17
17
  FAQConfig,
18
18
  SubscriptionConfig,
19
19
  WalletConfig,
20
+ GamificationConfig,
20
21
  SettingsConfig,
21
22
  } from "../types";
22
23
 
@@ -69,6 +70,10 @@ export interface NormalizedConfig {
69
70
  enabled: boolean;
70
71
  config?: WalletConfig;
71
72
  };
73
+ gamification: {
74
+ enabled: boolean;
75
+ config?: GamificationConfig;
76
+ };
72
77
  }
73
78
 
74
79
  /**
@@ -115,5 +120,6 @@ export function normalizeSettingsConfig(
115
120
  faqs: normalizeConfigValue(config?.faqs, false),
116
121
  subscription: normalizeConfigValue(config?.subscription, false),
117
122
  wallet: normalizeConfigValue(config?.wallet, false),
123
+ gamification: normalizeConfigValue(config?.gamification, false),
118
124
  };
119
125
  }