@umituz/react-native-design-system 4.25.60 → 4.25.62
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 +1 -1
- package/src/atoms/AtomicPicker.tsx +1 -1
- package/src/atoms/AtomicTextArea.tsx +1 -1
- package/src/atoms/button/AtomicButton.tsx +1 -1
- package/src/atoms/card/AtomicCard.tsx +2 -2
- package/src/atoms/datepicker/components/DatePickerModal.tsx +3 -3
- package/src/atoms/input/components/InputIcon.tsx +13 -5
- package/src/atoms/input/hooks/useInputState.ts +3 -3
- package/src/atoms/picker/components/PickerChips.tsx +3 -1
- package/src/carousel/useCarouselScroll.ts +5 -3
- package/src/image/presentation/components/ImageGallery.tsx +5 -2
- package/src/layouts/ScreenLayout/ScreenLayout.tsx +16 -10
- package/src/molecules/FormField.tsx +2 -2
- package/src/molecules/action-footer/ActionFooter.tsx +5 -0
- package/src/molecules/alerts/AlertContainer.tsx +8 -5
- package/src/molecules/alerts/AlertToast.tsx +7 -1
- package/src/molecules/alerts/hooks/useAlertAutoDismiss.ts +1 -1
- package/src/molecules/alerts/hooks/useAlertDismissHandler.ts +1 -1
- package/src/molecules/bottom-sheet/components/BottomSheet.tsx +3 -3
- package/src/molecules/calendar/infrastructure/stores/useCalendarEvents.ts +2 -2
- package/src/molecules/countdown/components/CountdownHeader.tsx +2 -0
- package/src/molecules/info-grid/InfoGrid.tsx +3 -3
- package/src/molecules/navigation/components/NavigationHeader.tsx +6 -1
- package/src/offline/infrastructure/events/NetworkEvents.ts +8 -2
- package/src/storage/presentation/hooks/useStorageState.ts +1 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.62",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -64,7 +64,7 @@ export const AtomicPicker: React.FC<AtomicPickerProps> = ({
|
|
|
64
64
|
onPress={() => !disabled && pickerState.openModal()}
|
|
65
65
|
disabled={disabled}
|
|
66
66
|
accessibilityRole="button"
|
|
67
|
-
accessibilityLabel={label || placeholder}
|
|
67
|
+
accessibilityLabel={label || placeholder || 'Select option'}
|
|
68
68
|
accessibilityState={{ disabled }}
|
|
69
69
|
testID={testID}
|
|
70
70
|
style={StyleSheet.flatten([
|
|
@@ -120,7 +120,7 @@ export const AtomicTextArea = forwardRef<React.ElementRef<typeof TextInput>, Ato
|
|
|
120
120
|
{maxLength && value !== undefined && (
|
|
121
121
|
<AtomicText
|
|
122
122
|
type="labelSmall"
|
|
123
|
-
color=
|
|
123
|
+
color={hasError ? 'error' : 'secondary'}
|
|
124
124
|
style={styles.characterCount}
|
|
125
125
|
>
|
|
126
126
|
{value.length}/{maxLength}
|
|
@@ -94,7 +94,7 @@ export const AtomicButton: React.FC<AtomicButtonProps> = React.memo(({
|
|
|
94
94
|
color={iconColor as string}
|
|
95
95
|
style={iconPosition === 'right' ? buttonStyles.iconRight : buttonStyles.iconLeft}
|
|
96
96
|
/>
|
|
97
|
-
) :
|
|
97
|
+
) : showIcon ? (
|
|
98
98
|
<AtomicIcon
|
|
99
99
|
name={icon}
|
|
100
100
|
customSize={config.iconSize}
|
|
@@ -39,7 +39,7 @@ interface CardContentProps {
|
|
|
39
39
|
children?: React.ReactNode;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const CardContent: React.FC<CardContentProps> = ({
|
|
42
|
+
const CardContent: React.FC<CardContentProps> = React.memo(({
|
|
43
43
|
badge,
|
|
44
44
|
image,
|
|
45
45
|
imageAspectRatio,
|
|
@@ -137,7 +137,7 @@ const CardContent: React.FC<CardContentProps> = ({
|
|
|
137
137
|
</View>
|
|
138
138
|
</>
|
|
139
139
|
);
|
|
140
|
-
};
|
|
140
|
+
});
|
|
141
141
|
|
|
142
142
|
const AtomicCardComponent: React.FC<AtomicCardProps> = ({
|
|
143
143
|
children,
|
|
@@ -113,7 +113,7 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
|
|
|
113
113
|
transparent
|
|
114
114
|
animationType="none"
|
|
115
115
|
onRequestClose={onClose}
|
|
116
|
-
testID={`${testID}-modal`}
|
|
116
|
+
testID={testID ? `${testID}-modal` : undefined}
|
|
117
117
|
accessibilityViewIsModal={true}
|
|
118
118
|
>
|
|
119
119
|
<View style={modalStyles.overlay}>
|
|
@@ -131,7 +131,7 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
|
|
|
131
131
|
<TouchableOpacity
|
|
132
132
|
onPress={onClose}
|
|
133
133
|
style={modalStyles.doneButton}
|
|
134
|
-
testID={`${testID}-done`}
|
|
134
|
+
testID={testID ? `${testID}-done` : undefined}
|
|
135
135
|
>
|
|
136
136
|
<AtomicText style={modalStyles.doneButtonText}>{doneButtonText}</AtomicText>
|
|
137
137
|
</TouchableOpacity>
|
|
@@ -146,7 +146,7 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
|
|
|
146
146
|
maximumDate={maximumDate}
|
|
147
147
|
display="spinner"
|
|
148
148
|
style={{ alignSelf: 'center' }}
|
|
149
|
-
testID={`${testID}-picker`}
|
|
149
|
+
testID={testID ? `${testID}-picker` : undefined}
|
|
150
150
|
/>
|
|
151
151
|
</View>
|
|
152
152
|
</View>
|
|
@@ -23,19 +23,27 @@ export const InputIcon: React.FC<InputIconProps> = ({
|
|
|
23
23
|
|
|
24
24
|
if (onPress) {
|
|
25
25
|
return (
|
|
26
|
-
<Pressable
|
|
26
|
+
<Pressable
|
|
27
|
+
onPress={onPress}
|
|
28
|
+
style={style}
|
|
29
|
+
testID={testID}
|
|
30
|
+
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
31
|
+
accessibilityRole="button"
|
|
32
|
+
accessibilityLabel={name}
|
|
33
|
+
>
|
|
27
34
|
<AtomicIcon name={name} customSize={size} customColor={color} />
|
|
28
35
|
</Pressable>
|
|
29
36
|
);
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
return (
|
|
33
|
-
<AtomicIcon
|
|
34
|
-
name={name}
|
|
35
|
-
customSize={size}
|
|
36
|
-
customColor={color}
|
|
40
|
+
<AtomicIcon
|
|
41
|
+
name={name}
|
|
42
|
+
customSize={size}
|
|
43
|
+
customColor={color}
|
|
37
44
|
style={style}
|
|
38
45
|
testID={testID}
|
|
46
|
+
accessibilityRole="image"
|
|
39
47
|
/>
|
|
40
48
|
);
|
|
41
49
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useCallback, useEffect
|
|
1
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
interface UseInputStateProps {
|
|
4
4
|
value?: string;
|
|
@@ -45,7 +45,7 @@ export const useInputState = ({
|
|
|
45
45
|
const characterCount = localValue.length;
|
|
46
46
|
const isAtMaxLength = maxLength ? characterCount >= maxLength : false;
|
|
47
47
|
|
|
48
|
-
return
|
|
48
|
+
return {
|
|
49
49
|
localValue,
|
|
50
50
|
isFocused,
|
|
51
51
|
isPasswordVisible,
|
|
@@ -54,5 +54,5 @@ export const useInputState = ({
|
|
|
54
54
|
setIsFocused,
|
|
55
55
|
handleTextChange,
|
|
56
56
|
togglePasswordVisibility,
|
|
57
|
-
}
|
|
57
|
+
};
|
|
58
58
|
};
|
|
@@ -46,7 +46,9 @@ export const PickerChips: React.FC<PickerChipsProps> = React.memo(({
|
|
|
46
46
|
e.stopPropagation();
|
|
47
47
|
onRemoveChip(opt.value);
|
|
48
48
|
}}
|
|
49
|
-
hitSlop={{ top:
|
|
49
|
+
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
|
|
50
|
+
accessibilityRole="button"
|
|
51
|
+
accessibilityLabel={`Remove ${opt.label}`}
|
|
50
52
|
>
|
|
51
53
|
<AtomicIcon name={closeIcon} size="sm" color="primary" />
|
|
52
54
|
</TouchableOpacity>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useCallback } from "react";
|
|
1
|
+
import { useState, useCallback, useRef } from "react";
|
|
2
2
|
import { NativeScrollEvent, NativeSyntheticEvent } from "react-native";
|
|
3
3
|
import { calculateIndexFromScroll } from "./carouselCalculations";
|
|
4
4
|
|
|
@@ -12,18 +12,20 @@ export const useCarouselScroll = ({
|
|
|
12
12
|
onIndexChange,
|
|
13
13
|
}: UseCarouselScrollOptions) => {
|
|
14
14
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
15
|
+
const currentIndexRef = useRef(0);
|
|
15
16
|
|
|
16
17
|
const handleScroll = useCallback(
|
|
17
18
|
(event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
18
19
|
const scrollPosition = event.nativeEvent.contentOffset.x;
|
|
19
20
|
const newIndex = calculateIndexFromScroll(scrollPosition, itemWidth);
|
|
20
21
|
|
|
21
|
-
if (newIndex !==
|
|
22
|
+
if (newIndex !== currentIndexRef.current) {
|
|
23
|
+
currentIndexRef.current = newIndex;
|
|
22
24
|
setCurrentIndex(newIndex);
|
|
23
25
|
onIndexChange?.(newIndex);
|
|
24
26
|
}
|
|
25
27
|
},
|
|
26
|
-
[itemWidth,
|
|
28
|
+
[itemWidth, onIndexChange],
|
|
27
29
|
);
|
|
28
30
|
|
|
29
31
|
return {
|
|
@@ -76,13 +76,14 @@ export const ImageGallery: React.FC<ImageGalleryProps> = ({
|
|
|
76
76
|
}, [images, onImageChange]);
|
|
77
77
|
|
|
78
78
|
const handleScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
79
|
-
const
|
|
79
|
+
const rawIndex = Math.round(event.nativeEvent.contentOffset.x / SCREEN_WIDTH);
|
|
80
|
+
const nextIndex = Math.max(0, Math.min(rawIndex, images.length - 1));
|
|
80
81
|
if (nextIndex !== currentIndexRef.current) {
|
|
81
82
|
currentIndexRef.current = nextIndex;
|
|
82
83
|
onIndexChange?.(nextIndex);
|
|
83
84
|
forceRender();
|
|
84
85
|
}
|
|
85
|
-
}, [onIndexChange, SCREEN_WIDTH]);
|
|
86
|
+
}, [onIndexChange, SCREEN_WIDTH, images.length]);
|
|
86
87
|
|
|
87
88
|
const renderItem = useCallback(({ item }: { item: ImageViewerItem }) => (
|
|
88
89
|
<View style={styles.imageWrapper}>
|
|
@@ -92,12 +93,14 @@ export const ImageGallery: React.FC<ImageGalleryProps> = ({
|
|
|
92
93
|
style={styles.fullImage}
|
|
93
94
|
contentFit="contain"
|
|
94
95
|
cachePolicy="memory-disk"
|
|
96
|
+
onError={() => { if (__DEV__) console.warn('[ImageGallery] Failed to load image:', item.uri); }}
|
|
95
97
|
/>
|
|
96
98
|
) : (
|
|
97
99
|
<RNImage
|
|
98
100
|
source={{ uri: item.uri }}
|
|
99
101
|
style={styles.fullImage}
|
|
100
102
|
resizeMode="contain"
|
|
103
|
+
onError={() => { if (__DEV__) console.warn('[ImageGallery] Failed to load image:', item.uri); }}
|
|
101
104
|
/>
|
|
102
105
|
)}
|
|
103
106
|
</View>
|
|
@@ -67,16 +67,22 @@ export const ScreenLayout: React.FC<ScreenLayoutProps> = (props: ScreenLayoutPro
|
|
|
67
67
|
}
|
|
68
68
|
]}>
|
|
69
69
|
{header}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
{scrollable ? (
|
|
71
|
+
<ScrollView
|
|
72
|
+
style={styles.scrollView}
|
|
73
|
+
contentContainerStyle={[styles.scrollContent, contentContainerStyle]}
|
|
74
|
+
showsVerticalScrollIndicator={!hideScrollIndicator}
|
|
75
|
+
keyboardShouldPersistTaps="handled"
|
|
76
|
+
refreshControl={refreshControl}
|
|
77
|
+
nestedScrollEnabled
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</ScrollView>
|
|
81
|
+
) : (
|
|
82
|
+
<View style={[styles.scrollView, styles.scrollContent, contentContainerStyle]}>
|
|
83
|
+
{children}
|
|
84
|
+
</View>
|
|
85
|
+
)}
|
|
80
86
|
{footer && (
|
|
81
87
|
<View style={{ paddingBottom }}>
|
|
82
88
|
{footer}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Composition: AtomicText + AtomicInput
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import React from 'react';
|
|
10
|
+
import React, { useMemo } from 'react';
|
|
11
11
|
import { View, ViewStyle } from 'react-native';
|
|
12
12
|
import { useAppDesignTokens } from '../theme';
|
|
13
13
|
import { AtomicText, AtomicInput, type AtomicInputProps } from '../atoms';
|
|
@@ -96,7 +96,7 @@ export const FormField: React.FC<FormFieldProps> = ({
|
|
|
96
96
|
}) => {
|
|
97
97
|
const tokens = useAppDesignTokens();
|
|
98
98
|
const inputState = error ? 'error' : 'default';
|
|
99
|
-
const styles = getStyles(tokens);
|
|
99
|
+
const styles = useMemo(() => getStyles(tokens), [tokens]);
|
|
100
100
|
|
|
101
101
|
return (
|
|
102
102
|
<View style={[styles.container, containerStyle || style]}>
|
|
@@ -67,6 +67,8 @@ export const ActionFooter: React.FC<ActionFooterProps> = ({
|
|
|
67
67
|
onPress={onBack}
|
|
68
68
|
activeOpacity={0.7}
|
|
69
69
|
testID="action-footer-back"
|
|
70
|
+
accessibilityRole="button"
|
|
71
|
+
accessibilityLabel="Go back"
|
|
70
72
|
>
|
|
71
73
|
<AtomicIcon
|
|
72
74
|
name={backIcon}
|
|
@@ -81,6 +83,9 @@ export const ActionFooter: React.FC<ActionFooterProps> = ({
|
|
|
81
83
|
activeOpacity={0.9}
|
|
82
84
|
disabled={loading}
|
|
83
85
|
testID="action-footer-action"
|
|
86
|
+
accessibilityRole="button"
|
|
87
|
+
accessibilityLabel={actionLabel}
|
|
88
|
+
accessibilityState={{ disabled: loading, busy: loading }}
|
|
84
89
|
>
|
|
85
90
|
<View style={themedStyles.actionContent}>
|
|
86
91
|
<AtomicText style={themedStyles.actionText}>{actionLabel}</AtomicText>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* AlertContainer Component
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
6
|
import { View, StyleSheet } from 'react-native';
|
|
7
7
|
import { useSafeAreaInsets } from '../../safe-area';
|
|
8
8
|
import { useAppDesignTokens } from '../../theme';
|
|
@@ -12,14 +12,14 @@ import { AlertBanner } from './AlertBanner';
|
|
|
12
12
|
import { AlertModal } from './AlertModal';
|
|
13
13
|
import { Alert, AlertMode } from './AlertTypes';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const AlertContainerComponent: React.FC = () => {
|
|
16
16
|
const alerts = useAlertStore((state: { alerts: Alert[] }) => state.alerts);
|
|
17
17
|
const insets = useSafeAreaInsets();
|
|
18
18
|
const tokens = useAppDesignTokens();
|
|
19
19
|
|
|
20
|
-
const toasts = alerts.filter((a: Alert) => a.mode === AlertMode.TOAST);
|
|
21
|
-
const banners = alerts.filter((a: Alert) => a.mode === AlertMode.BANNER);
|
|
22
|
-
const modals = alerts.filter((a: Alert) => a.mode === AlertMode.MODAL);
|
|
20
|
+
const toasts = useMemo(() => alerts.filter((a: Alert) => a.mode === AlertMode.TOAST), [alerts]);
|
|
21
|
+
const banners = useMemo(() => alerts.filter((a: Alert) => a.mode === AlertMode.BANNER), [alerts]);
|
|
22
|
+
const modals = useMemo(() => alerts.filter((a: Alert) => a.mode === AlertMode.MODAL), [alerts]);
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<View style={styles.container} pointerEvents="box-none">
|
|
@@ -53,6 +53,9 @@ export const AlertContainer: React.FC = () => {
|
|
|
53
53
|
);
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
export const AlertContainer = React.memo(AlertContainerComponent);
|
|
57
|
+
AlertContainerComponent.displayName = 'AlertContainer';
|
|
58
|
+
|
|
56
59
|
const styles = StyleSheet.create({
|
|
57
60
|
container: {
|
|
58
61
|
...StyleSheet.absoluteFillObject,
|
|
@@ -86,11 +86,17 @@ export function AlertToast({ alert }: AlertToastProps) {
|
|
|
86
86
|
<Pressable
|
|
87
87
|
key={action.id}
|
|
88
88
|
onPress={async () => {
|
|
89
|
-
|
|
89
|
+
try {
|
|
90
|
+
await action.onPress();
|
|
91
|
+
} catch (e) {
|
|
92
|
+
if (__DEV__) console.error('[AlertToast] action.onPress failed', e);
|
|
93
|
+
}
|
|
90
94
|
if (action.closeOnPress ?? true) {
|
|
91
95
|
handleDismiss();
|
|
92
96
|
}
|
|
93
97
|
}}
|
|
98
|
+
accessibilityRole="button"
|
|
99
|
+
accessibilityLabel={action.label}
|
|
94
100
|
style={[
|
|
95
101
|
styles.actionButton,
|
|
96
102
|
{
|
|
@@ -15,7 +15,7 @@ export function useAlertDismissHandler(alert: Alert) {
|
|
|
15
15
|
const handleDismiss = useCallback(() => {
|
|
16
16
|
dismissAlert(alert.id);
|
|
17
17
|
alert.onDismiss?.();
|
|
18
|
-
}, [alert, dismissAlert]);
|
|
18
|
+
}, [alert.id, alert.onDismiss, dismissAlert]);
|
|
19
19
|
|
|
20
20
|
return handleDismiss;
|
|
21
21
|
}
|
|
@@ -90,7 +90,7 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>((props,
|
|
|
90
90
|
content: {
|
|
91
91
|
flex: 1,
|
|
92
92
|
}
|
|
93
|
-
}), [sheetHeight, backgroundColor, tokens.colors, borderRadius, insets.bottom]);
|
|
93
|
+
}), [sheetHeight, backgroundColor, tokens.colors.modalOverlay, tokens.colors.surface, tokens.colors.border, borderRadius, insets.bottom]);
|
|
94
94
|
|
|
95
95
|
return (
|
|
96
96
|
<Modal
|
|
@@ -101,9 +101,9 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>((props,
|
|
|
101
101
|
statusBarTranslucent
|
|
102
102
|
accessibilityViewIsModal={true}
|
|
103
103
|
>
|
|
104
|
-
<Pressable style={styles.overlay} onPress={dismiss}>
|
|
104
|
+
<Pressable style={styles.overlay} onPress={dismiss} accessibilityLabel="Close" accessibilityRole="button">
|
|
105
105
|
<View style={styles.container}>
|
|
106
|
-
<Pressable onPress={(e) => e.stopPropagation()} style={styles.content}>
|
|
106
|
+
<Pressable onPress={(e) => e.stopPropagation()} style={styles.content} accessibilityRole="none">
|
|
107
107
|
<View style={styles.handle} />
|
|
108
108
|
{children}
|
|
109
109
|
</Pressable>
|
|
@@ -70,8 +70,8 @@ export const useCalendarEvents = create<CalendarEventsStore>()((set, get) => ({
|
|
|
70
70
|
if (validEvents.length > 0) {
|
|
71
71
|
const hydratedEvents = validEvents.map((event) => ({
|
|
72
72
|
...event,
|
|
73
|
-
createdAt: new Date(event.createdAt),
|
|
74
|
-
updatedAt: new Date(event.updatedAt),
|
|
73
|
+
createdAt: event.createdAt ? new Date(event.createdAt) : new Date(),
|
|
74
|
+
updatedAt: event.updatedAt ? new Date(event.updatedAt) : new Date(),
|
|
75
75
|
}));
|
|
76
76
|
set({ events: hydratedEvents, isLoading: false });
|
|
77
77
|
} else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import { View, StyleSheet } from 'react-native';
|
|
4
4
|
import { AtomicText } from '../../atoms/AtomicText';
|
|
5
5
|
import { AtomicIcon } from '../../atoms';
|
|
@@ -16,7 +16,7 @@ export const InfoGrid: React.FC<InfoGridProps> = ({
|
|
|
16
16
|
}) => {
|
|
17
17
|
const tokens = useAppDesignTokens();
|
|
18
18
|
|
|
19
|
-
const styles = StyleSheet.create({
|
|
19
|
+
const styles = useMemo(() => StyleSheet.create({
|
|
20
20
|
container: {
|
|
21
21
|
gap: tokens.spacing.md,
|
|
22
22
|
},
|
|
@@ -68,7 +68,7 @@ export const InfoGrid: React.FC<InfoGridProps> = ({
|
|
|
68
68
|
color: tokens.colors.textPrimary,
|
|
69
69
|
fontWeight: '500',
|
|
70
70
|
},
|
|
71
|
-
});
|
|
71
|
+
}), [tokens, columns]);
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
74
|
<View style={[styles.container, style]}>
|
|
@@ -50,7 +50,12 @@ export const NavigationHeader: React.FC<NavigationHeaderProps> = ({
|
|
|
50
50
|
return (
|
|
51
51
|
<View style={styles.container}>
|
|
52
52
|
{onBackPress && (
|
|
53
|
-
<TouchableOpacity
|
|
53
|
+
<TouchableOpacity
|
|
54
|
+
onPress={onBackPress}
|
|
55
|
+
style={styles.backButton}
|
|
56
|
+
accessibilityRole="button"
|
|
57
|
+
accessibilityLabel="Go back"
|
|
58
|
+
>
|
|
54
59
|
<AtomicIcon
|
|
55
60
|
name={arrowLeftIcon}
|
|
56
61
|
size="md"
|
|
@@ -32,15 +32,21 @@ class NetworkEventEmitter implements NetworkEvents {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
emit(event: 'online' | 'offline' | 'change', state: NetworkState): void {
|
|
35
|
-
this.listeners.get(event)
|
|
35
|
+
const listeners = this.listeners.get(event);
|
|
36
|
+
if (!listeners) return;
|
|
37
|
+
|
|
38
|
+
const failedListeners: NetworkEventListener[] = [];
|
|
39
|
+
listeners.forEach((listener) => {
|
|
36
40
|
try {
|
|
37
41
|
listener(state);
|
|
38
42
|
} catch (_error) {
|
|
43
|
+
failedListeners.push(listener);
|
|
39
44
|
if (__DEV__) {
|
|
40
|
-
console.error('[DesignSystem]
|
|
45
|
+
console.error('[DesignSystem] NetworkEventEmitter: listener threw an error', _error);
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
48
|
});
|
|
49
|
+
failedListeners.forEach((listener) => listeners.delete(listener));
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
removeAllListeners(): void {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Combines React state with automatic storage persistence
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { useState, useCallback
|
|
8
|
+
import { useState, useCallback } from 'react';
|
|
9
9
|
import { storageRepository } from '../../infrastructure/repositories/AsyncStorageRepository';
|
|
10
10
|
import { unwrap } from '../../domain/entities/StorageResult';
|
|
11
11
|
import type { StorageKey } from '../../domain/value-objects/StorageKey';
|
|
@@ -42,13 +42,6 @@ export const useStorageState = <T>(
|
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
// Sync state with loaded data
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (data !== undefined && data !== null) {
|
|
48
|
-
setState(data);
|
|
49
|
-
}
|
|
50
|
-
}, [data]);
|
|
51
|
-
|
|
52
45
|
// Update state and persist to storage
|
|
53
46
|
const updateState = useCallback(
|
|
54
47
|
async (value: T) => {
|