@umituz/react-native-design-system 4.25.81 → 4.25.82
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.82",
|
|
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",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Responsive Hook Type Definitions
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { DeviceType } from '../../device/detection';
|
|
5
|
+
import type { DeviceType, IPadLayoutInfo } from '../../device/detection';
|
|
6
6
|
import type { ResponsiveModalLayout, ResponsiveBottomSheetLayout, ResponsiveDialogLayout } from '../responsive';
|
|
7
7
|
import type { ResponsiveTabBarConfig, ScreenLayoutConfig } from '../responsiveLayout';
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ export interface UseResponsiveReturn {
|
|
|
15
15
|
readonly isLandscapeDevice: boolean;
|
|
16
16
|
readonly deviceType: DeviceType;
|
|
17
17
|
|
|
18
|
-
// Safe area insets
|
|
18
|
+
// Safe area insets (live, reactive — updates on orientation change)
|
|
19
19
|
readonly insets: {
|
|
20
20
|
readonly top: number;
|
|
21
21
|
readonly bottom: number;
|
|
@@ -23,6 +23,9 @@ export interface UseResponsiveReturn {
|
|
|
23
23
|
readonly right: number;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
// iPad-specific layout info (null on phones)
|
|
27
|
+
readonly iPadLayout: IPadLayoutInfo | null;
|
|
28
|
+
|
|
26
29
|
// Responsive sizes
|
|
27
30
|
readonly logoSize: number;
|
|
28
31
|
readonly inputHeight: number;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { useCallback, useMemo } from "react";
|
|
7
7
|
import { useWindowDimensions } from "react-native";
|
|
8
|
-
import {
|
|
8
|
+
import { useSafeAreaInsets } from "../safe-area";
|
|
9
9
|
import {
|
|
10
10
|
getResponsiveLogoSize,
|
|
11
11
|
getResponsiveInputHeight,
|
|
@@ -17,24 +17,13 @@ import {
|
|
|
17
17
|
import { computeDeviceInfo } from "./compute/computeDeviceInfo";
|
|
18
18
|
import { computeResponsiveSizes, computeOnboardingSizes } from "./compute/computeResponsiveSizes";
|
|
19
19
|
import { computeResponsivePositioning } from "./compute/computeResponsivePositioning";
|
|
20
|
+
import { getIPadLayoutInfo } from "../device/detection";
|
|
20
21
|
import type { UseResponsiveReturn } from "./types/responsiveTypes";
|
|
21
22
|
|
|
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
|
-
|
|
35
23
|
export const useResponsive = (): UseResponsiveReturn => {
|
|
36
24
|
const { width, height } = useWindowDimensions();
|
|
37
|
-
|
|
25
|
+
// Live reactive insets — updates on orientation change, multitasking, notch changes
|
|
26
|
+
const insets = useSafeAreaInsets();
|
|
38
27
|
|
|
39
28
|
// Memoize utility functions
|
|
40
29
|
const getLogoSize = useCallback(
|
|
@@ -64,6 +53,7 @@ export const useResponsive = (): UseResponsiveReturn => {
|
|
|
64
53
|
);
|
|
65
54
|
|
|
66
55
|
// Compute all responsive values
|
|
56
|
+
// Spread individual inset values in deps so useMemo recomputes on any inset change
|
|
67
57
|
const responsiveValues = useMemo(
|
|
68
58
|
() => {
|
|
69
59
|
const dimensions = { width, height };
|
|
@@ -71,6 +61,7 @@ export const useResponsive = (): UseResponsiveReturn => {
|
|
|
71
61
|
const sizes = computeResponsiveSizes(dimensions);
|
|
72
62
|
const positioning = computeResponsivePositioning(insets);
|
|
73
63
|
const onboarding = computeOnboardingSizes(deviceInfo);
|
|
64
|
+
const iPadLayout = deviceInfo.isTabletDevice ? getIPadLayoutInfo() : null;
|
|
74
65
|
|
|
75
66
|
return {
|
|
76
67
|
// Device info
|
|
@@ -81,9 +72,12 @@ export const useResponsive = (): UseResponsiveReturn => {
|
|
|
81
72
|
isLandscapeDevice: deviceInfo.isLandscapeDevice,
|
|
82
73
|
deviceType: deviceInfo.deviceType,
|
|
83
74
|
|
|
84
|
-
// Safe area insets
|
|
75
|
+
// Safe area insets (live, reactive)
|
|
85
76
|
insets,
|
|
86
77
|
|
|
78
|
+
// iPad-specific layout info (null on phones)
|
|
79
|
+
iPadLayout,
|
|
80
|
+
|
|
87
81
|
// Responsive sizes
|
|
88
82
|
logoSize: sizes.logoSize,
|
|
89
83
|
inputHeight: sizes.inputHeight,
|
|
@@ -124,7 +118,8 @@ export const useResponsive = (): UseResponsiveReturn => {
|
|
|
124
118
|
getGridCols,
|
|
125
119
|
};
|
|
126
120
|
},
|
|
127
|
-
|
|
121
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
|
+
[width, height, insets.top, insets.bottom, insets.left, insets.right, getLogoSize, getInputHeight, getIconSize, getMaxWidth, getFontSize, getGridCols],
|
|
128
123
|
);
|
|
129
124
|
|
|
130
125
|
return responsiveValues;
|