@umituz/react-native-design-system 2.1.3 → 2.1.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
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",
|
|
@@ -105,4 +105,4 @@
|
|
|
105
105
|
"README.md",
|
|
106
106
|
"LICENSE"
|
|
107
107
|
]
|
|
108
|
-
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useDesignSystemTheme } from '../infrastructure/globalThemeStore';
|
|
3
|
+
import { createDesignTokens, type DesignTokens } from '../core/TokenFactory';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hook to access current design tokens (colors, spacing, typography, etc.)
|
|
7
|
+
*
|
|
8
|
+
* This hook is the primary way for components to access theme tokens.
|
|
9
|
+
* It automatically updates when the theme mode or custom colors change
|
|
10
|
+
* in the design system global store.
|
|
11
|
+
*
|
|
12
|
+
* @returns {DesignTokens} The current design tokens
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const tokens = useAppDesignTokens();
|
|
17
|
+
* return <View style={{ backgroundColor: tokens.colors.backgroundPrimary }} />;
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const useAppDesignTokens = (): DesignTokens => {
|
|
21
|
+
const { themeMode, customColors } = useDesignSystemTheme();
|
|
22
|
+
|
|
23
|
+
return useMemo(
|
|
24
|
+
() => createDesignTokens(themeMode, customColors),
|
|
25
|
+
[themeMode, customColors]
|
|
26
|
+
);
|
|
27
|
+
};
|