@momo-kits/foundation 0.76.1-beta.2 → 0.77.1-optimize.2
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/BottomTab/BottomTabBar.tsx +478 -0
- package/Application/BottomTab/index.tsx +134 -0
- package/Application/Components.tsx +339 -161
- package/Application/ModalScreen.tsx +113 -99
- package/Application/Navigation.ts +22 -16
- package/Application/NavigationContainer.tsx +99 -48
- package/Application/Navigator.ts +110 -41
- package/Application/StackScreen.tsx +126 -8
- package/Application/index.ts +23 -4
- package/Application/types.ts +84 -33
- package/Application/utils.tsx +90 -50
- package/Assets/DotAnimation.json +256 -0
- package/Assets/SpinnerAnimation.json +1027 -0
- package/Assets/icon.json +83 -5
- package/Assets/icon_bank.json +506 -0
- package/Assets/language.json +202 -0
- package/Badge/Badge.tsx +56 -0
- package/Badge/BadgeDot.tsx +11 -0
- package/Badge/BadgeRibbon.tsx +125 -0
- package/Badge/Shape.tsx +29 -0
- package/Badge/index.tsx +7 -0
- package/Badge/styles.ts +58 -0
- package/Badge/types.ts +63 -0
- package/Button/index.tsx +90 -39
- package/Button/styles.ts +19 -0
- package/CheckBox/index.tsx +58 -43
- package/CheckBox/styles.ts +1 -1
- package/CheckBox/types.ts +6 -4
- package/Consts/colors+spacing+radius.ts +18 -0
- package/Consts/styles.ts +0 -26
- package/Consts/theme.ts +4 -0
- package/Divider/index.tsx +2 -0
- package/Icon/index.tsx +13 -9
- package/Icon/types.ts +4 -3
- package/IconButton/index.tsx +24 -15
- package/Image/index.tsx +60 -48
- package/Image/styles.ts +1 -9
- package/Image/types.ts +5 -1
- package/Input/Input.tsx +227 -116
- package/Input/InputDropDown.tsx +132 -0
- package/Input/InputMoney.tsx +174 -111
- package/Input/InputOTP.tsx +257 -0
- package/Input/InputSearch.tsx +160 -132
- package/Input/InputTextArea.tsx +150 -123
- package/Input/common.tsx +42 -17
- package/Input/index.tsx +204 -18
- package/Input/styles.ts +44 -7
- package/Input/utils.ts +2 -2
- package/Layout/Card.tsx +67 -29
- package/Layout/FloatingButton.tsx +128 -0
- package/Layout/GridSystem.tsx +31 -21
- package/Layout/Item.tsx +21 -25
- package/Layout/ItemList.tsx +55 -0
- package/Layout/ItemSectionList.tsx +39 -0
- package/Layout/Screen.tsx +348 -153
- package/Layout/Section.tsx +66 -34
- package/Layout/index.ts +13 -3
- package/Layout/styles.ts +101 -0
- package/Layout/types.ts +1 -39
- package/Layout/utils.ts +27 -52
- package/Loader/DotLoader.tsx +37 -0
- package/Loader/Loader.tsx +13 -0
- package/Loader/ProgressBar.tsx +44 -0
- package/Loader/Spinner.tsx +29 -0
- package/Loader/index.tsx +4 -0
- package/Loader/styles.ts +10 -0
- package/Loader/types.ts +35 -0
- package/Loader/utils.ts +25 -0
- package/Pagination/PaginationDot.tsx +7 -2
- package/Pagination/PaginationNumber.tsx +8 -6
- package/Pagination/PaginationScroll.tsx +0 -1
- package/Pagination/PaginationWhiteDot.tsx +8 -5
- package/Pagination/styles.ts +3 -0
- package/Pagination/types.ts +2 -0
- package/Popup/PopupNotify.tsx +102 -44
- package/Popup/PopupPromotion.tsx +63 -22
- package/Popup/types.ts +15 -4
- package/Radio/index.tsx +35 -21
- package/Radio/types.ts +7 -5
- package/Skeleton/index.tsx +1 -1
- package/Skeleton/types.ts +3 -0
- package/Switch/index.tsx +35 -24
- package/Switch/types.ts +5 -3
- package/Tag/index.tsx +2 -4
- package/Text/index.tsx +27 -22
- package/Text/styles.ts +38 -0
- package/Text/types.ts +25 -13
- package/Text/utils.ts +1 -1
- package/Title/index.tsx +186 -0
- package/Title/styles.ts +79 -0
- package/Title/types.ts +20 -0
- package/code-scanner.js +143 -0
- package/index.ts +8 -1
- package/migrate_typo.js +56 -0
- package/package.json +14 -9
- package/tsconfig.json +24 -0
- package/verify.js +47 -0
- package/Application/BottomTab.tsx +0 -52
- package/Application/NavigationButton.tsx +0 -54
- package/Assets/header-background.png +0 -0
package/Application/Navigator.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {StackActions} from '@react-navigation/native';
|
|
1
|
+
import {CommonActions, StackActions} from '@react-navigation/native';
|
|
2
2
|
import {
|
|
3
3
|
BottomSheetParams,
|
|
4
4
|
HeaderToolkitProps,
|
|
@@ -8,74 +8,143 @@ import {
|
|
|
8
8
|
|
|
9
9
|
class Navigator {
|
|
10
10
|
ref?: any;
|
|
11
|
+
isReady?: any;
|
|
11
12
|
toolkitConfig?: HeaderToolkitProps;
|
|
12
13
|
maxApi?: any;
|
|
14
|
+
dismissData?: any;
|
|
15
|
+
toolkitCallback?: (item: any) => void;
|
|
13
16
|
|
|
14
|
-
constructor(navigation: any) {
|
|
17
|
+
constructor(navigation: any, isReady: any) {
|
|
15
18
|
this.ref = navigation;
|
|
19
|
+
this.isReady = isReady;
|
|
16
20
|
}
|
|
17
21
|
|
|
22
|
+
/**
|
|
23
|
+
* push new stack screen
|
|
24
|
+
* @param params
|
|
25
|
+
*/
|
|
18
26
|
push = (params: ScreenParams) => {
|
|
19
|
-
this.
|
|
27
|
+
if (this.isReady.current) {
|
|
28
|
+
this.ref.current.dispatch(StackActions.push('Stack', params));
|
|
29
|
+
}
|
|
20
30
|
};
|
|
21
31
|
|
|
32
|
+
/**
|
|
33
|
+
* replace current screen with new screen
|
|
34
|
+
* @param params
|
|
35
|
+
*/
|
|
22
36
|
replace = (params: ScreenParams) => {
|
|
23
|
-
this.
|
|
37
|
+
if (this.isReady.current) {
|
|
38
|
+
this.ref.current.dispatch(StackActions.replace('Stack', params));
|
|
39
|
+
}
|
|
24
40
|
};
|
|
25
|
-
|
|
41
|
+
/**
|
|
42
|
+
* pop to dismiss a screen
|
|
43
|
+
* @param count
|
|
44
|
+
*/
|
|
26
45
|
pop = (count?: number) => {
|
|
27
|
-
this.
|
|
46
|
+
if (this.isReady.current) {
|
|
47
|
+
this.ref.current.dispatch(StackActions.pop(count ?? 1));
|
|
48
|
+
}
|
|
28
49
|
};
|
|
29
50
|
|
|
51
|
+
/**
|
|
52
|
+
* present a new screen, show from bottom iOS
|
|
53
|
+
* @param params
|
|
54
|
+
*/
|
|
30
55
|
present = (params: ScreenParams) => {
|
|
31
|
-
this.
|
|
56
|
+
if (this.isReady.current) {
|
|
57
|
+
this.ref.current.dispatch(StackActions.push('Dialog', params));
|
|
58
|
+
}
|
|
32
59
|
};
|
|
33
60
|
|
|
61
|
+
/**
|
|
62
|
+
* show a modal popup
|
|
63
|
+
* @param params
|
|
64
|
+
*/
|
|
34
65
|
showModal = (params: ModalParams) => {
|
|
35
|
-
this.
|
|
66
|
+
if (this.isReady.current) {
|
|
67
|
+
this.ref.current.dispatch(StackActions.push('Modal', params));
|
|
68
|
+
}
|
|
36
69
|
};
|
|
37
70
|
|
|
71
|
+
/**
|
|
72
|
+
* show a bottom sheet
|
|
73
|
+
* @param params
|
|
74
|
+
*/
|
|
38
75
|
showBottomSheet = (params: BottomSheetParams) => {
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
76
|
+
if (this.isReady.current) {
|
|
77
|
+
this.ref.current.dispatch(
|
|
78
|
+
StackActions.push('Modal', {
|
|
79
|
+
...params,
|
|
80
|
+
isBottomSheet: true,
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
45
84
|
};
|
|
46
85
|
|
|
86
|
+
/**
|
|
87
|
+
* pop all screen route
|
|
88
|
+
*/
|
|
47
89
|
popToTop = () => {
|
|
48
|
-
this.
|
|
90
|
+
if (this.isReady.current) {
|
|
91
|
+
this.ref.current.dispatch(StackActions.popToTop());
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* navigate
|
|
97
|
+
* @param name
|
|
98
|
+
* @param params
|
|
99
|
+
*/
|
|
100
|
+
navigate = (name: string, params: any) => {
|
|
101
|
+
if (this.isReady.current) {
|
|
102
|
+
this.ref.current.dispatch(
|
|
103
|
+
CommonActions.navigate({
|
|
104
|
+
name,
|
|
105
|
+
params,
|
|
106
|
+
}),
|
|
107
|
+
);
|
|
108
|
+
}
|
|
49
109
|
};
|
|
50
110
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
111
|
+
/**
|
|
112
|
+
* reset a navigation flow with new screen
|
|
113
|
+
* @param params
|
|
114
|
+
*/
|
|
115
|
+
reset = (params: ScreenParams) => {
|
|
116
|
+
if (this.isReady.current) {
|
|
117
|
+
this.ref.current.dispatch(
|
|
118
|
+
CommonActions.reset({
|
|
119
|
+
index: 0,
|
|
120
|
+
routes: [
|
|
121
|
+
{
|
|
122
|
+
name: 'Stack',
|
|
123
|
+
key: `Stack_${new Date().getTime()}`,
|
|
124
|
+
params,
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
}),
|
|
128
|
+
);
|
|
57
129
|
}
|
|
58
130
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
});
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* dismiss a feature data
|
|
134
|
+
* @param data
|
|
135
|
+
*/
|
|
136
|
+
setDismissData = (data: any) => {
|
|
137
|
+
this.dismissData = data;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* set callback function for toolkit
|
|
142
|
+
* @param callback
|
|
143
|
+
*/
|
|
144
|
+
setToolkitCallback = (
|
|
145
|
+
callback: (item: {key: string; action: string}) => void,
|
|
146
|
+
) => {
|
|
147
|
+
this.toolkitCallback = callback;
|
|
79
148
|
};
|
|
80
149
|
}
|
|
81
150
|
|
|
@@ -1,27 +1,145 @@
|
|
|
1
|
-
import React, {useContext, useEffect} from 'react';
|
|
1
|
+
import React, {useContext, useEffect, useLayoutEffect, useRef} from 'react';
|
|
2
2
|
import {ScreenParams} from './types';
|
|
3
3
|
import Navigation from './Navigation';
|
|
4
|
-
import {ApplicationContext} from './index';
|
|
4
|
+
import {ApplicationContext, MiniAppContext, ScreenContext} from './index';
|
|
5
|
+
import {GridSystem} from '../Layout';
|
|
6
|
+
import {useHeaderHeight} from '@react-navigation/stack';
|
|
7
|
+
import {Alert, InteractionManager} from 'react-native';
|
|
5
8
|
|
|
6
9
|
const StackScreen: React.FC<ScreenParams> = props => {
|
|
7
|
-
const {
|
|
8
|
-
const
|
|
10
|
+
const {theme, showGrid, navigator} = useContext(ApplicationContext);
|
|
11
|
+
const startTime = useRef(Date.now());
|
|
12
|
+
const endTime = useRef(Date.now());
|
|
13
|
+
const timeLoad = useRef(0);
|
|
14
|
+
const timeInteraction = useRef(0);
|
|
15
|
+
const timeoutLoad = useRef<any>();
|
|
16
|
+
const tracked = useRef<any>({
|
|
17
|
+
releaseLoad: undefined,
|
|
18
|
+
releaseInteraction: undefined,
|
|
19
|
+
timeoutLoad: undefined,
|
|
20
|
+
timeoutInteraction: undefined,
|
|
21
|
+
});
|
|
22
|
+
const interaction = useRef<any>();
|
|
23
|
+
const context = useContext<any>(MiniAppContext);
|
|
24
|
+
|
|
25
|
+
const {screen: Component, options, initialParams} = props.route.params;
|
|
9
26
|
const navigation = new Navigation(props.navigation, theme);
|
|
27
|
+
const heightHeader = useHeaderHeight();
|
|
10
28
|
|
|
11
|
-
const
|
|
29
|
+
const data = {
|
|
30
|
+
...initialParams,
|
|
12
31
|
...props.route.params,
|
|
13
32
|
navigation,
|
|
14
33
|
};
|
|
15
34
|
|
|
16
|
-
delete
|
|
35
|
+
delete data.screen;
|
|
36
|
+
delete data.initialParams;
|
|
17
37
|
|
|
18
|
-
|
|
38
|
+
const screenName = Component?.name || Component?.type?.name || 'Invalid';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* set options for screen
|
|
42
|
+
*/
|
|
43
|
+
useLayoutEffect(() => {
|
|
19
44
|
if (options) {
|
|
20
45
|
navigation.setOptions(options);
|
|
21
46
|
}
|
|
22
47
|
}, [options]);
|
|
23
48
|
|
|
24
|
-
|
|
49
|
+
/**
|
|
50
|
+
* tracking for screen
|
|
51
|
+
*/
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (__DEV__ && (!screenName || screenName == 'Invalid')) {
|
|
54
|
+
Alert.alert('Design system', `Unvalidated screen name "${screenName}" !`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
navigator?.maxApi?.of?.({screenName});
|
|
58
|
+
|
|
59
|
+
tracked.current.timeoutLoad = setTimeout(() => {
|
|
60
|
+
onScreenLoad();
|
|
61
|
+
}, 5000);
|
|
62
|
+
tracked.current.timeoutInteraction = setTimeout(() => {
|
|
63
|
+
onScreenInteraction();
|
|
64
|
+
}, 5000);
|
|
65
|
+
return () => {
|
|
66
|
+
onScreenLoad();
|
|
67
|
+
onScreenInteraction();
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* tracking for screen load
|
|
73
|
+
*/
|
|
74
|
+
const onScreenLoad = () => {
|
|
75
|
+
clearTimeout(tracked.current.timeoutLoad);
|
|
76
|
+
if (!tracked.current?.releaseLoad) {
|
|
77
|
+
navigator?.maxApi?.dispatchFunction?.('autoTracking', {
|
|
78
|
+
appId: context.appId,
|
|
79
|
+
code: context.code,
|
|
80
|
+
screenName,
|
|
81
|
+
componentName: 'Screen',
|
|
82
|
+
state: 'load',
|
|
83
|
+
time: timeLoad.current,
|
|
84
|
+
});
|
|
85
|
+
navigator?.maxApi?.showToastDebug?.({
|
|
86
|
+
appId: `auto - ${context.appId}`,
|
|
87
|
+
message: `${screenName} screen_load_time ${timeLoad.current}`,
|
|
88
|
+
});
|
|
89
|
+
tracked.current.releaseLoad = true;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* tracking for screen load
|
|
95
|
+
*/
|
|
96
|
+
const onScreenInteraction = () => {
|
|
97
|
+
clearTimeout(tracked.current.timeoutInteraction);
|
|
98
|
+
if (!tracked.current?.releaseInteraction) {
|
|
99
|
+
navigator?.maxApi?.dispatchFunction?.('autoTracking', {
|
|
100
|
+
appId: context.appId,
|
|
101
|
+
code: context.code,
|
|
102
|
+
screenName,
|
|
103
|
+
componentName: 'Screen',
|
|
104
|
+
state: 'interaction',
|
|
105
|
+
time: timeInteraction.current,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
navigator?.maxApi?.showToastDebug?.({
|
|
109
|
+
appId: `auto - ${context.appId}`,
|
|
110
|
+
message: `${screenName} screen_interaction_time ${timeInteraction.current}`,
|
|
111
|
+
});
|
|
112
|
+
tracked.current.releaseInteraction = true;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<ScreenContext.Provider
|
|
118
|
+
value={{
|
|
119
|
+
screenName,
|
|
120
|
+
onElementLoad: () => {
|
|
121
|
+
endTime.current = Date.now();
|
|
122
|
+
interaction.current?.cancel?.();
|
|
123
|
+
interaction.current = InteractionManager.runAfterInteractions(() => {
|
|
124
|
+
timeInteraction.current = Date.now() - startTime.current;
|
|
125
|
+
});
|
|
126
|
+
clearTimeout(timeoutLoad.current);
|
|
127
|
+
timeoutLoad.current = setTimeout(() => {
|
|
128
|
+
if (timeLoad.current === 0) {
|
|
129
|
+
timeLoad.current = endTime.current - startTime.current;
|
|
130
|
+
}
|
|
131
|
+
}, 2000);
|
|
132
|
+
},
|
|
133
|
+
}}>
|
|
134
|
+
<Component
|
|
135
|
+
heightHeader={heightHeader}
|
|
136
|
+
{...data}
|
|
137
|
+
onScreenLoad={onScreenLoad}
|
|
138
|
+
onScreenInteraction={onScreenInteraction}
|
|
139
|
+
/>
|
|
140
|
+
{showGrid && <GridSystem />}
|
|
141
|
+
</ScreenContext.Provider>
|
|
142
|
+
);
|
|
25
143
|
};
|
|
26
144
|
|
|
27
145
|
export default StackScreen;
|
package/Application/index.ts
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
|
+
import {Platform} from 'react-native';
|
|
1
2
|
import {NavigationContainer} from './NavigationContainer';
|
|
2
3
|
import Screen from '../Layout/Screen';
|
|
3
|
-
import
|
|
4
|
-
|
|
4
|
+
import {
|
|
5
|
+
HeaderAnimated,
|
|
6
|
+
HeaderBackground,
|
|
7
|
+
HeaderCustom,
|
|
8
|
+
HeaderRightAction,
|
|
9
|
+
HeaderTitle,
|
|
10
|
+
NavigationButton,
|
|
11
|
+
} from './Components';
|
|
5
12
|
import BottomTab from './BottomTab';
|
|
6
13
|
import {createContext} from 'react';
|
|
7
14
|
import {defaultContext} from '../Consts';
|
|
8
15
|
|
|
16
|
+
const Context = createContext({});
|
|
9
17
|
const ApplicationContext = createContext(defaultContext);
|
|
10
18
|
|
|
19
|
+
const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
|
|
20
|
+
const ScreenContext = (Platform as any).ScreenContext ?? Context;
|
|
21
|
+
const ComponentContext = (Platform as any).ComponentContext ?? Context;
|
|
22
|
+
|
|
11
23
|
export {
|
|
12
|
-
NavigationContainer,
|
|
13
24
|
ApplicationContext,
|
|
25
|
+
MiniAppContext,
|
|
26
|
+
ScreenContext,
|
|
27
|
+
ComponentContext,
|
|
28
|
+
NavigationContainer,
|
|
14
29
|
Screen,
|
|
30
|
+
BottomTab,
|
|
15
31
|
NavigationButton,
|
|
32
|
+
HeaderTitle,
|
|
33
|
+
HeaderBackground,
|
|
16
34
|
HeaderRightAction,
|
|
17
|
-
|
|
35
|
+
HeaderCustom,
|
|
36
|
+
HeaderAnimated,
|
|
18
37
|
};
|
package/Application/types.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React
|
|
3
|
-
import
|
|
1
|
+
import {StackNavigationOptions} from '@react-navigation/stack';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {Animated, FlatListProps, ViewProps} from 'react-native';
|
|
4
4
|
import {PopupNotifyProps} from '../Popup/types';
|
|
5
5
|
import Navigation from './Navigation';
|
|
6
|
+
import Navigator from './Navigator';
|
|
7
|
+
|
|
8
|
+
type Screen = React.ComponentType<NavigationScreenProps>;
|
|
6
9
|
|
|
7
10
|
export type Theme = {
|
|
8
11
|
dark: boolean;
|
|
@@ -60,15 +63,39 @@ export type Theme = {
|
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
export type Context = {
|
|
66
|
+
[key: string]: any;
|
|
63
67
|
theme: Theme;
|
|
64
68
|
navigator?: Navigator;
|
|
69
|
+
showGrid?: boolean;
|
|
70
|
+
translate?: (key: string) => string;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type MiniAppInfo = {
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
code: string;
|
|
76
|
+
appId: string;
|
|
77
|
+
buildNumber: number;
|
|
78
|
+
flowPartnerId?: string;
|
|
79
|
+
toolkitConfig?: any;
|
|
80
|
+
fromCode?: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type LocalizationObject = {
|
|
84
|
+
vi: {
|
|
85
|
+
[key: string]: string;
|
|
86
|
+
};
|
|
87
|
+
en: {
|
|
88
|
+
[key: string]: string;
|
|
89
|
+
};
|
|
65
90
|
};
|
|
66
91
|
|
|
67
92
|
export type NavigationContainerProps = {
|
|
68
|
-
screen:
|
|
93
|
+
screen: Screen;
|
|
69
94
|
options?: NavigationOptions;
|
|
70
95
|
theme: Theme;
|
|
71
|
-
maxApi
|
|
96
|
+
maxApi: any;
|
|
97
|
+
localization?: LocalizationObject;
|
|
98
|
+
initialParams?: any;
|
|
72
99
|
};
|
|
73
100
|
|
|
74
101
|
export type NavigationScreenProps = {
|
|
@@ -77,27 +104,14 @@ export type NavigationScreenProps = {
|
|
|
77
104
|
navigation: Navigation;
|
|
78
105
|
};
|
|
79
106
|
|
|
80
|
-
export interface ScreenProps extends ViewProps {
|
|
81
|
-
navigation?: Navigation;
|
|
82
|
-
enableKeyboardAvoidingView?: boolean;
|
|
83
|
-
headerBackground?: string;
|
|
84
|
-
scrollable?: boolean;
|
|
85
|
-
useAnimatedHeader?: boolean;
|
|
86
|
-
useExtendedHeader?: boolean;
|
|
87
|
-
scrollViewProps?: ScrollViewProps;
|
|
88
|
-
footerComponent?: ReactNode;
|
|
89
|
-
marginHeader?: number;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
107
|
export type ScreenParams = {
|
|
93
108
|
[key: string]: any;
|
|
94
|
-
screen:
|
|
109
|
+
screen: Screen;
|
|
95
110
|
options?: NavigationOptions;
|
|
96
111
|
};
|
|
97
112
|
|
|
98
113
|
export interface ModalParams extends ScreenParams {
|
|
99
114
|
[key: string]: any;
|
|
100
|
-
screen: React.ElementType;
|
|
101
115
|
onDismiss?: () => void;
|
|
102
116
|
barrierDismissible?: boolean;
|
|
103
117
|
}
|
|
@@ -105,31 +119,48 @@ export interface ModalParams extends ScreenParams {
|
|
|
105
119
|
export interface BottomSheetParams extends ScreenParams {
|
|
106
120
|
[key: string]: any;
|
|
107
121
|
onDismiss?: () => void;
|
|
122
|
+
footerComponent?: React.ReactNode;
|
|
123
|
+
flatListProps?: FlatListProps<any>;
|
|
108
124
|
}
|
|
109
125
|
|
|
110
126
|
export type NavigationButtonProps = {
|
|
111
127
|
icon: string;
|
|
112
128
|
tintColor?: string;
|
|
113
|
-
backgroundColor?: string;
|
|
114
129
|
useBorder?: boolean;
|
|
115
130
|
onPress: () => void;
|
|
131
|
+
badgeType?: 'dot' | 'number';
|
|
132
|
+
badgeValue?: number;
|
|
116
133
|
accessibilityLabel?: string;
|
|
117
134
|
};
|
|
118
135
|
|
|
119
|
-
export type
|
|
136
|
+
export type PinnedToolType = {
|
|
137
|
+
key: string;
|
|
138
|
+
badgeValue?: number;
|
|
139
|
+
badgeType?: 'number' | 'dot';
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export type RuntimeToolType = {
|
|
143
|
+
title: {vi: string; en: string};
|
|
144
|
+
icon: string;
|
|
145
|
+
key: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export interface NavigationOptions extends StackNavigationOptions {
|
|
120
149
|
preventBack?: PopupNotifyProps;
|
|
150
|
+
onPressLeftHeader?: () => void;
|
|
121
151
|
surface?: boolean;
|
|
122
|
-
|
|
123
|
-
title?: string;
|
|
124
|
-
headerTitle?: (props?: any) => React.ReactElement;
|
|
125
|
-
headerTitleAlign?: 'left' | 'center';
|
|
152
|
+
hiddenBack?: boolean;
|
|
126
153
|
customTitle?: TitleCustomProps;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
154
|
+
toolkitParams?: {
|
|
155
|
+
pinnedTool?: PinnedToolType;
|
|
156
|
+
runtimeTools?: RuntimeToolType[];
|
|
157
|
+
preventClose?: PopupNotifyProps;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
130
160
|
|
|
131
161
|
export interface HeaderBackProps extends NavigationButtonProps {
|
|
132
162
|
preventBack?: PopupNotifyProps;
|
|
163
|
+
onPressLeftHeader?: () => void;
|
|
133
164
|
}
|
|
134
165
|
|
|
135
166
|
export type HeaderBackgroundProps = {
|
|
@@ -152,24 +183,44 @@ export type TitleCustomProps = {
|
|
|
152
183
|
export type HeaderToolkitProps = {
|
|
153
184
|
[key: string]: any;
|
|
154
185
|
appCode: string;
|
|
155
|
-
|
|
156
|
-
type: string;
|
|
157
|
-
onAction?: (action: string) => void;
|
|
186
|
+
configs: any[];
|
|
158
187
|
};
|
|
159
188
|
|
|
189
|
+
export interface HeaderAnimatedProps extends ViewProps {
|
|
190
|
+
animatedValue: Animated.Value;
|
|
191
|
+
image: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
160
194
|
export type BottomTabItemProps = {
|
|
161
195
|
name: string;
|
|
162
196
|
label: string;
|
|
163
197
|
icon: string;
|
|
164
198
|
showDot?: boolean;
|
|
165
|
-
badgeLabel?: string;
|
|
166
|
-
screen:
|
|
199
|
+
badgeLabel?: string | number;
|
|
200
|
+
screen: Screen;
|
|
201
|
+
options: NavigationOptions;
|
|
167
202
|
};
|
|
168
203
|
|
|
169
204
|
export type BottomTabProps = {
|
|
205
|
+
nested?: boolean;
|
|
170
206
|
tabs: BottomTabItemProps[];
|
|
207
|
+
initialRouteName?: string;
|
|
208
|
+
navigation: Navigation;
|
|
171
209
|
listeners?: {
|
|
172
210
|
tabPress?: any;
|
|
173
211
|
focus?: any;
|
|
174
212
|
};
|
|
213
|
+
floatingButton?: FloatingButtonProps;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export type FloatingButtonProps = {
|
|
217
|
+
container?: React.ReactNode;
|
|
218
|
+
icon: string | React.ReactNode;
|
|
219
|
+
label: string;
|
|
220
|
+
onPress: () => void;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export type AnimatedHeader = {
|
|
224
|
+
type: 'default' | 'surface';
|
|
225
|
+
component?: (props?: any) => React.ReactElement;
|
|
175
226
|
};
|