@umituz/react-native-design-system 2.9.54 → 2.9.55
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.9.
|
|
3
|
+
"version": "2.9.55",
|
|
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",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { useCallback, useMemo } from "react";
|
|
7
7
|
import { useWindowDimensions } from "react-native";
|
|
8
|
-
import {
|
|
8
|
+
import { initialWindowMetrics } from "../safe-area";
|
|
9
9
|
import {
|
|
10
10
|
getResponsiveLogoSize,
|
|
11
11
|
getResponsiveInputHeight,
|
|
@@ -19,9 +19,22 @@ import { computeResponsiveSizes, computeOnboardingSizes } from "./compute/comput
|
|
|
19
19
|
import { computeResponsivePositioning } from "./compute/computeResponsivePositioning";
|
|
20
20
|
import type { UseResponsiveReturn } from "./types/responsiveTypes";
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Get safe area insets from initial window metrics
|
|
24
|
+
* Used before SafeAreaProvider initializes
|
|
25
|
+
*/
|
|
26
|
+
const getInitialSafeAreaInsets = () => {
|
|
27
|
+
if (initialWindowMetrics?.insets) {
|
|
28
|
+
return initialWindowMetrics.insets;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Fallback to zero insets if no metrics available
|
|
32
|
+
return { top: 0, bottom: 0, left: 0, right: 0 };
|
|
33
|
+
};
|
|
34
|
+
|
|
22
35
|
export const useResponsive = (): UseResponsiveReturn => {
|
|
23
36
|
const { width, height } = useWindowDimensions();
|
|
24
|
-
const insets =
|
|
37
|
+
const insets = getInitialSafeAreaInsets();
|
|
25
38
|
|
|
26
39
|
// Memoize utility functions
|
|
27
40
|
const getLogoSize = useCallback(
|
|
@@ -111,7 +124,7 @@ export const useResponsive = (): UseResponsiveReturn => {
|
|
|
111
124
|
getGridCols,
|
|
112
125
|
};
|
|
113
126
|
},
|
|
114
|
-
[width, height,
|
|
127
|
+
[width, height, getLogoSize, getInputHeight, getIconSize, getMaxWidth, getFontSize, getGridCols],
|
|
115
128
|
);
|
|
116
129
|
|
|
117
130
|
return responsiveValues;
|