@umituz/react-native-design-system 2.5.34 → 2.5.35
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 +1 -1
- package/src/responsive/useResponsive.ts +92 -62
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.35",
|
|
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",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { useCallback, useMemo } from
|
|
14
|
-
import { useWindowDimensions } from
|
|
15
|
-
import { useSafeAreaInsets } from
|
|
13
|
+
import { useCallback, useMemo } from "react";
|
|
14
|
+
import { useWindowDimensions } from "react-native";
|
|
15
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
16
16
|
import {
|
|
17
17
|
getResponsiveLogoSize,
|
|
18
18
|
getResponsiveInputHeight,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
type ResponsiveBottomSheetLayout,
|
|
34
34
|
type ResponsiveDialogLayout,
|
|
35
35
|
type ResponsiveTabBarConfig,
|
|
36
|
-
} from
|
|
36
|
+
} from "./responsive";
|
|
37
37
|
import {
|
|
38
38
|
isSmallPhone,
|
|
39
39
|
isTablet,
|
|
@@ -41,8 +41,8 @@ import {
|
|
|
41
41
|
getDeviceType,
|
|
42
42
|
DeviceType,
|
|
43
43
|
getSpacingMultiplier,
|
|
44
|
-
} from
|
|
45
|
-
import { getMinTouchTarget } from
|
|
44
|
+
} from "../device/detection";
|
|
45
|
+
import { getMinTouchTarget } from "./platformConstants";
|
|
46
46
|
|
|
47
47
|
export interface UseResponsiveReturn {
|
|
48
48
|
// Device info
|
|
@@ -84,8 +84,13 @@ export interface UseResponsiveReturn {
|
|
|
84
84
|
bottomSheetLayout: ResponsiveBottomSheetLayout;
|
|
85
85
|
dialogLayout: ResponsiveDialogLayout;
|
|
86
86
|
|
|
87
|
-
//
|
|
88
|
-
|
|
87
|
+
// Onboarding specific responsive values
|
|
88
|
+
onboardingIconSize: number;
|
|
89
|
+
onboardingIconMarginTop: number;
|
|
90
|
+
onboardingIconMarginBottom: number;
|
|
91
|
+
onboardingTitleMarginBottom: number;
|
|
92
|
+
onboardingDescriptionMarginTop: number;
|
|
93
|
+
onboardingTextPadding: number;
|
|
89
94
|
|
|
90
95
|
// Utility functions
|
|
91
96
|
getLogoSize: (baseSize?: number) => number;
|
|
@@ -105,62 +110,87 @@ export const useResponsive = (): UseResponsiveReturn => {
|
|
|
105
110
|
const insets = useSafeAreaInsets();
|
|
106
111
|
|
|
107
112
|
// Memoize utility functions to prevent unnecessary re-renders
|
|
108
|
-
const getLogoSize = useCallback(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
113
|
+
const getLogoSize = useCallback(
|
|
114
|
+
(baseSize?: number) => getResponsiveLogoSize(baseSize),
|
|
115
|
+
[],
|
|
116
|
+
);
|
|
117
|
+
const getInputHeight = useCallback(
|
|
118
|
+
(baseHeight?: number) => getResponsiveInputHeight(baseHeight),
|
|
119
|
+
[],
|
|
120
|
+
);
|
|
121
|
+
const getIconSize = useCallback(
|
|
122
|
+
(baseSize?: number) => getResponsiveIconContainerSize(baseSize),
|
|
123
|
+
[],
|
|
124
|
+
);
|
|
125
|
+
const getMaxWidth = useCallback(
|
|
126
|
+
(baseWidth?: number) => getResponsiveMaxWidth(baseWidth),
|
|
127
|
+
[],
|
|
128
|
+
);
|
|
129
|
+
const getFontSize = useCallback(
|
|
130
|
+
(baseFontSize: number) => getResponsiveFontSize(baseFontSize),
|
|
131
|
+
[],
|
|
132
|
+
);
|
|
133
|
+
const getGridCols = useCallback(
|
|
134
|
+
(mobile?: number, tablet?: number) =>
|
|
135
|
+
getResponsiveGridColumns(mobile, tablet),
|
|
136
|
+
[],
|
|
137
|
+
);
|
|
114
138
|
|
|
115
139
|
// Memoize responsive values to prevent unnecessary recalculations
|
|
116
|
-
const responsiveValues = useMemo(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
140
|
+
const responsiveValues = useMemo(
|
|
141
|
+
() => ({
|
|
142
|
+
// Device info
|
|
143
|
+
width,
|
|
144
|
+
height,
|
|
145
|
+
isSmallDevice: isSmallPhone(),
|
|
146
|
+
isTabletDevice: isTablet(),
|
|
147
|
+
isLandscapeDevice: isLandscape(),
|
|
148
|
+
deviceType: getDeviceType(),
|
|
149
|
+
|
|
150
|
+
// Safe area insets
|
|
151
|
+
insets,
|
|
152
|
+
|
|
153
|
+
// Responsive sizes (with default values)
|
|
154
|
+
logoSize: getResponsiveLogoSize(),
|
|
155
|
+
inputHeight: getResponsiveInputHeight(),
|
|
156
|
+
iconContainerSize: getResponsiveIconContainerSize(),
|
|
157
|
+
maxContentWidth: getResponsiveMaxWidth(),
|
|
158
|
+
minTouchTarget: getMinTouchTarget(),
|
|
159
|
+
|
|
160
|
+
// Responsive positioning
|
|
161
|
+
horizontalPadding: getResponsiveHorizontalPadding(undefined, insets),
|
|
162
|
+
bottomPosition: getResponsiveBottomPosition(undefined, insets),
|
|
163
|
+
fabPosition: getResponsiveFABPosition(insets),
|
|
164
|
+
|
|
165
|
+
// Responsive layout
|
|
166
|
+
modalMaxHeight: getResponsiveModalMaxHeight(),
|
|
167
|
+
modalMinHeight: getResponsiveMinModalHeight(),
|
|
168
|
+
gridColumns: getResponsiveGridColumns(),
|
|
169
|
+
spacingMultiplier: getSpacingMultiplier(),
|
|
170
|
+
|
|
171
|
+
// Modal layouts (complete configurations)
|
|
172
|
+
modalLayout: getResponsiveModalLayout(),
|
|
173
|
+
bottomSheetLayout: getResponsiveBottomSheetLayout(),
|
|
174
|
+
dialogLayout: getResponsiveDialogLayout(),
|
|
175
|
+
|
|
176
|
+
// Onboarding specific responsive values
|
|
177
|
+
onboardingIconSize: getIconSize(64),
|
|
178
|
+
onboardingIconMarginTop: getSpacingMultiplier() * 24,
|
|
179
|
+
onboardingIconMarginBottom: getSpacingMultiplier() * 16,
|
|
180
|
+
onboardingTitleMarginBottom: getSpacingMultiplier() * 16,
|
|
181
|
+
onboardingDescriptionMarginTop: getSpacingMultiplier() * 12,
|
|
182
|
+
onboardingTextPadding: getSpacingMultiplier() * 20,
|
|
183
|
+
|
|
184
|
+
// Utility functions
|
|
185
|
+
getLogoSize,
|
|
186
|
+
getInputHeight,
|
|
187
|
+
getIconSize,
|
|
188
|
+
getMaxWidth,
|
|
189
|
+
getFontSize,
|
|
190
|
+
getGridCols,
|
|
191
|
+
}),
|
|
192
|
+
[width, height, insets],
|
|
193
|
+
);
|
|
162
194
|
|
|
163
195
|
return responsiveValues;
|
|
164
196
|
};
|
|
165
|
-
|
|
166
|
-
|