@momo-kits/foundation 0.92.7-rc.21 → 0.92.7-rc.22
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/Application/BottomSheet.tsx +216 -0
- package/Application/BottomTab/BottomTabBar.tsx +62 -223
- package/Application/BottomTab/index.tsx +15 -11
- package/Application/Components.tsx +291 -45
- package/Application/Localize.ts +44 -0
- package/Application/ModalScreen.tsx +11 -181
- package/Application/Navigation.ts +4 -18
- package/Application/NavigationContainer.tsx +10 -28
- package/Application/Navigator.ts +14 -16
- package/Application/StackScreen.tsx +222 -42
- package/Application/index.ts +5 -3
- package/Application/types.ts +47 -29
- package/Application/utils.tsx +61 -19
- package/Assets/icon_bank.json +1 -1
- package/Badge/BadgeDotAnimation.tsx +95 -0
- package/Badge/index.tsx +2 -1
- package/Badge/styles.ts +50 -6
- package/Button/index.tsx +7 -8
- package/Icon/index.tsx +1 -1
- package/Icon/types.ts +1 -2
- package/Image/index.tsx +0 -1
- package/Input/Input.tsx +51 -17
- package/Input/InputDropDown.tsx +42 -45
- package/Input/InputMoney.tsx +65 -6
- package/Input/InputOTP.tsx +14 -13
- package/Input/InputSearch.tsx +259 -146
- package/Input/InputTextArea.tsx +0 -1
- package/Input/TextTyping.tsx +113 -0
- package/Input/common.tsx +29 -10
- package/Input/index.tsx +84 -89
- package/Input/styles.ts +44 -7
- package/Input/utils.ts +1 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +3 -3
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +3 -2
- package/Layout/Screen.tsx +188 -102
- package/Layout/Section.tsx +4 -3
- package/Layout/styles.ts +0 -6
- package/Layout/types.ts +1 -1
- package/Layout/utils.ts +2 -2
- package/Loader/index.tsx +2 -0
- package/Pagination/PaginationScroll.tsx +2 -2
- package/Pagination/styles.ts +1 -1
- package/Popup/PopupNotify.tsx +7 -7
- package/Popup/PopupPromotion.tsx +1 -1
- package/Popup/types.ts +1 -1
- package/Tag/index.tsx +9 -2
- package/Tag/styles.ts +3 -2
- package/Tag/types.ts +12 -0
- package/Title/index.tsx +20 -7
- package/Title/styles.ts +4 -4
- package/code-scanner.js +141 -124
- package/index.ts +7 -0
- package/package.json +5 -4
- package/publish.sh +16 -21
- package/tsconfig.json +1 -1
package/Layout/Screen.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import React, {
|
|
|
3
3
|
forwardRef,
|
|
4
4
|
Fragment,
|
|
5
5
|
ReactNode,
|
|
6
|
+
Ref,
|
|
6
7
|
useContext,
|
|
7
8
|
useEffect,
|
|
8
9
|
useRef,
|
|
@@ -27,12 +28,16 @@ import Navigation from '../Application/Navigation';
|
|
|
27
28
|
import {AnimatedHeader, NavigationOptions} from '../Application/types';
|
|
28
29
|
import {Colors, Spacing, Styles} from '../Consts';
|
|
29
30
|
import {FloatingButton, FloatingButtonProps} from './FloatingButton';
|
|
30
|
-
import {Image} from '../Image';
|
|
31
31
|
import {Card, Section, validateChildren} from './index';
|
|
32
32
|
import styles from './styles';
|
|
33
33
|
import {HeaderType} from './types';
|
|
34
|
+
import {InputRef, InputSearchProps} from '../Input';
|
|
35
|
+
import {HeaderExtendHeader} from '../Application/Components';
|
|
34
36
|
|
|
35
37
|
export interface ScreenProps extends ViewProps {
|
|
38
|
+
/**
|
|
39
|
+
* ReactNode representing the content of the screen.
|
|
40
|
+
*/
|
|
36
41
|
children: React.ReactNode;
|
|
37
42
|
/**
|
|
38
43
|
* Optional. Navigation object for handling navigation actions.
|
|
@@ -90,13 +95,21 @@ export interface ScreenProps extends ViewProps {
|
|
|
90
95
|
floatingButtonProps?: Omit<FloatingButtonProps, 'animatedValue' | 'bottom'>;
|
|
91
96
|
|
|
92
97
|
/**
|
|
93
|
-
*
|
|
98
|
+
* Optional. Keyboard vertical offset.
|
|
94
99
|
*/
|
|
95
|
-
|
|
100
|
+
keyboardVerticalOffset?: number;
|
|
101
|
+
|
|
96
102
|
/**
|
|
97
103
|
* Optional. If `true`, the screen content is using grid layout by span.
|
|
98
104
|
*/
|
|
99
105
|
useGridLayout?: boolean;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Optional. specs for input search.
|
|
109
|
+
*/
|
|
110
|
+
inputSearchProps?: InputSearchProps;
|
|
111
|
+
|
|
112
|
+
inputSearchRef?: Ref<InputRef>;
|
|
100
113
|
}
|
|
101
114
|
|
|
102
115
|
const Screen = forwardRef(
|
|
@@ -115,36 +128,133 @@ const Screen = forwardRef(
|
|
|
115
128
|
headerType = 'default',
|
|
116
129
|
floatingButtonProps,
|
|
117
130
|
useGridLayout = true,
|
|
118
|
-
|
|
131
|
+
keyboardVerticalOffset,
|
|
132
|
+
inputSearchProps,
|
|
133
|
+
inputSearchRef,
|
|
119
134
|
}: ScreenProps,
|
|
120
|
-
ref
|
|
135
|
+
ref: any
|
|
121
136
|
) => {
|
|
122
|
-
const animatedValue = useRef<Animated.Value>(
|
|
123
|
-
animated ?? new Animated.Value(0),
|
|
124
|
-
);
|
|
125
137
|
const {theme} = useContext(ApplicationContext);
|
|
126
138
|
const insets = useSafeAreaInsets();
|
|
127
139
|
const heightHeader = useHeaderHeight();
|
|
140
|
+
const animatedValue = useRef<Animated.Value>(new Animated.Value(0));
|
|
128
141
|
const currentTint = useRef(Colors.black_01);
|
|
129
|
-
const isTab = navigation?.instance?.getState?.()?.type
|
|
142
|
+
const isTab = navigation?.instance?.getState?.()?.type === 'tab';
|
|
130
143
|
|
|
131
|
-
let styleAnimatedHeader: NavigationOptions;
|
|
132
144
|
let handleScroll;
|
|
133
|
-
let headerBackground: string | undefined = undefined;
|
|
134
145
|
let Component: any = View;
|
|
135
|
-
let
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
keyboardVerticalOffset = -20;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (headerType == 'extended') {
|
|
142
|
-
headerBackground = theme.assets?.headerBackground;
|
|
146
|
+
let keyboardOffset = heightHeader - 20;
|
|
147
|
+
if (headerType === 'extended' || animatedHeader || inputSearchProps) {
|
|
148
|
+
keyboardOffset = -20;
|
|
143
149
|
}
|
|
144
150
|
|
|
145
151
|
useEffect(() => {
|
|
152
|
+
let options: NavigationOptions;
|
|
153
|
+
/**
|
|
154
|
+
* handle for basic header type
|
|
155
|
+
*/
|
|
156
|
+
switch (headerType) {
|
|
157
|
+
case 'none':
|
|
158
|
+
options = {
|
|
159
|
+
headerTransparent: true,
|
|
160
|
+
headerBackground: () => null,
|
|
161
|
+
headerShown: false,
|
|
162
|
+
};
|
|
163
|
+
break;
|
|
164
|
+
|
|
165
|
+
case 'surface':
|
|
166
|
+
options = {
|
|
167
|
+
headerTransparent: false,
|
|
168
|
+
headerShown: true,
|
|
169
|
+
headerTintColor: theme.colors.text.default,
|
|
170
|
+
headerBackground: (props: any) => (
|
|
171
|
+
<HeaderBackground {...props} image={null} useSurface={true} />
|
|
172
|
+
),
|
|
173
|
+
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
174
|
+
};
|
|
175
|
+
if (inputSearchProps) {
|
|
176
|
+
options = {
|
|
177
|
+
headerShown: true,
|
|
178
|
+
headerTransparent: true,
|
|
179
|
+
headerTintColor: theme.colors.text.default,
|
|
180
|
+
headerBackground: () => null,
|
|
181
|
+
headerTitle: (props: any) => (
|
|
182
|
+
<HeaderTitle
|
|
183
|
+
{...props}
|
|
184
|
+
interpolate={{
|
|
185
|
+
inputRange: [0, 50],
|
|
186
|
+
outputRange: [1, 0],
|
|
187
|
+
extrapolate: 'clamp',
|
|
188
|
+
}}
|
|
189
|
+
animatedValue={animatedValue.current}
|
|
190
|
+
/>
|
|
191
|
+
),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
|
|
196
|
+
case 'extended':
|
|
197
|
+
options = {
|
|
198
|
+
headerShown: true,
|
|
199
|
+
headerTransparent: true,
|
|
200
|
+
headerTintColor: Colors.black_01,
|
|
201
|
+
headerBackground: () => null,
|
|
202
|
+
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
203
|
+
};
|
|
204
|
+
if (inputSearchProps) {
|
|
205
|
+
options = {
|
|
206
|
+
headerShown: true,
|
|
207
|
+
headerTransparent: true,
|
|
208
|
+
headerTintColor: Colors.black_01,
|
|
209
|
+
headerBackground: () => null,
|
|
210
|
+
headerTitle: (props: any) => (
|
|
211
|
+
<HeaderTitle
|
|
212
|
+
{...props}
|
|
213
|
+
interpolate={{
|
|
214
|
+
inputRange: [0, 50],
|
|
215
|
+
outputRange: [1, 0],
|
|
216
|
+
extrapolate: 'clamp',
|
|
217
|
+
}}
|
|
218
|
+
animatedValue={animatedValue.current}
|
|
219
|
+
/>
|
|
220
|
+
),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
|
|
225
|
+
default:
|
|
226
|
+
options = {
|
|
227
|
+
headerTransparent: false,
|
|
228
|
+
headerShown: true,
|
|
229
|
+
headerTintColor: Colors.black_01,
|
|
230
|
+
headerBackground: (props: any) => <HeaderBackground {...props} />,
|
|
231
|
+
};
|
|
232
|
+
if (inputSearchProps) {
|
|
233
|
+
options = {
|
|
234
|
+
headerShown: true,
|
|
235
|
+
headerTransparent: true,
|
|
236
|
+
headerTintColor: Colors.black_01,
|
|
237
|
+
headerBackground: () => null,
|
|
238
|
+
headerTitle: (props: any) => (
|
|
239
|
+
<HeaderTitle
|
|
240
|
+
{...props}
|
|
241
|
+
interpolate={{
|
|
242
|
+
inputRange: [0, 50],
|
|
243
|
+
outputRange: [1, 0],
|
|
244
|
+
extrapolate: 'clamp',
|
|
245
|
+
}}
|
|
246
|
+
animatedValue={animatedValue.current}
|
|
247
|
+
/>
|
|
248
|
+
),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* override options for animated header
|
|
255
|
+
*/
|
|
146
256
|
if (animatedHeader) {
|
|
147
|
-
|
|
257
|
+
options = {
|
|
148
258
|
headerTransparent: true,
|
|
149
259
|
headerBackground: (props: any) => (
|
|
150
260
|
<HeaderBackground
|
|
@@ -156,9 +266,9 @@ const Screen = forwardRef(
|
|
|
156
266
|
<HeaderTitle {...props} animatedValue={animatedValue.current} />
|
|
157
267
|
),
|
|
158
268
|
};
|
|
159
|
-
if (animatedHeader.type
|
|
160
|
-
|
|
161
|
-
...
|
|
269
|
+
if (animatedHeader.type === 'surface') {
|
|
270
|
+
options = {
|
|
271
|
+
...options,
|
|
162
272
|
headerBackground: (props: any) => (
|
|
163
273
|
<HeaderBackground
|
|
164
274
|
{...props}
|
|
@@ -170,8 +280,8 @@ const Screen = forwardRef(
|
|
|
170
280
|
};
|
|
171
281
|
}
|
|
172
282
|
if (animatedHeader.headerTitle) {
|
|
173
|
-
|
|
174
|
-
...
|
|
283
|
+
options = {
|
|
284
|
+
...options,
|
|
175
285
|
headerTitle: (props: any) =>
|
|
176
286
|
animatedHeader.headerTitle?.({
|
|
177
287
|
...props,
|
|
@@ -179,55 +289,10 @@ const Screen = forwardRef(
|
|
|
179
289
|
}),
|
|
180
290
|
};
|
|
181
291
|
}
|
|
182
|
-
navigation?.setOptions(styleAnimatedHeader);
|
|
183
292
|
}
|
|
184
|
-
}, [animatedHeader]);
|
|
185
|
-
|
|
186
|
-
useEffect(() => {
|
|
187
|
-
if (!animatedHeader) {
|
|
188
|
-
let headerOptions: NavigationOptions;
|
|
189
|
-
switch (headerType) {
|
|
190
|
-
case 'none':
|
|
191
|
-
headerOptions = {
|
|
192
|
-
headerTransparent: true,
|
|
193
|
-
headerBackground: () => null,
|
|
194
|
-
headerShown: false,
|
|
195
|
-
};
|
|
196
|
-
break;
|
|
197
|
-
|
|
198
|
-
case 'surface':
|
|
199
|
-
headerOptions = {
|
|
200
|
-
headerTransparent: false,
|
|
201
|
-
headerShown: true,
|
|
202
|
-
headerTintColor: theme.colors.text.default,
|
|
203
|
-
headerBackground: (props: any) => (
|
|
204
|
-
<HeaderBackground {...props} image={null} useSurface={true} />
|
|
205
|
-
),
|
|
206
|
-
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
207
|
-
};
|
|
208
|
-
break;
|
|
209
293
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
headerShown: true,
|
|
213
|
-
headerTransparent: true,
|
|
214
|
-
headerTintColor: Colors.black_01,
|
|
215
|
-
headerBackground: () => null,
|
|
216
|
-
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
217
|
-
};
|
|
218
|
-
break;
|
|
219
|
-
|
|
220
|
-
default:
|
|
221
|
-
headerOptions = {
|
|
222
|
-
headerTransparent: false,
|
|
223
|
-
headerShown: true,
|
|
224
|
-
headerTintColor: Colors.black_01,
|
|
225
|
-
headerBackground: (props: any) => <HeaderBackground {...props} />,
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
navigation?.setOptions(headerOptions);
|
|
229
|
-
}
|
|
230
|
-
}, [headerType]);
|
|
294
|
+
navigation?.setOptions(options);
|
|
295
|
+
}, [headerType, animatedHeader, inputSearchProps]);
|
|
231
296
|
|
|
232
297
|
/**
|
|
233
298
|
* animated when use scroll && animated value
|
|
@@ -235,7 +300,7 @@ const Screen = forwardRef(
|
|
|
235
300
|
if (scrollable) {
|
|
236
301
|
Component = Animated.ScrollView;
|
|
237
302
|
handleScroll = scrollViewProps?.onScroll;
|
|
238
|
-
if (animatedHeader || floatingButtonProps) {
|
|
303
|
+
if (animatedHeader || floatingButtonProps?.icon || inputSearchProps) {
|
|
239
304
|
handleScroll = Animated.event(
|
|
240
305
|
[
|
|
241
306
|
{
|
|
@@ -248,13 +313,13 @@ const Screen = forwardRef(
|
|
|
248
313
|
useNativeDriver: true,
|
|
249
314
|
listener: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
250
315
|
scrollViewProps?.onScroll?.(e);
|
|
251
|
-
if (animatedHeader?.type
|
|
316
|
+
if (animatedHeader?.type === 'surface') {
|
|
252
317
|
const offsetY = e.nativeEvent.contentOffset.y;
|
|
253
318
|
let color = Colors.black_01;
|
|
254
319
|
if (offsetY > 50) {
|
|
255
320
|
color = theme.colors.text.default;
|
|
256
321
|
}
|
|
257
|
-
if (color
|
|
322
|
+
if (color !== currentTint.current) {
|
|
258
323
|
currentTint.current = color;
|
|
259
324
|
navigation?.setOptions({
|
|
260
325
|
headerTintColor: color,
|
|
@@ -262,31 +327,52 @@ const Screen = forwardRef(
|
|
|
262
327
|
}
|
|
263
328
|
}
|
|
264
329
|
},
|
|
265
|
-
}
|
|
330
|
+
}
|
|
266
331
|
);
|
|
267
332
|
}
|
|
268
333
|
}
|
|
269
334
|
|
|
335
|
+
/**
|
|
336
|
+
* handle scroll end
|
|
337
|
+
* @param e
|
|
338
|
+
*/
|
|
339
|
+
const handleScrollEnd = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
340
|
+
const offsetY = e.nativeEvent.contentOffset.y;
|
|
341
|
+
if (inputSearchProps && offsetY < 100 && offsetY > 0) {
|
|
342
|
+
Animated.timing(animatedValue.current, {
|
|
343
|
+
toValue: 0,
|
|
344
|
+
useNativeDriver: true,
|
|
345
|
+
duration: 300,
|
|
346
|
+
}).start();
|
|
347
|
+
ref?.scrollTo({y: 0, animated: true});
|
|
348
|
+
}
|
|
349
|
+
scrollViewProps?.onScrollEndDrag?.(e);
|
|
350
|
+
};
|
|
351
|
+
|
|
270
352
|
/**
|
|
271
353
|
* render top navigation banner
|
|
272
354
|
*/
|
|
273
|
-
const
|
|
355
|
+
const renderAnimatedHeader = () => {
|
|
274
356
|
if (typeof animatedHeader?.component === 'function') {
|
|
275
|
-
return
|
|
276
|
-
|
|
277
|
-
|
|
357
|
+
return (
|
|
358
|
+
<View style={[styles.screenBanner, {maxHeight: 210 + layoutOffset}]}>
|
|
359
|
+
{animatedHeader?.component({
|
|
360
|
+
animatedValue: animatedValue.current,
|
|
361
|
+
})}
|
|
362
|
+
</View>
|
|
363
|
+
);
|
|
278
364
|
}
|
|
279
365
|
};
|
|
280
366
|
|
|
281
367
|
/**
|
|
282
|
-
* build content for screen
|
|
368
|
+
* build content for screen for grid rule
|
|
283
369
|
*/
|
|
284
370
|
const renderContent = (children: any): any => {
|
|
285
371
|
const results = validateChildren(children, [Section, Card, undefined]);
|
|
286
372
|
if (Array.isArray(results)) {
|
|
287
373
|
return results.map((item, index) => {
|
|
288
374
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
289
|
-
if (item?.type
|
|
375
|
+
if (item?.type === Fragment) {
|
|
290
376
|
return renderContent(item?.props?.children);
|
|
291
377
|
}
|
|
292
378
|
if (item) {
|
|
@@ -296,7 +382,8 @@ const Screen = forwardRef(
|
|
|
296
382
|
style={{
|
|
297
383
|
marginTop: space,
|
|
298
384
|
flex: item.props?.expanded ? 1 : undefined,
|
|
299
|
-
}}
|
|
385
|
+
}}
|
|
386
|
+
onLayout={item.props?.onLayout}>
|
|
300
387
|
{item}
|
|
301
388
|
</View>
|
|
302
389
|
);
|
|
@@ -305,7 +392,7 @@ const Screen = forwardRef(
|
|
|
305
392
|
} else {
|
|
306
393
|
const item: any = children;
|
|
307
394
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
308
|
-
if (item?.type
|
|
395
|
+
if (item?.type === Fragment) {
|
|
309
396
|
return renderContent(item?.props?.children);
|
|
310
397
|
}
|
|
311
398
|
return (
|
|
@@ -314,7 +401,8 @@ const Screen = forwardRef(
|
|
|
314
401
|
style={{
|
|
315
402
|
marginTop: space,
|
|
316
403
|
flex: item?.props?.expanded ? 1 : undefined,
|
|
317
|
-
}}
|
|
404
|
+
}}
|
|
405
|
+
onLayout={item?.props?.onLayout}>
|
|
318
406
|
{children}
|
|
319
407
|
</View>
|
|
320
408
|
);
|
|
@@ -323,21 +411,19 @@ const Screen = forwardRef(
|
|
|
323
411
|
|
|
324
412
|
return (
|
|
325
413
|
<View style={[Styles.flex, {backgroundColor}]}>
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
</>
|
|
336
|
-
)}
|
|
414
|
+
<HeaderExtendHeader
|
|
415
|
+
headerType={headerType}
|
|
416
|
+
heightHeader={heightHeader}
|
|
417
|
+
animatedValue={animatedValue.current}
|
|
418
|
+
inputSearchProps={inputSearchProps}
|
|
419
|
+
navigation={navigation}
|
|
420
|
+
inputSearchRef={inputSearchRef}
|
|
421
|
+
/>
|
|
422
|
+
|
|
337
423
|
<KeyboardAvoidingView
|
|
338
424
|
style={Styles.flex}
|
|
339
425
|
enabled={enableKeyboardAvoidingView}
|
|
340
|
-
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
426
|
+
keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
|
|
341
427
|
behavior={Platform.select({
|
|
342
428
|
ios: 'padding',
|
|
343
429
|
android: undefined,
|
|
@@ -349,11 +435,11 @@ const Screen = forwardRef(
|
|
|
349
435
|
ref={ref}
|
|
350
436
|
showsVerticalScrollIndicator={false}
|
|
351
437
|
onScroll={handleScroll}
|
|
438
|
+
onScrollEndDrag={handleScrollEnd}
|
|
439
|
+
scrollEventThrottle={16}
|
|
352
440
|
style={Styles.flex}>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
{renderHeader()}
|
|
356
|
-
</View>
|
|
441
|
+
{renderAnimatedHeader()}
|
|
442
|
+
|
|
357
443
|
{useGridLayout ? renderContent(children) : children}
|
|
358
444
|
</Component>
|
|
359
445
|
|
|
@@ -384,7 +470,7 @@ const Screen = forwardRef(
|
|
|
384
470
|
</KeyboardAvoidingView>
|
|
385
471
|
</View>
|
|
386
472
|
);
|
|
387
|
-
}
|
|
473
|
+
}
|
|
388
474
|
);
|
|
389
475
|
|
|
390
476
|
export default Screen;
|
package/Layout/Section.tsx
CHANGED
|
@@ -85,7 +85,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
85
85
|
{rows.map((i: React.ReactElement, index: number) => {
|
|
86
86
|
return (
|
|
87
87
|
<View key={`Card${cursor}${index}`} style={{flexDirection: 'row'}}>
|
|
88
|
-
{index
|
|
88
|
+
{index !== 0 && (
|
|
89
89
|
<View style={{width: gridContext.gutterSize}}></View>
|
|
90
90
|
)}
|
|
91
91
|
{i}
|
|
@@ -125,14 +125,14 @@ const Section: React.FC<SectionProps> = ({
|
|
|
125
125
|
rows = [item];
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
if (i
|
|
128
|
+
if (i === arrayChild.length - 1) {
|
|
129
129
|
cursor += 1;
|
|
130
130
|
element.push(addRowView(rows, cursor, true));
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
} else {
|
|
134
134
|
element.push(children);
|
|
135
|
-
if (children?.type
|
|
135
|
+
if (children?.type === Fragment) {
|
|
136
136
|
return renderView(children?.props.children);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -151,6 +151,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
151
151
|
}}>
|
|
152
152
|
<View
|
|
153
153
|
{...props}
|
|
154
|
+
onLayout={undefined}
|
|
154
155
|
style={[
|
|
155
156
|
style,
|
|
156
157
|
styles.protectedStyle,
|
package/Layout/styles.ts
CHANGED
|
@@ -2,12 +2,6 @@ import {Platform, StyleSheet} from 'react-native';
|
|
|
2
2
|
import {Colors, Radius, Spacing} from '../Consts';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
|
-
extendedHeader: {
|
|
6
|
-
aspectRatio: 1.75,
|
|
7
|
-
position: 'absolute',
|
|
8
|
-
width: '100%',
|
|
9
|
-
height: 210,
|
|
10
|
-
},
|
|
11
5
|
screenBanner: {
|
|
12
6
|
width: '100%',
|
|
13
7
|
},
|
package/Layout/types.ts
CHANGED
package/Layout/utils.ts
CHANGED
|
@@ -12,7 +12,7 @@ const validateChildren = (
|
|
|
12
12
|
) => {
|
|
13
13
|
const validateType = (child: React.ReactElement) => {
|
|
14
14
|
const valid = childrenTypes.some(
|
|
15
|
-
childrenType => child?.type === childrenType || child?.type
|
|
15
|
+
childrenType => child?.type === childrenType || child?.type === Fragment,
|
|
16
16
|
);
|
|
17
17
|
if (!valid) {
|
|
18
18
|
console.warn(
|
|
@@ -42,7 +42,7 @@ const useGridSystem = () => {
|
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
const subscription: any = Dimensions.addEventListener('change', () => {
|
|
44
44
|
const newColumns = Dimensions.get('window').width > 600 ? 24 : 12;
|
|
45
|
-
if (newColumns
|
|
45
|
+
if (newColumns !== numberOfColumns) {
|
|
46
46
|
setNumberOfColumns(newColumns);
|
|
47
47
|
}
|
|
48
48
|
});
|
package/Loader/index.tsx
CHANGED
|
@@ -42,7 +42,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
],
|
|
45
|
-
{useNativeDriver: true}
|
|
45
|
+
{useNativeDriver: true}
|
|
46
46
|
)}
|
|
47
47
|
alwaysBounceHorizontal={false}
|
|
48
48
|
showsHorizontalScrollIndicator={false}
|
|
@@ -80,7 +80,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
80
80
|
return (
|
|
81
81
|
<View style={[style, styles.scrollContainer]}>
|
|
82
82
|
{renderScrollView()}
|
|
83
|
-
{renderIndicator()}
|
|
83
|
+
{scrollContentWidth > scrollViewWidth && renderIndicator()}
|
|
84
84
|
</View>
|
|
85
85
|
);
|
|
86
86
|
};
|
package/Pagination/styles.ts
CHANGED
|
@@ -29,7 +29,6 @@ export default StyleSheet.create({
|
|
|
29
29
|
justifyContent: 'center',
|
|
30
30
|
},
|
|
31
31
|
scrollContainer: {
|
|
32
|
-
alignItems: 'center',
|
|
33
32
|
width: '100%',
|
|
34
33
|
},
|
|
35
34
|
scrollView: {
|
|
@@ -42,6 +41,7 @@ export default StyleSheet.create({
|
|
|
42
41
|
borderRadius: Radius.XS,
|
|
43
42
|
},
|
|
44
43
|
indicatorContainer: {
|
|
44
|
+
alignSelf: 'center',
|
|
45
45
|
width: 72,
|
|
46
46
|
height: 4,
|
|
47
47
|
borderRadius: Radius.XS,
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {Button} from '../Button';
|
|
|
5
5
|
import {Radius, Spacing, Styles} from '../Consts';
|
|
6
6
|
import {Icon} from '../Icon';
|
|
7
7
|
import {Image} from '../Image';
|
|
8
|
-
import {Text} from '../Text';
|
|
8
|
+
import {scaleSize, Text} from '../Text';
|
|
9
9
|
import {PopupNotifyProps} from './types';
|
|
10
10
|
|
|
11
11
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
@@ -27,7 +27,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
27
27
|
let Description: any = View;
|
|
28
28
|
if (scrollContent) {
|
|
29
29
|
Description = ScrollView;
|
|
30
|
-
descriptionStyle = {
|
|
30
|
+
descriptionStyle = {maxHeight: scaleSize(172)};
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* tracking
|
|
@@ -139,7 +139,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
139
139
|
);
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
-
if (buttonDirection
|
|
142
|
+
if (buttonDirection === 'auto') {
|
|
143
143
|
if (
|
|
144
144
|
secondary?.title &&
|
|
145
145
|
(secondary.title.length > 12 || primary.title.length > 12)
|
|
@@ -148,7 +148,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
148
148
|
}
|
|
149
149
|
return renderRow();
|
|
150
150
|
}
|
|
151
|
-
if (buttonDirection
|
|
151
|
+
if (buttonDirection === 'row') {
|
|
152
152
|
return renderRow();
|
|
153
153
|
}
|
|
154
154
|
return renderColumn();
|
|
@@ -188,14 +188,14 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
188
188
|
|
|
189
189
|
return (
|
|
190
190
|
<View
|
|
191
|
-
accessibilityLabel={'
|
|
191
|
+
accessibilityLabel={'popup_notify'}
|
|
192
192
|
style={[
|
|
193
193
|
styles.container,
|
|
194
194
|
{backgroundColor: theme.colors.background.surface},
|
|
195
195
|
]}>
|
|
196
196
|
{!!image && <Image source={{uri: image}} style={styles.image} />}
|
|
197
197
|
<View style={styles.content}>
|
|
198
|
-
<Text typography={'header_default_bold'} numberOfLines={
|
|
198
|
+
<Text typography={'header_default_bold'} numberOfLines={3}>
|
|
199
199
|
{title}
|
|
200
200
|
</Text>
|
|
201
201
|
<Description style={[styles.description, descriptionStyle]}>
|
|
@@ -204,7 +204,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
204
204
|
typography={'body_default_regular'}
|
|
205
205
|
onTextLayout={({nativeEvent: {lines}}) => {
|
|
206
206
|
const enableScroll = lines.length > 3;
|
|
207
|
-
if (enableScroll
|
|
207
|
+
if (enableScroll !== scrollContent) {
|
|
208
208
|
setScrollContent(enableScroll);
|
|
209
209
|
}
|
|
210
210
|
}}>
|
package/Popup/PopupPromotion.tsx
CHANGED
package/Popup/types.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type PopupNotifyProps = {
|
|
|
18
18
|
/**
|
|
19
19
|
* `description`: Represents the description text to be displayed in the PopupNotify component.
|
|
20
20
|
*/
|
|
21
|
-
description
|
|
21
|
+
description?: string | React.ReactNode;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* `error`: Optional. Represents additional error text to be displayed in the PopupNotify component.
|
package/Tag/index.tsx
CHANGED
|
@@ -31,6 +31,8 @@ const Tag: FC<TagProps> = ({
|
|
|
31
31
|
size = 'large',
|
|
32
32
|
style,
|
|
33
33
|
customColor,
|
|
34
|
+
accessibilityLabelContainer,
|
|
35
|
+
accessibilityLabelText,
|
|
34
36
|
}) => {
|
|
35
37
|
let labelColor = textColor[color];
|
|
36
38
|
let tagColor = backgroundColor[color];
|
|
@@ -60,7 +62,9 @@ const Tag: FC<TagProps> = ({
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
return (
|
|
63
|
-
<View
|
|
65
|
+
<View
|
|
66
|
+
style={[style, sizeStyle, {backgroundColor: tagColor}]}
|
|
67
|
+
accessibilityLabel={accessibilityLabelContainer}>
|
|
64
68
|
{!!icon && (
|
|
65
69
|
<Icon
|
|
66
70
|
style={styles.icon}
|
|
@@ -69,7 +73,10 @@ const Tag: FC<TagProps> = ({
|
|
|
69
73
|
color={labelColor}
|
|
70
74
|
/>
|
|
71
75
|
)}
|
|
72
|
-
<Text
|
|
76
|
+
<Text
|
|
77
|
+
color={labelColor}
|
|
78
|
+
typography={'label_s_medium'}
|
|
79
|
+
accessibilityLabel={accessibilityLabelText}>
|
|
73
80
|
{label}
|
|
74
81
|
</Text>
|
|
75
82
|
</View>
|