@umituz/react-native-design-system 4.28.3 → 4.28.4
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/dist/atoms/icon/index.d.ts +20 -3
- package/dist/molecules/navigation/hooks/useAppFocusEffect.d.ts +15 -9
- package/dist/molecules/navigation/hooks/useAppIsFocused.d.ts +10 -2
- package/dist/molecules/navigation/hooks/useAppNavigation.d.ts +8 -1
- package/dist/molecules/navigation/hooks/useAppRoute.d.ts +12 -4
- package/dist/theme/infrastructure/providers/DesignSystemProvider.d.ts +0 -5
- package/package.json +1 -1
- package/src/atoms/icon/index.ts +20 -3
- package/src/theme/infrastructure/providers/DesignSystemProvider.tsx +0 -26
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @deprecated This icon system is deprecated. Use @umituz/react-native-icons instead.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* **Migration Guide:**
|
|
5
|
+
* ```tsx
|
|
6
|
+
* // Old way (deprecated)
|
|
7
|
+
* import { AtomicIcon } from '@umituz/react-native-design-system/atoms';
|
|
8
|
+
* <AtomicIcon name="User" size={24} color="text" />
|
|
9
|
+
*
|
|
10
|
+
* // New way (recommended)
|
|
11
|
+
* import { Icon } from '@umituz/react-native-icons';
|
|
12
|
+
* <Icon name="User" size={24} color="text" />
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Benefits of @umituz/react-native-icons:**
|
|
16
|
+
* - ✅ Package-agnostic (works with Lucide, Expo, or custom providers)
|
|
17
|
+
* - ✅ Lazy loading (only configured provider is loaded)
|
|
18
|
+
* - ✅ Automatic name normalization (kebab ↔ PascalCase ↔ camelCase)
|
|
19
|
+
* - ✅ Better performance with caching
|
|
20
|
+
* - ✅ Zero configuration needed in DesignSystemProvider
|
|
21
|
+
*
|
|
22
|
+
* This module is kept for backward compatibility only and will be removed in a future version.
|
|
6
23
|
*/
|
|
7
24
|
export { AtomicIcon, type AtomicIconProps, type IconSize, type IconName, type IconColor, } from './AtomicIcon';
|
|
8
25
|
export { useIconStore, useIconRenderer, useIconName, useHasIconConfig, type IconNames, type IconRenderer, type IconRenderProps, REQUIRED_ICON_KEYS, } from './iconStore';
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* useAppFocusEffect Hook
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Safe wrapper around React Navigation's useFocusEffect.
|
|
5
|
+
* Only runs the effect if navigation is ready.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
7
|
+
* @param effect - Callback to run when screen is focused
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* useAppFocusEffect(
|
|
12
|
+
* useCallback(() => {
|
|
13
|
+
* // Runs when screen is focused
|
|
14
|
+
* return () => {
|
|
15
|
+
* // Cleanup when screen is unfocused
|
|
16
|
+
* };
|
|
17
|
+
* }, [dependency])
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
14
20
|
*/
|
|
15
21
|
export declare function useAppFocusEffect(effect: () => void | (() => void)): void;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* useAppIsFocused Hook
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Safe wrapper around React Navigation's useIsFocused.
|
|
5
|
+
* Returns false if called outside NavigationContainer.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const isFocused = useAppIsFocused();
|
|
10
|
+
* if (isFocused) {
|
|
11
|
+
* // Screen is currently focused
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
6
14
|
*/
|
|
7
15
|
export declare function useAppIsFocused(): boolean;
|
|
@@ -13,13 +13,20 @@ export interface AppNavigationResult {
|
|
|
13
13
|
canGoBack: () => boolean;
|
|
14
14
|
getState: () => ReturnType<NavigationProp<ParamListBase>["getState"]>;
|
|
15
15
|
getParent: () => NavigationProp<ParamListBase> | undefined;
|
|
16
|
+
/** Whether navigation is available (inside NavigationContainer) */
|
|
17
|
+
isReady: boolean;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* useAppNavigation Hook
|
|
19
21
|
*
|
|
20
22
|
* Clean navigation API without complex type casting.
|
|
21
23
|
* Uses navigation.navigate() directly for proper nested navigator support.
|
|
24
|
+
*
|
|
25
|
+
* Safe to use outside NavigationContainer - returns no-op functions.
|
|
26
|
+
*
|
|
22
27
|
* Use: const navigation = useAppNavigation();
|
|
23
|
-
* navigation.
|
|
28
|
+
* if (navigation.isReady) {
|
|
29
|
+
* navigation.navigate("ScreenName", { param: value });
|
|
30
|
+
* }
|
|
24
31
|
*/
|
|
25
32
|
export declare function useAppNavigation(): AppNavigationResult;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import type { RouteProp
|
|
1
|
+
import type { RouteProp } from "@react-navigation/native";
|
|
2
2
|
/**
|
|
3
3
|
* useAppRoute Hook
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Safe wrapper around React Navigation's useRoute hook.
|
|
6
|
+
* Returns empty route params if called outside NavigationContainer.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const route = useAppRoute();
|
|
11
|
+
* if (route.isReady) {
|
|
12
|
+
* const params = route.params;
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
7
15
|
*/
|
|
8
|
-
export declare function useAppRoute
|
|
16
|
+
export declare function useAppRoute(): any;
|
|
9
17
|
export type { RouteProp };
|
|
@@ -2,7 +2,6 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { type ThemeMode } from '../globalThemeStore';
|
|
3
3
|
import type { CustomThemeColors } from '../../core/CustomColors';
|
|
4
4
|
import type { SplashScreenProps } from '../../../molecules/splash/types';
|
|
5
|
-
import type { IconRenderer, IconNames } from '../../../atoms/icon/iconStore';
|
|
6
5
|
interface DesignSystemProviderProps {
|
|
7
6
|
children: ReactNode;
|
|
8
7
|
customColors?: CustomThemeColors;
|
|
@@ -13,10 +12,6 @@ interface DesignSystemProviderProps {
|
|
|
13
12
|
loadingComponent?: ReactNode;
|
|
14
13
|
onInitialized?: () => void;
|
|
15
14
|
onError?: (error: unknown) => void;
|
|
16
|
-
/** Icon renderer - REQUIRED */
|
|
17
|
-
iconRenderer: IconRenderer;
|
|
18
|
-
/** Icon names mapping - REQUIRED */
|
|
19
|
-
iconNames: IconNames;
|
|
20
15
|
}
|
|
21
16
|
export declare const DesignSystemProvider: React.FC<DesignSystemProviderProps>;
|
|
22
17
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "4.28.
|
|
3
|
+
"version": "4.28.4",
|
|
4
4
|
"description": "Universal design system for React Native apps with safe navigation hooks - updated SKILL.md with navigation documentation",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
package/src/atoms/icon/index.ts
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @deprecated This icon system is deprecated. Use @umituz/react-native-icons instead.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* **Migration Guide:**
|
|
5
|
+
* ```tsx
|
|
6
|
+
* // Old way (deprecated)
|
|
7
|
+
* import { AtomicIcon } from '@umituz/react-native-design-system/atoms';
|
|
8
|
+
* <AtomicIcon name="User" size={24} color="text" />
|
|
9
|
+
*
|
|
10
|
+
* // New way (recommended)
|
|
11
|
+
* import { Icon } from '@umituz/react-native-icons';
|
|
12
|
+
* <Icon name="User" size={24} color="text" />
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* **Benefits of @umituz/react-native-icons:**
|
|
16
|
+
* - ✅ Package-agnostic (works with Lucide, Expo, or custom providers)
|
|
17
|
+
* - ✅ Lazy loading (only configured provider is loaded)
|
|
18
|
+
* - ✅ Automatic name normalization (kebab ↔ PascalCase ↔ camelCase)
|
|
19
|
+
* - ✅ Better performance with caching
|
|
20
|
+
* - ✅ Zero configuration needed in DesignSystemProvider
|
|
21
|
+
*
|
|
22
|
+
* This module is kept for backward compatibility only and will be removed in a future version.
|
|
6
23
|
*/
|
|
7
24
|
|
|
8
25
|
// Main Component
|
|
@@ -7,8 +7,6 @@ import { useTheme } from '../stores/themeStore';
|
|
|
7
7
|
import { useDesignSystemTheme, type ThemeMode } from '../globalThemeStore';
|
|
8
8
|
import type { CustomThemeColors } from '../../core/CustomColors';
|
|
9
9
|
import type { SplashScreenProps } from '../../../molecules/splash/types';
|
|
10
|
-
import { useIconStore } from '../../../atoms/icon/iconStore';
|
|
11
|
-
import type { IconRenderer, IconNames } from '../../../atoms/icon/iconStore';
|
|
12
10
|
import { FIVE_SECONDS_MS } from '../../../utils/constants/TimeConstants';
|
|
13
11
|
|
|
14
12
|
// Lazy load SplashScreen to avoid circular dependency
|
|
@@ -27,10 +25,6 @@ interface DesignSystemProviderProps {
|
|
|
27
25
|
loadingComponent?: ReactNode;
|
|
28
26
|
onInitialized?: () => void;
|
|
29
27
|
onError?: (error: unknown) => void;
|
|
30
|
-
/** Icon renderer - REQUIRED */
|
|
31
|
-
iconRenderer: IconRenderer;
|
|
32
|
-
/** Icon names mapping - REQUIRED */
|
|
33
|
-
iconNames: IconNames;
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
|
|
@@ -43,8 +37,6 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
|
|
|
43
37
|
loadingComponent,
|
|
44
38
|
onInitialized,
|
|
45
39
|
onError,
|
|
46
|
-
iconRenderer,
|
|
47
|
-
iconNames,
|
|
48
40
|
}) => {
|
|
49
41
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
50
42
|
const hasCustomFonts = fonts != null && Object.keys(fonts).length > 0;
|
|
@@ -57,24 +49,6 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
|
|
|
57
49
|
const setGlobalCustomColors = useDesignSystemTheme((state) => state.setCustomColors);
|
|
58
50
|
const setGlobalThemeMode = useDesignSystemTheme((state) => state.setThemeMode);
|
|
59
51
|
|
|
60
|
-
// Set icon config SYNCHRONOUSLY before first render
|
|
61
|
-
if (iconRenderer && iconNames) {
|
|
62
|
-
const store = useIconStore.getState();
|
|
63
|
-
if (!store.isConfigured) {
|
|
64
|
-
if (__DEV__) {
|
|
65
|
-
console.log('[DesignSystemProvider] ✅ Registering iconRenderer and iconNames');
|
|
66
|
-
}
|
|
67
|
-
useIconStore.getState().setConfig(iconNames, iconRenderer);
|
|
68
|
-
} else if (__DEV__) {
|
|
69
|
-
console.log('[DesignSystemProvider] ℹ️ Icon config already configured, skipping');
|
|
70
|
-
}
|
|
71
|
-
} else if (__DEV__) {
|
|
72
|
-
console.warn('[DesignSystemProvider] ❌ iconRenderer or iconNames missing!', {
|
|
73
|
-
hasIconRenderer: !!iconRenderer,
|
|
74
|
-
hasIconNames: !!iconNames,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
52
|
useEffect(() => {
|
|
79
53
|
// Register app's default colors for reset feature
|
|
80
54
|
if (customColors) {
|