@umituz/react-native-design-system 4.27.23 → 4.27.25

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": "4.27.23",
3
+ "version": "4.27.25",
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 - TanStack persistence and expo-image-manipulator now lazy loaded",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./dist/index.d.ts",
@@ -127,8 +127,10 @@ export const AtomicIcon: React.FC<AtomicIconProps> = React.memo(
127
127
  // No icon renderer provided - warn in dev and render nothing
128
128
  if (!iconRenderer) {
129
129
  if (__DEV__) {
130
- console.warn(
131
- '[DesignSystem] AtomicIcon requires an iconRenderer in DesignSystemProvider.\n' +
130
+ console.error(
131
+ '[DesignSystem] AtomicIcon: No iconRenderer configured!\n' +
132
+ `Attempted to render icon: "${name}"\n` +
133
+ 'Fix: Provide iconRenderer to DesignSystemProvider.\n' +
132
134
  'Example:\n' +
133
135
  '<DesignSystemProvider\n' +
134
136
  ' iconRenderer={({ name, size, color }) => (\n' +
@@ -78,6 +78,12 @@ function InfiniteScrollListComponent<T>({
78
78
  [config],
79
79
  );
80
80
 
81
+ // Memoize renderItem wrapper to prevent unnecessary re-renders
82
+ const memoizedRenderItem = useCallback(
83
+ ({ item, index }: { item: T; index: number }) => renderItem(item, index),
84
+ [renderItem]
85
+ );
86
+
81
87
  // Loading state
82
88
  if (state.isLoading) {
83
89
  return loadingComponent || <Loading />;
@@ -93,12 +99,6 @@ function InfiniteScrollListComponent<T>({
93
99
  return emptyComponent || <Empty />;
94
100
  }
95
101
 
96
- // Memoize renderItem wrapper to prevent unnecessary re-renders
97
- const memoizedRenderItem = useCallback(
98
- ({ item, index }: { item: T; index: number }) => renderItem(item, index),
99
- [renderItem]
100
- );
101
-
102
102
  // Render list
103
103
  return (
104
104
  <FlatList
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * Store Factory
3
- * Create Zustand stores with AsyncStorage persistence and actions
3
+ * Create Zustand stores with optional persistence and actions
4
+ *
5
+ * NOTE: For persistence, provide a storage implementation.
6
+ * Use `storageRepository` from '@umituz/react-native-design-system/storage'
7
+ * for a centralized AsyncStorage abstraction.
4
8
  */
5
9
 
6
10
  import { create } from 'zustand';
@@ -27,16 +31,35 @@ export function createStore<
27
31
  return { ...state, ...actions } as Store;
28
32
  };
29
33
 
34
+ // No persistence requested
30
35
  if (!config.persist) {
31
36
  return create<Store>(stateCreator);
32
37
  }
33
38
 
39
+ // Persistence requested but no storage provided - warn and create in-memory store
40
+ if (!config.storage) {
41
+ if (__DEV__) {
42
+ console.warn(
43
+ `[StoreFactory] ⚠️ Store "${config.name}" requested persistence but no storage was provided.\n` +
44
+ `Creating in-memory store instead (data will be lost on reload).\n\n` +
45
+ `💡 Fix: Import and provide storage:\n` +
46
+ ` import { storageRepository } from '@umituz/react-native-design-system/storage';\n\n` +
47
+ ` createStore({\n` +
48
+ ` name: 'my-store',\n` +
49
+ ` persist: true,\n` +
50
+ ` storage: storageRepository, // ← Add this\n` +
51
+ ` ...config\n` +
52
+ ` });`
53
+ );
54
+ }
55
+ return create<Store>(stateCreator);
56
+ }
57
+
58
+ // Persistence with storage
34
59
  return create<Store>()(
35
60
  persist<Store>(stateCreator, {
36
61
  name: config.name,
37
- storage: config.storage
38
- ? createJSONStorage(() => config.storage!)
39
- : createJSONStorage(() => require('@react-native-async-storage/async-storage').default),
62
+ storage: createJSONStorage(() => config.storage!),
40
63
  version: config.version || 1,
41
64
  partialize: (config.partialize
42
65
  ? (state: Store) => config.partialize!(state)
@@ -61,8 +61,18 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
61
61
  if (iconRenderer && iconNames) {
62
62
  const store = useIconStore.getState();
63
63
  if (!store.isConfigured) {
64
+ if (__DEV__) {
65
+ console.log('[DesignSystemProvider] ✅ Registering iconRenderer and iconNames');
66
+ }
64
67
  useIconStore.getState().setConfig(iconNames, iconRenderer);
68
+ } else if (__DEV__) {
69
+ console.log('[DesignSystemProvider] ℹ️ Icon config already configured, skipping');
65
70
  }
71
+ } else if (__DEV__) {
72
+ console.warn('[DesignSystemProvider] ❌ iconRenderer or iconNames missing!', {
73
+ hasIconRenderer: !!iconRenderer,
74
+ hasIconNames: !!iconNames,
75
+ });
66
76
  }
67
77
 
68
78
  useEffect(() => {