@momo-kits/foundation 0.92.21 → 0.92.23
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 +6 -5
- package/Application/BottomTab/BottomTabBar.tsx +2 -2
- package/Application/BottomTab/index.tsx +1 -2
- package/Application/Components.tsx +107 -34
- package/Application/ModalScreen.tsx +2 -2
- package/Application/Navigation.ts +4 -18
- package/Application/StackScreen.tsx +2 -2
- package/Application/index.ts +0 -2
- package/Application/types.ts +25 -8
- package/Application/utils.tsx +64 -18
- package/Button/index.tsx +0 -1
- package/Icon/types.ts +1 -0
- package/Input/InputDropDown.tsx +2 -2
- package/Input/InputMoney.tsx +3 -3
- package/Input/InputOTP.tsx +4 -4
- package/Input/InputSearch.tsx +249 -144
- package/Input/TextTyping.tsx +113 -0
- package/Input/index.tsx +19 -1
- package/Input/styles.ts +10 -3
- package/Layout/AnimatedInputSearch.tsx +66 -0
- package/Layout/FloatingButton.tsx +1 -1
- package/Layout/Screen.tsx +122 -87
- package/Layout/styles.ts +0 -6
- package/Layout/types.ts +20 -1
- package/Title/index.tsx +9 -6
- package/package.json +1 -1
|
@@ -88,14 +88,15 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
88
88
|
if (barrierDismissible && !force) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
navigator?.pop();
|
|
93
|
+
callback?.();
|
|
94
|
+
}, 300);
|
|
91
95
|
Animated.timing(pan, {
|
|
92
96
|
toValue: {x: 0, y: heightDevice},
|
|
93
97
|
useNativeDriver: false,
|
|
94
|
-
duration:
|
|
95
|
-
}).start(
|
|
96
|
-
navigator?.pop();
|
|
97
|
-
callback?.();
|
|
98
|
-
});
|
|
98
|
+
duration: 200,
|
|
99
|
+
}).start();
|
|
99
100
|
};
|
|
100
101
|
|
|
101
102
|
/**
|
|
@@ -125,7 +125,7 @@ export default function BottomTabBar({
|
|
|
125
125
|
);
|
|
126
126
|
});
|
|
127
127
|
},
|
|
128
|
-
[JSON.stringify(routes), state, descriptors, focusedTab]
|
|
128
|
+
[JSON.stringify(routes), state, descriptors, focusedTab],
|
|
129
129
|
);
|
|
130
130
|
|
|
131
131
|
/**
|
|
@@ -153,7 +153,7 @@ export default function BottomTabBar({
|
|
|
153
153
|
</View>
|
|
154
154
|
<View
|
|
155
155
|
style={{
|
|
156
|
-
top: -
|
|
156
|
+
top: -6,
|
|
157
157
|
backgroundColor: activeTintColor ?? theme.colors.primary,
|
|
158
158
|
borderRadius: Radius.XL,
|
|
159
159
|
paddingHorizontal: 6,
|
|
@@ -17,10 +17,9 @@ const Tab = createBottomTabNavigator();
|
|
|
17
17
|
const Stack = createStackNavigator();
|
|
18
18
|
|
|
19
19
|
const TabScreen: React.FC<NavigationScreenProps> = ({route}) => {
|
|
20
|
-
const {theme} = useContext(ApplicationContext);
|
|
21
20
|
let options = {};
|
|
22
21
|
if (route.params?.options) {
|
|
23
|
-
options = getOptions(route.params?.options
|
|
22
|
+
options = getOptions(route.params?.options);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
if (route.params?.nested) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, {
|
|
2
|
-
Fragment,
|
|
3
2
|
useCallback,
|
|
4
3
|
useContext,
|
|
5
4
|
useEffect,
|
|
5
|
+
useRef,
|
|
6
6
|
useState,
|
|
7
7
|
} from 'react';
|
|
8
8
|
import {
|
|
@@ -30,6 +30,9 @@ import {Icon} from '../Icon';
|
|
|
30
30
|
import {PopupNotify} from '../Popup';
|
|
31
31
|
import {Badge, BadgeDot} from '../Badge';
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* default navigation button used header nav
|
|
35
|
+
*/
|
|
33
36
|
const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
34
37
|
icon,
|
|
35
38
|
tintColor,
|
|
@@ -81,6 +84,9 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
81
84
|
);
|
|
82
85
|
};
|
|
83
86
|
|
|
87
|
+
/**
|
|
88
|
+
* default header title used for nav
|
|
89
|
+
*/
|
|
84
90
|
const HeaderTitle: React.FC<any> = props => {
|
|
85
91
|
const {theme} = useContext(ApplicationContext);
|
|
86
92
|
const opacity = props.animatedValue?.interpolate({
|
|
@@ -101,6 +107,9 @@ const HeaderTitle: React.FC<any> = props => {
|
|
|
101
107
|
);
|
|
102
108
|
};
|
|
103
109
|
|
|
110
|
+
/**
|
|
111
|
+
* default header left used for nav
|
|
112
|
+
*/
|
|
104
113
|
const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
105
114
|
tintColor,
|
|
106
115
|
preventBack,
|
|
@@ -113,7 +122,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
113
122
|
useEffect(() => {
|
|
114
123
|
const backHandler = BackHandler.addEventListener(
|
|
115
124
|
'hardwareBackPress',
|
|
116
|
-
goBackSafe
|
|
125
|
+
goBackSafe
|
|
117
126
|
);
|
|
118
127
|
|
|
119
128
|
return () => backHandler.remove();
|
|
@@ -168,6 +177,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
168
177
|
}
|
|
169
178
|
return true;
|
|
170
179
|
};
|
|
180
|
+
|
|
171
181
|
return (
|
|
172
182
|
<View style={styles.headerLeft}>
|
|
173
183
|
<NavigationButton
|
|
@@ -181,6 +191,9 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
181
191
|
);
|
|
182
192
|
};
|
|
183
193
|
|
|
194
|
+
/**
|
|
195
|
+
* header background for default
|
|
196
|
+
*/
|
|
184
197
|
const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
185
198
|
image,
|
|
186
199
|
animatedValue,
|
|
@@ -229,6 +242,10 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
|
229
242
|
);
|
|
230
243
|
};
|
|
231
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Header custom with image, title, subtitle
|
|
247
|
+
* @constructor
|
|
248
|
+
*/
|
|
232
249
|
const HeaderCustom: React.FC<TitleCustomProps> = ({
|
|
233
250
|
title,
|
|
234
251
|
subTitle,
|
|
@@ -263,37 +280,42 @@ const HeaderCustom: React.FC<TitleCustomProps> = ({
|
|
|
263
280
|
return <View style={styles.headerTitleContainer}>{content ?? header}</View>;
|
|
264
281
|
};
|
|
265
282
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return child;
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const renderAction = () => {
|
|
278
|
-
if (Array.isArray(children)) {
|
|
279
|
-
return children.map((child, index) => {
|
|
280
|
-
return (
|
|
281
|
-
<View key={`HeaderRightAction ${index}`} style={styles.headerButton}>
|
|
282
|
-
{React.cloneElement(validateType(child), {...restProps})}
|
|
283
|
-
</View>
|
|
284
|
-
);
|
|
285
|
-
});
|
|
283
|
+
/**
|
|
284
|
+
* main component for header right
|
|
285
|
+
*/
|
|
286
|
+
const HeaderRight: React.FC<any> = ({type, children, onLayout, ...props}) => {
|
|
287
|
+
if (type === 'icon') {
|
|
288
|
+
let buttons = props?.buttons || [];
|
|
289
|
+
if (buttons?.length > 3) {
|
|
290
|
+
buttons = buttons.slice(0, 3);
|
|
286
291
|
}
|
|
287
|
-
|
|
288
292
|
return (
|
|
289
|
-
<View style={styles.
|
|
290
|
-
{
|
|
293
|
+
<View style={styles.headerRightButton} onLayout={onLayout}>
|
|
294
|
+
{buttons?.map?.((item: NavigationButtonProps, index: number) => {
|
|
295
|
+
return (
|
|
296
|
+
<View
|
|
297
|
+
key={`HeaderRightAction ${index}`}
|
|
298
|
+
style={{
|
|
299
|
+
marginLeft: index !== 0 ? Spacing.S : 0,
|
|
300
|
+
}}>
|
|
301
|
+
<NavigationButton {...item} tintColor={props?.tintColor} />
|
|
302
|
+
</View>
|
|
303
|
+
);
|
|
304
|
+
})}
|
|
291
305
|
</View>
|
|
292
306
|
);
|
|
293
|
-
}
|
|
294
|
-
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return (
|
|
310
|
+
<View style={styles.headerRightButton} onLayout={onLayout}>
|
|
311
|
+
{children ?? <HeaderToolkitAction {...props} />}
|
|
312
|
+
</View>
|
|
313
|
+
);
|
|
295
314
|
};
|
|
296
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Header toolkit action
|
|
318
|
+
*/
|
|
297
319
|
const HeaderToolkitAction: React.FC<any> = ({
|
|
298
320
|
tintColor,
|
|
299
321
|
pinnedTool,
|
|
@@ -327,7 +349,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
327
349
|
(config: any) => {
|
|
328
350
|
navigator.toolkitConfig = config;
|
|
329
351
|
setToolConfig(navigator?.toolkitConfig);
|
|
330
|
-
}
|
|
352
|
+
}
|
|
331
353
|
);
|
|
332
354
|
};
|
|
333
355
|
|
|
@@ -340,7 +362,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
340
362
|
const {item} = res;
|
|
341
363
|
navigator?.toolkitCallback?.(item);
|
|
342
364
|
getToolkitConfig();
|
|
343
|
-
}
|
|
365
|
+
}
|
|
344
366
|
);
|
|
345
367
|
};
|
|
346
368
|
|
|
@@ -357,7 +379,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
357
379
|
navigator?.maxApi?.dispatchFunction?.(
|
|
358
380
|
'dismiss',
|
|
359
381
|
undefined,
|
|
360
|
-
undefined
|
|
382
|
+
undefined
|
|
361
383
|
);
|
|
362
384
|
},
|
|
363
385
|
}}
|
|
@@ -388,7 +410,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
388
410
|
[pinTool?.key],
|
|
389
411
|
() => {
|
|
390
412
|
getToolkitConfig();
|
|
391
|
-
}
|
|
413
|
+
}
|
|
392
414
|
);
|
|
393
415
|
navigator?.toolkitCallback?.(pinTool.key);
|
|
394
416
|
}}
|
|
@@ -397,7 +419,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
397
419
|
};
|
|
398
420
|
if (toolConfig) {
|
|
399
421
|
return (
|
|
400
|
-
<View style={
|
|
422
|
+
<View style={Styles.row}>
|
|
401
423
|
{renderPinnedTool()}
|
|
402
424
|
<View
|
|
403
425
|
style={[
|
|
@@ -405,6 +427,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
405
427
|
{
|
|
406
428
|
backgroundColor: backgroundColor ?? '#00000066',
|
|
407
429
|
borderWidth: backgroundColor ? 0.5 : 0,
|
|
430
|
+
marginLeft: renderPinnedTool() ? Spacing.S : 0,
|
|
408
431
|
},
|
|
409
432
|
]}>
|
|
410
433
|
<TouchableOpacity
|
|
@@ -430,6 +453,9 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
430
453
|
return <View />;
|
|
431
454
|
};
|
|
432
455
|
|
|
456
|
+
/**
|
|
457
|
+
* default header banner for header animated
|
|
458
|
+
*/
|
|
433
459
|
const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
|
|
434
460
|
animatedValue,
|
|
435
461
|
image,
|
|
@@ -470,6 +496,47 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
|
|
|
470
496
|
);
|
|
471
497
|
};
|
|
472
498
|
|
|
499
|
+
/**
|
|
500
|
+
* Header extended with background image
|
|
501
|
+
* @constructor
|
|
502
|
+
*/
|
|
503
|
+
const HeaderExtendBackground: React.FC<{
|
|
504
|
+
headerBackground: string;
|
|
505
|
+
animatedValue: Animated.Value;
|
|
506
|
+
heightHeader: number;
|
|
507
|
+
}> = ({headerBackground, animatedValue, heightHeader}) => {
|
|
508
|
+
const heightAnimated = useRef(new Animated.Value(0));
|
|
509
|
+
|
|
510
|
+
useEffect(() => {
|
|
511
|
+
const listener = animatedValue.addListener(({value}) => {
|
|
512
|
+
heightAnimated.current.setValue(value);
|
|
513
|
+
});
|
|
514
|
+
return () => {
|
|
515
|
+
animatedValue?.removeListener(listener);
|
|
516
|
+
};
|
|
517
|
+
}, []);
|
|
518
|
+
|
|
519
|
+
return (
|
|
520
|
+
<>
|
|
521
|
+
<Image
|
|
522
|
+
source={{
|
|
523
|
+
uri: headerBackground,
|
|
524
|
+
}}
|
|
525
|
+
style={styles.extendedHeader}
|
|
526
|
+
/>
|
|
527
|
+
<Animated.View
|
|
528
|
+
style={{
|
|
529
|
+
height: heightAnimated.current.interpolate({
|
|
530
|
+
inputRange: [0, 100],
|
|
531
|
+
outputRange: [heightHeader, heightHeader - 52],
|
|
532
|
+
extrapolate: 'clamp',
|
|
533
|
+
}),
|
|
534
|
+
}}
|
|
535
|
+
/>
|
|
536
|
+
</>
|
|
537
|
+
);
|
|
538
|
+
};
|
|
539
|
+
|
|
473
540
|
const styles = StyleSheet.create({
|
|
474
541
|
navigationButton: {
|
|
475
542
|
height: 28,
|
|
@@ -509,7 +576,6 @@ const styles = StyleSheet.create({
|
|
|
509
576
|
paddingRight: Spacing.M,
|
|
510
577
|
},
|
|
511
578
|
toolkitContainer: {
|
|
512
|
-
marginLeft: Spacing.S,
|
|
513
579
|
padding: Spacing.XS,
|
|
514
580
|
height: 28,
|
|
515
581
|
borderRadius: 14,
|
|
@@ -541,6 +607,12 @@ const styles = StyleSheet.create({
|
|
|
541
607
|
top: -Spacing.XS,
|
|
542
608
|
right: -Spacing.XS,
|
|
543
609
|
},
|
|
610
|
+
extendedHeader: {
|
|
611
|
+
aspectRatio: 1.75,
|
|
612
|
+
position: 'absolute',
|
|
613
|
+
width: '100%',
|
|
614
|
+
height: 210,
|
|
615
|
+
},
|
|
544
616
|
});
|
|
545
617
|
|
|
546
618
|
export {
|
|
@@ -548,8 +620,9 @@ export {
|
|
|
548
620
|
HeaderTitle,
|
|
549
621
|
HeaderLeft,
|
|
550
622
|
HeaderBackground,
|
|
551
|
-
HeaderRightAction,
|
|
552
623
|
HeaderToolkitAction,
|
|
553
624
|
HeaderCustom,
|
|
554
625
|
HeaderAnimated,
|
|
626
|
+
HeaderRight,
|
|
627
|
+
HeaderExtendBackground,
|
|
555
628
|
};
|
|
@@ -21,10 +21,10 @@ const ModalScreen: React.FC<any> = props => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const Modal: React.FC<ModalParams> = props => {
|
|
24
|
-
const {
|
|
24
|
+
const {navigator} = useContext(ApplicationContext);
|
|
25
25
|
const {screen, barrierDismissible} = props.route.params;
|
|
26
26
|
const Component = useRef(screen).current;
|
|
27
|
-
const navigation = new Navigation(props.navigation
|
|
27
|
+
const navigation = new Navigation(props.navigation);
|
|
28
28
|
const params = {
|
|
29
29
|
...props.route.params,
|
|
30
30
|
navigation,
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import {NavigationProp} from '@react-navigation/native';
|
|
3
|
-
import {NavigationOptions
|
|
4
|
-
import {HeaderRightAction} from './index';
|
|
2
|
+
import {NavigationOptions} from './types';
|
|
5
3
|
import {getOptions} from './utils';
|
|
6
|
-
import {HeaderToolkitAction} from './Components';
|
|
7
4
|
|
|
8
5
|
class Navigation {
|
|
9
6
|
instance: NavigationProp<any>;
|
|
10
|
-
|
|
7
|
+
rightHeaderWidth?: number;
|
|
11
8
|
|
|
12
|
-
constructor(instance: any
|
|
9
|
+
constructor(instance: any) {
|
|
13
10
|
this.instance = instance;
|
|
14
|
-
this.theme = theme;
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
/**
|
|
@@ -19,16 +15,6 @@ class Navigation {
|
|
|
19
15
|
* @param params
|
|
20
16
|
*/
|
|
21
17
|
private filterParams = (params: NavigationOptions) => {
|
|
22
|
-
if (params.headerRight) {
|
|
23
|
-
const headerRight = params.headerRight?.({}) as React.ReactElement;
|
|
24
|
-
const type = headerRight?.type;
|
|
25
|
-
if (type !== HeaderRightAction && type !== HeaderToolkitAction) {
|
|
26
|
-
console.warn(
|
|
27
|
-
'headerRight contains element type of HeaderRightAction | HeaderToolkitAction, Please check again.',
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
18
|
if (params.headerLeft) {
|
|
33
19
|
console.warn('headerLeft not allow override render by design system!');
|
|
34
20
|
delete params.headerLeft;
|
|
@@ -42,7 +28,7 @@ class Navigation {
|
|
|
42
28
|
* @param params
|
|
43
29
|
*/
|
|
44
30
|
setOptions = (params: NavigationOptions) => {
|
|
45
|
-
params = getOptions(this.filterParams(params), this
|
|
31
|
+
params = getOptions(this.filterParams(params), this);
|
|
46
32
|
this.instance.setOptions(params);
|
|
47
33
|
};
|
|
48
34
|
}
|
|
@@ -88,7 +88,7 @@ const EmptyScreen: React.FC = () => {
|
|
|
88
88
|
* @constructor
|
|
89
89
|
*/
|
|
90
90
|
const StackScreen: React.FC<ScreenParams> = props => {
|
|
91
|
-
const {
|
|
91
|
+
const {showGrid, navigator} = useContext(ApplicationContext);
|
|
92
92
|
const startTime = useRef(Date.now());
|
|
93
93
|
const endTime = useRef(Date.now());
|
|
94
94
|
const timeLoad = useRef(0);
|
|
@@ -104,7 +104,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
104
104
|
const context = useContext<any>(MiniAppContext);
|
|
105
105
|
|
|
106
106
|
const {screen: Component, options, initialParams} = props.route.params;
|
|
107
|
-
const navigation = new Navigation(props.navigation
|
|
107
|
+
const navigation = new Navigation(props.navigation);
|
|
108
108
|
const heightHeader = useHeaderHeight();
|
|
109
109
|
|
|
110
110
|
const data = {
|
package/Application/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
HeaderAnimated,
|
|
6
6
|
HeaderBackground,
|
|
7
7
|
HeaderCustom,
|
|
8
|
-
HeaderRightAction,
|
|
9
8
|
HeaderTitle,
|
|
10
9
|
NavigationButton,
|
|
11
10
|
} from './Components';
|
|
@@ -31,7 +30,6 @@ export {
|
|
|
31
30
|
NavigationButton,
|
|
32
31
|
HeaderTitle,
|
|
33
32
|
HeaderBackground,
|
|
34
|
-
HeaderRightAction,
|
|
35
33
|
HeaderCustom,
|
|
36
34
|
HeaderAnimated,
|
|
37
35
|
};
|
package/Application/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {StackNavigationOptions} from '@react-navigation/stack';
|
|
2
|
+
import {EventArg} from '@react-navigation/core';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import {Animated, ViewProps} from 'react-native';
|
|
4
5
|
import {PopupNotifyProps} from '../Popup/types';
|
|
@@ -144,19 +145,29 @@ export type RuntimeToolType = {
|
|
|
144
145
|
key: string;
|
|
145
146
|
};
|
|
146
147
|
|
|
147
|
-
export interface NavigationOptions
|
|
148
|
+
export interface NavigationOptions
|
|
149
|
+
extends Omit<StackNavigationOptions, 'headerRight'> {
|
|
148
150
|
preventBack?: PopupNotifyProps;
|
|
149
151
|
onPressLeftHeader?: () => void;
|
|
150
152
|
surface?: boolean;
|
|
151
153
|
hiddenBack?: boolean;
|
|
152
154
|
customTitle?: TitleCustomProps;
|
|
153
|
-
|
|
154
|
-
pinnedTool?: PinnedToolType;
|
|
155
|
-
runtimeTools?: RuntimeToolType[];
|
|
156
|
-
preventClose?: PopupNotifyProps;
|
|
157
|
-
};
|
|
155
|
+
headerRight?: HeaderRightToolkit | HeaderRightActions | any;
|
|
158
156
|
}
|
|
159
157
|
|
|
158
|
+
export type HeaderRightToolkit = {
|
|
159
|
+
type?: 'toolkit';
|
|
160
|
+
pinnedTool?: PinnedToolType;
|
|
161
|
+
runtimeTools?: RuntimeToolType[];
|
|
162
|
+
preventClose?: PopupNotifyProps;
|
|
163
|
+
useMore?: boolean;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export type HeaderRightActions = {
|
|
167
|
+
type?: 'icon';
|
|
168
|
+
buttons: NavigationButtonProps[];
|
|
169
|
+
};
|
|
170
|
+
|
|
160
171
|
export interface HeaderBackProps extends NavigationButtonProps {
|
|
161
172
|
preventBack?: PopupNotifyProps;
|
|
162
173
|
onPressLeftHeader?: () => void;
|
|
@@ -198,6 +209,11 @@ export type BottomTabItemProps = {
|
|
|
198
209
|
screen: Screen;
|
|
199
210
|
options: NavigationOptions;
|
|
200
211
|
initialParams?: any;
|
|
212
|
+
listeners?: {
|
|
213
|
+
tabPress?: (e: EventArg<'tabPress', true, undefined>) => void;
|
|
214
|
+
focus?: (e: EventArg<'focus', false, unknown>) => void;
|
|
215
|
+
blur?: (e: EventArg<'blur', false, unknown>) => void;
|
|
216
|
+
};
|
|
201
217
|
};
|
|
202
218
|
|
|
203
219
|
export type BottomTabProps = {
|
|
@@ -206,8 +222,9 @@ export type BottomTabProps = {
|
|
|
206
222
|
initialRouteName?: string;
|
|
207
223
|
navigation: Navigation;
|
|
208
224
|
listeners?: {
|
|
209
|
-
tabPress?:
|
|
210
|
-
focus?:
|
|
225
|
+
tabPress?: (e: EventArg<'tabPress', true, undefined>) => void;
|
|
226
|
+
focus?: (e: EventArg<'focus', false, unknown>) => void;
|
|
227
|
+
blur?: (e: EventArg<'blur', false, unknown>) => void;
|
|
211
228
|
};
|
|
212
229
|
floatingButton?: FloatingButtonProps;
|
|
213
230
|
};
|
package/Application/utils.tsx
CHANGED
|
@@ -7,11 +7,13 @@ import {
|
|
|
7
7
|
HeaderBackground,
|
|
8
8
|
HeaderCustom,
|
|
9
9
|
HeaderLeft,
|
|
10
|
+
HeaderRight,
|
|
10
11
|
HeaderTitle,
|
|
11
|
-
HeaderToolkitAction,
|
|
12
12
|
} from './Components';
|
|
13
|
-
import {NavigationOptions
|
|
13
|
+
import {NavigationOptions} from './types';
|
|
14
14
|
import {Colors} from '../Consts';
|
|
15
|
+
import Navigation from './Navigation';
|
|
16
|
+
import {LayoutChangeEvent} from 'react-native';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* default options for stack screen
|
|
@@ -22,7 +24,7 @@ const getStackOptions = (): StackNavigationOptions => {
|
|
|
22
24
|
headerTitle: HeaderTitle,
|
|
23
25
|
headerBackground: (props: any) => <HeaderBackground {...props} />,
|
|
24
26
|
headerLeft: (props: any) => <HeaderLeft {...props} />,
|
|
25
|
-
headerRight: (props: any) => <
|
|
27
|
+
headerRight: (props: any) => <HeaderRight {...props} />,
|
|
26
28
|
headerTintColor: Colors.black_01,
|
|
27
29
|
};
|
|
28
30
|
};
|
|
@@ -72,33 +74,42 @@ const getModalOptions = (): StackNavigationOptions => {
|
|
|
72
74
|
/**
|
|
73
75
|
* build react-navigation options
|
|
74
76
|
*/
|
|
75
|
-
const getOptions = (params: NavigationOptions,
|
|
77
|
+
const getOptions = (params: NavigationOptions, navigation?: Navigation) => {
|
|
76
78
|
let options = {};
|
|
77
79
|
|
|
80
|
+
/**
|
|
81
|
+
* left header factory
|
|
82
|
+
*/
|
|
78
83
|
if (
|
|
79
84
|
typeof params.onPressLeftHeader === 'function' ||
|
|
80
85
|
params.preventBack !== undefined ||
|
|
81
86
|
typeof params.hiddenBack === 'boolean'
|
|
82
87
|
) {
|
|
88
|
+
let headerLeft: any = (props: any) => (
|
|
89
|
+
<HeaderLeft
|
|
90
|
+
{...props}
|
|
91
|
+
preventBack={params.preventBack}
|
|
92
|
+
onPressLeftHeader={params.onPressLeftHeader}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
if (params.hiddenBack) {
|
|
96
|
+
headerLeft = null;
|
|
97
|
+
}
|
|
83
98
|
options = {
|
|
84
99
|
...options,
|
|
85
|
-
headerLeft
|
|
86
|
-
? null
|
|
87
|
-
: (props: any) => (
|
|
88
|
-
<HeaderLeft
|
|
89
|
-
{...props}
|
|
90
|
-
preventBack={params.preventBack}
|
|
91
|
-
onPressLeftHeader={params.onPressLeftHeader}
|
|
92
|
-
/>
|
|
93
|
-
),
|
|
100
|
+
headerLeft,
|
|
94
101
|
};
|
|
95
102
|
}
|
|
96
103
|
|
|
104
|
+
/**
|
|
105
|
+
* surface header style
|
|
106
|
+
*/
|
|
97
107
|
if (typeof params.surface === 'boolean') {
|
|
108
|
+
console.warn('surface options is deprecated, headerType instead in screen');
|
|
98
109
|
if (params.surface) {
|
|
99
110
|
options = {
|
|
100
111
|
...options,
|
|
101
|
-
headerTintColor:
|
|
112
|
+
headerTintColor: Colors.black_17,
|
|
102
113
|
headerBackground: () => (
|
|
103
114
|
<HeaderBackground image={null} useSurface={true} />
|
|
104
115
|
),
|
|
@@ -112,7 +123,13 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
|
112
123
|
}
|
|
113
124
|
}
|
|
114
125
|
|
|
126
|
+
/**
|
|
127
|
+
* custom title
|
|
128
|
+
*/
|
|
115
129
|
if (params.customTitle) {
|
|
130
|
+
console.warn(
|
|
131
|
+
'customTitle options is deprecated, please used headerTitle instead'
|
|
132
|
+
);
|
|
116
133
|
options = {
|
|
117
134
|
...options,
|
|
118
135
|
headerTitleAlign: 'left',
|
|
@@ -122,12 +139,41 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
|
122
139
|
};
|
|
123
140
|
}
|
|
124
141
|
|
|
125
|
-
|
|
142
|
+
/**
|
|
143
|
+
* header right
|
|
144
|
+
*/
|
|
145
|
+
if (params.headerRight) {
|
|
146
|
+
let headerRight: any = (props: any) => {
|
|
147
|
+
return (
|
|
148
|
+
<HeaderRight
|
|
149
|
+
{...props}
|
|
150
|
+
{...params.headerRight}
|
|
151
|
+
onLayout={(e: LayoutChangeEvent) => {
|
|
152
|
+
if (navigation) {
|
|
153
|
+
navigation.rightHeaderWidth = e.nativeEvent.layout.width;
|
|
154
|
+
}
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
if (typeof params.headerRight === 'function') {
|
|
160
|
+
headerRight = (props: any) => {
|
|
161
|
+
return (
|
|
162
|
+
<HeaderRight
|
|
163
|
+
{...props}
|
|
164
|
+
onLayout={(e: LayoutChangeEvent) => {
|
|
165
|
+
if (navigation) {
|
|
166
|
+
navigation.rightHeaderWidth = e.nativeEvent.layout.width;
|
|
167
|
+
}
|
|
168
|
+
}}>
|
|
169
|
+
{params.headerRight(props)}
|
|
170
|
+
</HeaderRight>
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
}
|
|
126
174
|
options = {
|
|
127
175
|
...options,
|
|
128
|
-
headerRight
|
|
129
|
-
return <HeaderToolkitAction {...params.toolkitParams} {...props} />;
|
|
130
|
-
},
|
|
176
|
+
headerRight,
|
|
131
177
|
};
|
|
132
178
|
}
|
|
133
179
|
|
package/Button/index.tsx
CHANGED
package/Icon/types.ts
CHANGED
package/Input/InputDropDown.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {ApplicationContext, ComponentContext} from '../Application';
|
|
|
4
4
|
import {Styles} from '../Consts';
|
|
5
5
|
import {Icon} from '../Icon';
|
|
6
6
|
import {Loader} from '../Loader';
|
|
7
|
-
import {ErrorView, FloatingView,
|
|
7
|
+
import {ErrorView, FloatingView, getSizeStyle} from './common';
|
|
8
8
|
import {InputDropDownProps} from './index';
|
|
9
9
|
import styles from './styles';
|
|
10
10
|
|
|
@@ -61,7 +61,7 @@ const InputDropDown = ({
|
|
|
61
61
|
styles.inputWrapper,
|
|
62
62
|
{backgroundColor: theme.colors.background.surface},
|
|
63
63
|
getSizeStyle(size),
|
|
64
|
-
getBorderColor(theme, false, errorMessage, disabled),
|
|
64
|
+
// getBorderColor(theme, false, errorMessage, disabled),
|
|
65
65
|
]}>
|
|
66
66
|
<FloatingView
|
|
67
67
|
floatingValue={floatingValue}
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -44,7 +44,7 @@ const InputMoney = forwardRef(
|
|
|
44
44
|
value: _value,
|
|
45
45
|
...props
|
|
46
46
|
}: InputMoneyProps,
|
|
47
|
-
ref
|
|
47
|
+
ref
|
|
48
48
|
) => {
|
|
49
49
|
const {theme} = useContext(ApplicationContext);
|
|
50
50
|
const [focused, setFocused] = useState(false);
|
|
@@ -63,7 +63,7 @@ const InputMoney = forwardRef(
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
const [value, setValue] = useState(
|
|
66
|
-
defaultValue ? validateText(defaultValue) : ''
|
|
66
|
+
defaultValue ? validateText(defaultValue) : ''
|
|
67
67
|
);
|
|
68
68
|
|
|
69
69
|
const onClearText = () => {
|
|
@@ -198,7 +198,7 @@ const InputMoney = forwardRef(
|
|
|
198
198
|
</View>
|
|
199
199
|
</ComponentContext.Provider>
|
|
200
200
|
);
|
|
201
|
-
}
|
|
201
|
+
}
|
|
202
202
|
);
|
|
203
203
|
|
|
204
204
|
export default InputMoney;
|