@umituz/react-native-design-system 2.6.36 → 2.6.38

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-design-system",
3
- "version": "2.6.36",
3
+ "version": "2.6.38",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -51,7 +51,6 @@
51
51
  "peerDependencies": {
52
52
  "@expo/vector-icons": ">=15.0.0",
53
53
  "@gorhom/bottom-sheet": ">=5.0.0",
54
- "@react-native-async-storage/async-storage": ">=2.0.0",
55
54
  "@react-native-community/datetimepicker": ">=8.0.0",
56
55
  "@react-navigation/bottom-tabs": ">=7.0.0",
57
56
  "@react-navigation/native": ">=7.0.0",
@@ -98,7 +97,6 @@
98
97
  "@eslint/js": "^9.39.2",
99
98
  "@expo/vector-icons": "^15.0.0",
100
99
  "@gorhom/bottom-sheet": "^5.0.0",
101
- "@react-native-async-storage/async-storage": "^2.2.0",
102
100
  "@react-native-community/datetimepicker": "^8.5.1",
103
101
  "@react-navigation/bottom-tabs": "^7.9.0",
104
102
  "@react-navigation/native": "^7.1.26",
@@ -113,7 +111,7 @@
113
111
  "@umituz/react-native-filesystem": "^2.1.7",
114
112
  "@umituz/react-native-haptics": "^1.0.2",
115
113
  "@umituz/react-native-localization": "^3.5.34",
116
- "@umituz/react-native-storage": "latest",
114
+ "@umituz/react-native-storage": "^2.6.20",
117
115
  "@umituz/react-native-uuid": "*",
118
116
  "eslint": "^9.39.2",
119
117
  "eslint-plugin-react": "^7.37.5",
@@ -9,7 +9,7 @@
9
9
  * @layer infrastructure/services
10
10
  */
11
11
 
12
- import AsyncStorage from '@react-native-async-storage/async-storage';
12
+ import { storageRepository, unwrap } from '@umituz/react-native-storage';
13
13
  import { DeviceIdService } from './DeviceIdService';
14
14
 
15
15
  const STORAGE_KEY = '@device/persistent_id';
@@ -64,7 +64,8 @@ export class PersistentDeviceIdService {
64
64
  */
65
65
  private static async initializeDeviceId(): Promise<string> {
66
66
  try {
67
- const storedId = await AsyncStorage.getItem(STORAGE_KEY);
67
+ const result = await storageRepository.getString(STORAGE_KEY, '');
68
+ const storedId = unwrap(result, '');
68
69
 
69
70
  if (storedId) {
70
71
  cachedDeviceId = storedId;
@@ -72,7 +73,7 @@ export class PersistentDeviceIdService {
72
73
  }
73
74
 
74
75
  const newId = await this.createNewDeviceId();
75
- await AsyncStorage.setItem(STORAGE_KEY, newId);
76
+ await storageRepository.setString(STORAGE_KEY, newId);
76
77
  cachedDeviceId = newId;
77
78
 
78
79
  return newId;
@@ -101,8 +102,7 @@ export class PersistentDeviceIdService {
101
102
  */
102
103
  static async hasStoredId(): Promise<boolean> {
103
104
  try {
104
- const storedId = await AsyncStorage.getItem(STORAGE_KEY);
105
- return storedId !== null;
105
+ return await storageRepository.hasItem(STORAGE_KEY);
106
106
  } catch {
107
107
  return false;
108
108
  }
@@ -114,7 +114,7 @@ export class PersistentDeviceIdService {
114
114
  */
115
115
  static async clearStoredId(): Promise<void> {
116
116
  try {
117
- await AsyncStorage.removeItem(STORAGE_KEY);
117
+ await storageRepository.removeItem(STORAGE_KEY);
118
118
  cachedDeviceId = null;
119
119
  initializationPromise = null;
120
120
  } catch {
@@ -13,7 +13,7 @@
13
13
 
14
14
  import { create } from 'zustand';
15
15
  import { persist, createJSONStorage } from 'zustand/middleware';
16
- import AsyncStorage from '@react-native-async-storage/async-storage';
16
+ import { storageRepository, unwrap, storageService } from '@umituz/react-native-storage';
17
17
  import type { CalendarEvent, CreateCalendarEventRequest, UpdateCalendarEventRequest } from '../../domain/entities/CalendarEvent.entity';
18
18
  import { CalendarService } from '../services/CalendarService';
19
19
 
@@ -101,16 +101,17 @@ export const useCalendarStore = create<CalendarState & { actions: CalendarAction
101
101
  loadEvents: async () => {
102
102
  set({ isLoading: true, error: null });
103
103
  try {
104
- const stored = await AsyncStorage.getItem(STORAGE_KEY);
105
- if (stored) {
106
- const parsed = JSON.parse(stored) as CalendarEvent[];
104
+ const result = await storageRepository.getItem<CalendarEvent[]>(STORAGE_KEY, []);
105
+ const events = unwrap(result, []);
106
+
107
+ if (events && events.length > 0) {
107
108
  // Restore Date objects
108
- const events = parsed.map((event) => ({
109
+ const hydratedEvents = events.map((event) => ({
109
110
  ...event,
110
111
  createdAt: new Date(event.createdAt),
111
112
  updatedAt: new Date(event.updatedAt),
112
113
  }));
113
- set({ events, isLoading: false });
114
+ set({ events: hydratedEvents, isLoading: false });
114
115
  } else {
115
116
  set({ isLoading: false });
116
117
  }
@@ -137,7 +138,7 @@ export const useCalendarStore = create<CalendarState & { actions: CalendarAction
137
138
  };
138
139
 
139
140
  const events = [...get().events, newEvent];
140
- await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(events));
141
+ await storageRepository.setItem(STORAGE_KEY, events);
141
142
  set({ events, isLoading: false });
142
143
  } catch {
143
144
  set({
@@ -164,7 +165,7 @@ export const useCalendarStore = create<CalendarState & { actions: CalendarAction
164
165
  return event;
165
166
  });
166
167
 
167
- await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(events));
168
+ await storageRepository.setItem(STORAGE_KEY, events);
168
169
  set({ events, isLoading: false });
169
170
  } catch {
170
171
  set({
@@ -181,7 +182,7 @@ export const useCalendarStore = create<CalendarState & { actions: CalendarAction
181
182
  set({ isLoading: true, error: null });
182
183
  try {
183
184
  const events = get().events.filter((event) => event.id !== id);
184
- await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(events));
185
+ await storageRepository.setItem(STORAGE_KEY, events);
185
186
  set({ events, isLoading: false });
186
187
  } catch {
187
188
  set({
@@ -294,7 +295,7 @@ export const useCalendarStore = create<CalendarState & { actions: CalendarAction
294
295
  clearAllEvents: async () => {
295
296
  set({ isLoading: true, error: null });
296
297
  try {
297
- await AsyncStorage.removeItem(STORAGE_KEY);
298
+ await storageRepository.removeItem(STORAGE_KEY);
298
299
  set({ events: [], isLoading: false });
299
300
  } catch {
300
301
  set({
@@ -307,7 +308,7 @@ export const useCalendarStore = create<CalendarState & { actions: CalendarAction
307
308
  }),
308
309
  {
309
310
  name: 'calendar-storage',
310
- storage: createJSONStorage(() => AsyncStorage),
311
+ storage: createJSONStorage(() => storageService),
311
312
  partialize: (state) => ({ events: state.events }),
312
313
  }
313
314
  )
@@ -6,7 +6,7 @@
6
6
  * Apps should use this for theme persistence.
7
7
  */
8
8
 
9
- import AsyncStorage from '@react-native-async-storage/async-storage';
9
+ import { storageRepository, unwrap } from '@umituz/react-native-storage';
10
10
  import type { ThemeMode } from '../../core/ColorPalette';
11
11
  import { DESIGN_CONSTANTS } from '../../core/constants/DesignConstants';
12
12
 
@@ -18,7 +18,9 @@ export class ThemeStorage {
18
18
  */
19
19
  static async getThemeMode(): Promise<ThemeMode | null> {
20
20
  try {
21
- const value = await AsyncStorage.getItem(STORAGE_KEY);
21
+ const result = await storageRepository.getString(STORAGE_KEY, '');
22
+ const value = unwrap(result, '');
23
+
22
24
  if (!value) {
23
25
  return null;
24
26
  }
@@ -45,7 +47,7 @@ export class ThemeStorage {
45
47
  throw new Error(`Invalid theme mode: ${mode}`);
46
48
  }
47
49
 
48
- await AsyncStorage.setItem(STORAGE_KEY, mode);
50
+ await storageRepository.setString(STORAGE_KEY, mode);
49
51
  } catch (error) {
50
52
  const errorMessage = error instanceof Error ? error.message : 'Unknown error';
51
53
  // Re-throw validation errors but swallow storage errors to prevent app crashes
@@ -60,7 +62,7 @@ export class ThemeStorage {
60
62
  */
61
63
  static async clearThemeMode(): Promise<void> {
62
64
  try {
63
- await AsyncStorage.removeItem(STORAGE_KEY);
65
+ await storageRepository.removeItem(STORAGE_KEY);
64
66
  } catch {
65
67
  // Don't throw - clearing storage is not critical
66
68
  }