@umituz/react-native-design-system 4.25.83 → 4.25.84
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.
|
|
3
|
+
"version": "4.25.84",
|
|
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",
|
package/src/responsive/index.ts
CHANGED
|
@@ -54,3 +54,12 @@ 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
|
+
FALLBACK_SCREEN_WIDTH,
|
|
64
|
+
FALLBACK_SCREEN_HEIGHT,
|
|
65
|
+
} from './useScreenDimensions';
|
|
@@ -0,0 +1,44 @@
|
|
|
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).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useWindowDimensions } from 'react-native';
|
|
9
|
+
|
|
10
|
+
/** Fallback width used when the native bridge hasn't reported dimensions yet. */
|
|
11
|
+
export const FALLBACK_SCREEN_WIDTH = 375;
|
|
12
|
+
|
|
13
|
+
/** Fallback height used when the native bridge hasn't reported dimensions yet. */
|
|
14
|
+
export const FALLBACK_SCREEN_HEIGHT = 812;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the current window width (reactive — updates on orientation change).
|
|
18
|
+
* Use inside React components / hooks instead of Dimensions.get("window").width.
|
|
19
|
+
*/
|
|
20
|
+
export function useScreenWidth(): number {
|
|
21
|
+
const { width } = useWindowDimensions();
|
|
22
|
+
return width > 0 ? width : FALLBACK_SCREEN_WIDTH;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Returns the current window height (reactive — updates on orientation change).
|
|
27
|
+
* Use inside React components / hooks instead of Dimensions.get("window").height.
|
|
28
|
+
*/
|
|
29
|
+
export function useScreenHeight(): number {
|
|
30
|
+
const { height } = useWindowDimensions();
|
|
31
|
+
return height > 0 ? height : FALLBACK_SCREEN_HEIGHT;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns both width and height (reactive).
|
|
36
|
+
* Convenience wrapper for components that need both dimensions.
|
|
37
|
+
*/
|
|
38
|
+
export function useScreenDimensions(): { width: number; height: number } {
|
|
39
|
+
const { width, height } = useWindowDimensions();
|
|
40
|
+
return {
|
|
41
|
+
width: width > 0 ? width : FALLBACK_SCREEN_WIDTH,
|
|
42
|
+
height: height > 0 ? height : FALLBACK_SCREEN_HEIGHT,
|
|
43
|
+
};
|
|
44
|
+
}
|