@umituz/react-native-notifications 1.3.1 → 1.3.2
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
|
@@ -8,6 +8,8 @@ import type { StyleProp, ViewStyle } from 'react-native';
|
|
|
8
8
|
import { View, TouchableOpacity, StyleSheet, Switch } from 'react-native';
|
|
9
9
|
import { AtomicText, AtomicIcon } from '@umituz/react-native-design-system';
|
|
10
10
|
import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
|
|
11
|
+
// @ts-ignore - Optional peer dependency
|
|
12
|
+
import { useNavigation } from '@react-navigation/native';
|
|
11
13
|
import { notificationService } from '../../infrastructure/services/NotificationService';
|
|
12
14
|
|
|
13
15
|
export interface NotificationsSectionConfig {
|
|
@@ -22,14 +24,13 @@ export interface NotificationsSectionConfig {
|
|
|
22
24
|
export interface NotificationsSectionProps {
|
|
23
25
|
config?: NotificationsSectionConfig;
|
|
24
26
|
containerStyle?: StyleProp<ViewStyle>;
|
|
25
|
-
onNavigate?: (route: string) => void;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
29
30
|
config,
|
|
30
31
|
containerStyle,
|
|
31
|
-
onNavigate,
|
|
32
32
|
}) => {
|
|
33
|
+
const navigation = useNavigation();
|
|
33
34
|
const tokens = useAppDesignTokens();
|
|
34
35
|
const styles = useMemo(() => createStyles(tokens), [tokens]);
|
|
35
36
|
|
|
@@ -54,14 +55,9 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
54
55
|
}, [config]);
|
|
55
56
|
|
|
56
57
|
const handlePress = useCallback(async () => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
if (config?.route && onNavigate) {
|
|
62
|
-
onNavigate(config.route);
|
|
63
|
-
}
|
|
64
|
-
}, [config?.route, onNavigate]);
|
|
58
|
+
const route = config?.route || 'Notifications';
|
|
59
|
+
navigation.navigate(route as never);
|
|
60
|
+
}, [config?.route, navigation]);
|
|
65
61
|
|
|
66
62
|
const title = config?.title || 'Notifications';
|
|
67
63
|
const description = config?.description || 'Manage notification preferences';
|
|
@@ -78,7 +74,7 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
78
74
|
activeOpacity={0.7}
|
|
79
75
|
>
|
|
80
76
|
<View style={styles.iconContainer}>
|
|
81
|
-
<AtomicIcon name="
|
|
77
|
+
<AtomicIcon name="notifications" size="md" color="primary" />
|
|
82
78
|
</View>
|
|
83
79
|
<View style={styles.textContainer}>
|
|
84
80
|
<AtomicText type="bodyLarge">{title}</AtomicText>
|
|
@@ -93,7 +89,7 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
|
|
|
93
89
|
thumbColor={tokens.colors.surface}
|
|
94
90
|
/>
|
|
95
91
|
) : (
|
|
96
|
-
<AtomicIcon name="chevron-
|
|
92
|
+
<AtomicIcon name="chevron-forward" size="md" color="textSecondary" />
|
|
97
93
|
)}
|
|
98
94
|
</TouchableOpacity>
|
|
99
95
|
</View>
|