@umituz/react-native-design-system 2.3.4 → 2.3.6
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.3.
|
|
3
|
+
"version": "2.3.6",
|
|
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",
|
|
@@ -60,6 +60,10 @@ export interface AtomicInputProps {
|
|
|
60
60
|
onBlur?: () => void;
|
|
61
61
|
/** Focus callback */
|
|
62
62
|
onFocus?: () => void;
|
|
63
|
+
/** Multiline input support */
|
|
64
|
+
multiline?: boolean;
|
|
65
|
+
/** Number of lines for multiline input */
|
|
66
|
+
numberOfLines?: number;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
/**
|
|
@@ -99,6 +103,8 @@ export const AtomicInput: React.FC<AtomicInputProps> = ({
|
|
|
99
103
|
testID,
|
|
100
104
|
onBlur,
|
|
101
105
|
onFocus,
|
|
106
|
+
multiline = false,
|
|
107
|
+
numberOfLines,
|
|
102
108
|
}) => {
|
|
103
109
|
const tokens = useAppDesignTokens();
|
|
104
110
|
|
|
@@ -202,6 +208,8 @@ export const AtomicInput: React.FC<AtomicInputProps> = ({
|
|
|
202
208
|
autoCapitalize={autoCapitalize}
|
|
203
209
|
autoCorrect={autoCorrect}
|
|
204
210
|
editable={!isDisabled}
|
|
211
|
+
multiline={multiline}
|
|
212
|
+
numberOfLines={numberOfLines}
|
|
205
213
|
style={textInputStyle}
|
|
206
214
|
onBlur={() => {
|
|
207
215
|
setIsFocused(false);
|
|
@@ -24,10 +24,13 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import React, { useMemo } from 'react';
|
|
27
|
-
import { View, ScrollView, StyleSheet, type ViewStyle } from 'react-native';
|
|
28
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
27
|
+
import { View, ScrollView, StyleSheet, type ViewStyle, RefreshControlProps } from 'react-native';
|
|
28
|
+
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
29
29
|
import type { Edge } from 'react-native-safe-area-context';
|
|
30
30
|
import { useAppDesignTokens } from '../theme';
|
|
31
|
+
import { useResponsive } from '../responsive/useResponsive';
|
|
32
|
+
import { getResponsiveMaxWidth } from '../responsive/responsiveSizing';
|
|
33
|
+
import { getResponsiveHorizontalPadding } from '../responsive/responsiveLayout';
|
|
31
34
|
|
|
32
35
|
/**
|
|
33
36
|
* NOTE: This component now works in conjunction with the SafeAreaProvider
|
|
@@ -124,6 +127,20 @@ export interface ScreenLayoutProps {
|
|
|
124
127
|
*/
|
|
125
128
|
accessible?: boolean;
|
|
126
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Enable responsive content width and centering (default: true)
|
|
132
|
+
*/
|
|
133
|
+
responsiveEnabled?: boolean;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Maximum content width override
|
|
137
|
+
*/
|
|
138
|
+
maxWidth?: number;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* RefreshControl component for pull-to-refresh
|
|
142
|
+
*/
|
|
143
|
+
refreshControl?: React.ReactElement<RefreshControlProps>;
|
|
127
144
|
}
|
|
128
145
|
|
|
129
146
|
export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
|
|
@@ -138,25 +155,41 @@ export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
|
|
|
138
155
|
testID,
|
|
139
156
|
hideScrollIndicator = false,
|
|
140
157
|
keyboardAvoiding = false,
|
|
158
|
+
responsiveEnabled = true,
|
|
159
|
+
maxWidth,
|
|
160
|
+
refreshControl,
|
|
141
161
|
}) => {
|
|
142
162
|
// Automatically uses current theme from global store
|
|
143
163
|
const tokens = useAppDesignTokens();
|
|
164
|
+
const { isTabletDevice } = useResponsive();
|
|
165
|
+
const insets = useSafeAreaInsets();
|
|
166
|
+
|
|
167
|
+
const finalMaxWidth = maxWidth || (responsiveEnabled ? getResponsiveMaxWidth() : undefined);
|
|
168
|
+
const horizontalPadding = responsiveEnabled ? getResponsiveHorizontalPadding(tokens.spacing.md, insets) : tokens.spacing.md;
|
|
169
|
+
|
|
144
170
|
const styles = useMemo(() => StyleSheet.create({
|
|
145
171
|
container: {
|
|
146
172
|
flex: 1,
|
|
147
173
|
},
|
|
174
|
+
responsiveWrapper: {
|
|
175
|
+
flex: 1,
|
|
176
|
+
width: '100%',
|
|
177
|
+
maxWidth: finalMaxWidth,
|
|
178
|
+
alignSelf: 'center',
|
|
179
|
+
},
|
|
148
180
|
content: {
|
|
149
181
|
flex: 1,
|
|
182
|
+
paddingHorizontal: horizontalPadding,
|
|
150
183
|
},
|
|
151
184
|
scrollView: {
|
|
152
185
|
flex: 1,
|
|
153
186
|
},
|
|
154
187
|
scrollContent: {
|
|
155
188
|
flexGrow: 1,
|
|
156
|
-
paddingHorizontal:
|
|
189
|
+
paddingHorizontal: horizontalPadding,
|
|
157
190
|
paddingBottom: tokens.spacing.lg,
|
|
158
191
|
},
|
|
159
|
-
}), [tokens]);
|
|
192
|
+
}), [tokens, finalMaxWidth, horizontalPadding]);
|
|
160
193
|
|
|
161
194
|
const bgColor = backgroundColor || tokens.colors.backgroundPrimary;
|
|
162
195
|
|
|
@@ -168,11 +201,13 @@ export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
|
|
|
168
201
|
edges={edges}
|
|
169
202
|
testID={testID}
|
|
170
203
|
>
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
{
|
|
204
|
+
<View style={styles.responsiveWrapper}>
|
|
205
|
+
{header}
|
|
206
|
+
<View style={[styles.content, contentContainerStyle]}>
|
|
207
|
+
{children}
|
|
208
|
+
</View>
|
|
209
|
+
{footer}
|
|
174
210
|
</View>
|
|
175
|
-
{footer}
|
|
176
211
|
</SafeAreaView>
|
|
177
212
|
);
|
|
178
213
|
}
|
|
@@ -184,16 +219,19 @@ export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
|
|
|
184
219
|
edges={edges}
|
|
185
220
|
testID={testID}
|
|
186
221
|
>
|
|
187
|
-
{
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
222
|
+
<View style={styles.responsiveWrapper}>
|
|
223
|
+
{header}
|
|
224
|
+
<ScrollView
|
|
225
|
+
style={styles.scrollView}
|
|
226
|
+
contentContainerStyle={[styles.scrollContent, contentContainerStyle]}
|
|
227
|
+
showsVerticalScrollIndicator={!hideScrollIndicator}
|
|
228
|
+
keyboardShouldPersistTaps={keyboardAvoiding ? 'handled' : 'never'}
|
|
229
|
+
refreshControl={refreshControl}
|
|
230
|
+
>
|
|
231
|
+
{children}
|
|
232
|
+
</ScrollView>
|
|
233
|
+
{footer}
|
|
234
|
+
</View>
|
|
197
235
|
</SafeAreaView>
|
|
198
236
|
);
|
|
199
237
|
};
|