@umituz/react-native-notifications 1.3.20 → 1.4.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-notifications",
3
- "version": "1.3.20",
3
+ "version": "1.4.0",
4
4
  "description": "Offline-first local notifications system for React Native apps using expo-notifications",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -1,24 +1,20 @@
1
1
  /**
2
2
  * NotificationsSection Component
3
- * Settings section for notifications with toggle
3
+ * Settings section for notifications - navigates to full screen
4
4
  */
5
5
 
6
- import React, { useState, useEffect, useCallback, useMemo } from 'react';
6
+ import React, { useCallback, useMemo } from 'react';
7
7
  import type { StyleProp, ViewStyle } from 'react-native';
8
- import { View, TouchableOpacity, StyleSheet, Switch } from 'react-native';
8
+ import { View, TouchableOpacity, StyleSheet } from 'react-native';
9
9
  import { AtomicText, AtomicIcon } from '@umituz/react-native-design-system';
10
10
  import { useAppDesignTokens } from '@umituz/react-native-design-system';
11
11
  // @ts-ignore - Optional peer dependency
12
12
  import { useNavigation } from '@react-navigation/native';
13
- import { notificationService } from '../../infrastructure/services/NotificationService';
14
13
 
15
14
  export interface NotificationsSectionConfig {
16
- initialValue?: boolean;
17
- onToggleChange?: (value: boolean) => void;
18
15
  route?: string;
19
16
  title?: string;
20
17
  description?: string;
21
- showToggle?: boolean;
22
18
  }
23
19
 
24
20
  export interface NotificationsSectionProps {
@@ -34,70 +30,32 @@ export const NotificationsSection: React.FC<NotificationsSectionProps> = ({
34
30
  const tokens = useAppDesignTokens();
35
31
  const styles = useMemo(() => createStyles(tokens), [tokens]);
36
32
 
37
- const [enabled, setEnabled] = useState(config?.initialValue ?? false);
38
-
39
- useEffect(() => {
40
- if (config?.initialValue !== undefined) {
41
- setEnabled(config.initialValue);
42
- }
43
- }, [config?.initialValue]);
44
-
45
- const handleToggle = useCallback(async (value: boolean) => {
46
- if (value) {
47
- const hasPermissions = await notificationService.hasPermissions();
48
- if (!hasPermissions) {
49
- const granted = await notificationService.requestPermissions();
50
- if (!granted) return;
51
- }
52
- }
53
- setEnabled(value);
54
- config?.onToggleChange?.(value);
55
- }, [config]);
56
-
57
- const handlePress = useCallback(async () => {
33
+ const handlePress = useCallback(() => {
58
34
  const route = config?.route || 'Notifications';
59
35
  navigation.navigate(route as never);
60
36
  }, [config?.route, navigation]);
61
37
 
62
38
  const title = config?.title || 'Notifications';
63
39
  const description = config?.description || 'Manage notification preferences';
64
- const showToggle = config?.showToggle ?? true;
65
40
 
66
41
  return (
67
42
  <View style={[styles.container, containerStyle]}>
68
43
  <AtomicText type="bodyLarge" style={styles.sectionTitle}>General</AtomicText>
69
44
 
70
- {showToggle ? (
71
- <View style={styles.itemContainer}>
72
- <View style={styles.iconContainer}>
73
- <AtomicIcon name="notifications" size="md" color="primary" />
74
- </View>
75
- <View style={styles.textContainer}>
76
- <AtomicText type="bodyLarge">{title}</AtomicText>
77
- </View>
78
- <Switch
79
- value={enabled}
80
- onValueChange={handleToggle}
81
- trackColor={{ false: tokens.colors.surfaceSecondary, true: tokens.colors.primary }}
82
- thumbColor={tokens.colors.surface}
83
- />
45
+ <TouchableOpacity
46
+ style={styles.itemContainer}
47
+ onPress={handlePress}
48
+ activeOpacity={0.7}
49
+ >
50
+ <View style={styles.iconContainer}>
51
+ <AtomicIcon name="notifications" size="md" color="primary" />
52
+ </View>
53
+ <View style={styles.textContainer}>
54
+ <AtomicText type="bodyLarge">{title}</AtomicText>
55
+ <AtomicText type="bodySmall" style={styles.description}>{description}</AtomicText>
84
56
  </View>
85
- ) : (
86
- <TouchableOpacity
87
- style={styles.itemContainer}
88
- onPress={handlePress}
89
- activeOpacity={0.7}
90
- >
91
- <View style={styles.iconContainer}>
92
- <AtomicIcon name="notifications" size="md" color="primary" />
93
- </View>
94
- <View style={styles.textContainer}>
95
- <AtomicText type="bodyLarge">{title}</AtomicText>
96
- <AtomicText type="bodySmall" style={styles.description}>{description}</AtomicText>
97
- </View>
98
- <AtomicIcon name="chevron-forward" size="md" color="secondary" />
99
- </TouchableOpacity>
100
- )}
57
+ <AtomicIcon name="chevron-forward" size="md" color="secondary" />
58
+ </TouchableOpacity>
101
59
  </View>
102
60
  );
103
61
  };