@umituz/react-native-design-system 4.25.83 → 4.25.85

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.25.83",
3
+ "version": "4.25.85",
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",
@@ -54,3 +54,10 @@ export {
54
54
 
55
55
  // Config exports
56
56
  export { DEVICE_BREAKPOINTS } from './config';
57
+
58
+ // Screen dimension hooks — single source of truth for screen width/height
59
+ export {
60
+ useScreenWidth,
61
+ useScreenHeight,
62
+ useScreenDimensions,
63
+ } from './useScreenDimensions';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Screen dimension hooks — single source of truth for screen width/height.
3
+ *
4
+ * Always import from here instead of calling useWindowDimensions() inline
5
+ * or Dimensions.get() at module level (which is static and never updates on
6
+ * orientation change, iPad Split View, or Stage Manager).
7
+ */
8
+
9
+ import { useWindowDimensions } from 'react-native';
10
+
11
+ /**
12
+ * Returns the current window width (reactive — updates on orientation change).
13
+ * Use inside React components / hooks instead of Dimensions.get("window").width.
14
+ */
15
+ export function useScreenWidth(): number {
16
+ return useWindowDimensions().width;
17
+ }
18
+
19
+ /**
20
+ * Returns the current window height (reactive — updates on orientation change).
21
+ * Use inside React components / hooks instead of Dimensions.get("window").height.
22
+ */
23
+ export function useScreenHeight(): number {
24
+ return useWindowDimensions().height;
25
+ }
26
+
27
+ /**
28
+ * Returns both width and height (reactive).
29
+ * Convenience wrapper for components that need both dimensions.
30
+ */
31
+ export function useScreenDimensions(): { width: number; height: number } {
32
+ const { width, height } = useWindowDimensions();
33
+ return { width, height };
34
+ }