@umituz/react-native-settings 1.6.2 → 1.7.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
CHANGED
package/src/index.ts
CHANGED
|
@@ -41,7 +41,7 @@ export { LanguageSelectionScreen } from './presentation/screens/LanguageSelectio
|
|
|
41
41
|
// PRESENTATION LAYER - Types
|
|
42
42
|
// =============================================================================
|
|
43
43
|
|
|
44
|
-
export type { SettingsConfig } from './presentation/screens/types';
|
|
44
|
+
export type { SettingsConfig, CustomSettingsSection } from './presentation/screens/types';
|
|
45
45
|
|
|
46
46
|
// =============================================================================
|
|
47
47
|
// PRESENTATION LAYER - Components
|
|
@@ -24,7 +24,7 @@ import { SettingItem } from "../components/SettingItem";
|
|
|
24
24
|
import { SettingsSection } from "../components/SettingsSection";
|
|
25
25
|
import { SettingsFooter } from "../components/SettingsFooter";
|
|
26
26
|
import { UserProfileHeader } from "../components/UserProfileHeader";
|
|
27
|
-
import { SettingsConfig } from "./types";
|
|
27
|
+
import { SettingsConfig, CustomSettingsSection } from "./types";
|
|
28
28
|
|
|
29
29
|
// Optional notification service
|
|
30
30
|
let notificationService: any = null;
|
|
@@ -92,6 +92,8 @@ export interface SettingsScreenProps {
|
|
|
92
92
|
showFooter?: boolean;
|
|
93
93
|
/** Custom footer text */
|
|
94
94
|
footerText?: string;
|
|
95
|
+
/** Custom sections to render */
|
|
96
|
+
customSections?: CustomSettingsSection[];
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
@@ -100,6 +102,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
100
102
|
userProfile,
|
|
101
103
|
showFooter = true,
|
|
102
104
|
footerText,
|
|
105
|
+
customSections = [],
|
|
103
106
|
}) => {
|
|
104
107
|
const navigation = useNavigation();
|
|
105
108
|
const { themeMode } = useDesignSystemTheme();
|
|
@@ -234,7 +237,16 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
234
237
|
</SettingsSection>
|
|
235
238
|
)}
|
|
236
239
|
|
|
237
|
-
{
|
|
240
|
+
{/* Custom Sections */}
|
|
241
|
+
{customSections
|
|
242
|
+
.sort((a, b) => (a.order ?? 999) - (b.order ?? 999))
|
|
243
|
+
.map((section, index) => (
|
|
244
|
+
<SettingsSection key={`custom-${index}`} title={section.title}>
|
|
245
|
+
{section.content}
|
|
246
|
+
</SettingsSection>
|
|
247
|
+
))}
|
|
248
|
+
|
|
249
|
+
{!hasAnyFeatures && customSections.length === 0 && (
|
|
238
250
|
<View style={styles.emptyContainer}>
|
|
239
251
|
<SettingsSection
|
|
240
252
|
title={t("settings.noOptionsAvailable") || "No settings available"}
|
|
@@ -33,3 +33,16 @@ export interface SettingsConfig {
|
|
|
33
33
|
legal?: boolean | 'auto';
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Custom Settings Section
|
|
38
|
+
* Allows apps to add custom sections to the settings screen
|
|
39
|
+
*/
|
|
40
|
+
export interface CustomSettingsSection {
|
|
41
|
+
/** Section title */
|
|
42
|
+
title: string;
|
|
43
|
+
/** Section content (React nodes) */
|
|
44
|
+
content: React.ReactNode;
|
|
45
|
+
/** Section order (lower = higher in list) */
|
|
46
|
+
order?: number;
|
|
47
|
+
}
|
|
48
|
+
|