@momo-kits/foundation 0.76.1-beta.2 → 0.77.1-optimize.10
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 +439 -0
- package/Application/BottomTab/index.tsx +138 -0
- package/Application/Components.tsx +348 -167
- package/Application/ModalScreen.tsx +135 -98
- package/Application/Navigation.ts +22 -16
- package/Application/NavigationContainer.tsx +99 -48
- package/Application/Navigator.ts +110 -41
- package/Application/StackScreen.tsx +129 -8
- package/Application/index.ts +23 -4
- package/Application/types.ts +86 -34
- package/Application/utils.tsx +67 -49
- 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 +91 -40
- 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 +14 -9
- package/Icon/types.ts +4 -3
- package/IconButton/index.tsx +24 -15
- package/Image/index.tsx +63 -47
- 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 +173 -111
- package/Input/InputOTP.tsx +257 -0
- package/Input/InputSearch.tsx +160 -132
- package/Input/InputTextArea.tsx +150 -123
- package/Input/common.tsx +35 -17
- package/Input/index.tsx +211 -18
- package/Input/styles.ts +44 -7
- package/Input/utils.ts +2 -2
- package/Layout/Card.tsx +67 -29
- package/Layout/FloatingButton.tsx +168 -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 +355 -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 +108 -46
- 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 +6 -0
- 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,148 @@
|
|
|
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
|
+
|
|
66
|
+
return () => {
|
|
67
|
+
onScreenLoad();
|
|
68
|
+
onScreenInteraction();
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* tracking for screen load
|
|
74
|
+
*/
|
|
75
|
+
const onScreenLoad = () => {
|
|
76
|
+
clearTimeout(tracked.current.timeoutLoad);
|
|
77
|
+
if (!tracked.current?.releaseLoad) {
|
|
78
|
+
context.autoTracking?.({
|
|
79
|
+
appId: context.appId,
|
|
80
|
+
code: context.code,
|
|
81
|
+
buildNumber: context.buildNumber,
|
|
82
|
+
screenName,
|
|
83
|
+
componentName: 'Screen',
|
|
84
|
+
state: 'load',
|
|
85
|
+
duration: timeLoad.current,
|
|
86
|
+
});
|
|
87
|
+
navigator?.maxApi?.showToastDebug?.({
|
|
88
|
+
appId: `auto - ${context.appId}`,
|
|
89
|
+
message: `${screenName} screen_load_time ${timeLoad.current}`,
|
|
90
|
+
});
|
|
91
|
+
tracked.current.releaseLoad = true;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* tracking for screen load
|
|
97
|
+
*/
|
|
98
|
+
const onScreenInteraction = () => {
|
|
99
|
+
clearTimeout(tracked.current.timeoutInteraction);
|
|
100
|
+
if (!tracked.current?.releaseInteraction) {
|
|
101
|
+
context.autoTracking?.({
|
|
102
|
+
appId: context.appId,
|
|
103
|
+
code: context.code,
|
|
104
|
+
buildNumber: context.buildNumber,
|
|
105
|
+
screenName,
|
|
106
|
+
componentName: 'Screen',
|
|
107
|
+
state: 'interaction',
|
|
108
|
+
duration: timeInteraction.current - timeLoad.current,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
navigator?.maxApi?.showToastDebug?.({
|
|
112
|
+
appId: `auto - ${context.appId}`,
|
|
113
|
+
message: `${screenName} screen_interaction_time ${timeInteraction.current}`,
|
|
114
|
+
});
|
|
115
|
+
tracked.current.releaseInteraction = true;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<ScreenContext.Provider
|
|
121
|
+
value={{
|
|
122
|
+
screenName,
|
|
123
|
+
onElementLoad: () => {
|
|
124
|
+
endTime.current = Date.now();
|
|
125
|
+
interaction.current?.cancel?.();
|
|
126
|
+
interaction.current = InteractionManager.runAfterInteractions(() => {
|
|
127
|
+
timeInteraction.current = Date.now() - startTime.current;
|
|
128
|
+
});
|
|
129
|
+
clearTimeout(timeoutLoad.current);
|
|
130
|
+
timeoutLoad.current = setTimeout(() => {
|
|
131
|
+
if (timeLoad.current === 0) {
|
|
132
|
+
timeLoad.current = endTime.current - startTime.current;
|
|
133
|
+
}
|
|
134
|
+
}, 2000);
|
|
135
|
+
},
|
|
136
|
+
}}>
|
|
137
|
+
<Component
|
|
138
|
+
heightHeader={heightHeader}
|
|
139
|
+
{...data}
|
|
140
|
+
onScreenLoad={onScreenLoad}
|
|
141
|
+
onScreenInteraction={onScreenInteraction}
|
|
142
|
+
/>
|
|
143
|
+
{showGrid && <GridSystem />}
|
|
144
|
+
</ScreenContext.Provider>
|
|
145
|
+
);
|
|
25
146
|
};
|
|
26
147
|
|
|
27
148
|
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 ?? createContext({});
|
|
20
|
+
const ScreenContext = (Platform as any).ScreenContext ?? createContext({});
|
|
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 {StackNavigationOptions} from '@react-navigation/stack';
|
|
2
|
+
import React from 'react';
|
|
1
3
|
import {Animated, ScrollViewProps, ViewProps} from 'react-native';
|
|
2
|
-
import React, {ReactNode} from 'react';
|
|
3
|
-
import Navigator from './Navigator';
|
|
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,38 +119,55 @@ export interface ModalParams extends ScreenParams {
|
|
|
105
119
|
export interface BottomSheetParams extends ScreenParams {
|
|
106
120
|
[key: string]: any;
|
|
107
121
|
onDismiss?: () => void;
|
|
122
|
+
surface?: boolean;
|
|
123
|
+
footerComponent?: React.ReactNode;
|
|
124
|
+
scrollViewProps?: ScrollViewProps;
|
|
108
125
|
}
|
|
109
126
|
|
|
110
127
|
export type NavigationButtonProps = {
|
|
111
128
|
icon: string;
|
|
112
129
|
tintColor?: string;
|
|
113
|
-
backgroundColor?: string;
|
|
114
130
|
useBorder?: boolean;
|
|
115
131
|
onPress: () => void;
|
|
132
|
+
badgeType?: 'dot' | 'number';
|
|
133
|
+
badgeValue?: number;
|
|
116
134
|
accessibilityLabel?: string;
|
|
117
135
|
};
|
|
118
136
|
|
|
119
|
-
export type
|
|
137
|
+
export type PinnedToolType = {
|
|
138
|
+
key: string;
|
|
139
|
+
badgeValue?: number;
|
|
140
|
+
badgeType?: 'number' | 'dot';
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export type RuntimeToolType = {
|
|
144
|
+
title: {vi: string; en: string};
|
|
145
|
+
icon: string;
|
|
146
|
+
key: string;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export interface NavigationOptions extends StackNavigationOptions {
|
|
120
150
|
preventBack?: PopupNotifyProps;
|
|
151
|
+
onPressLeftHeader?: () => void;
|
|
121
152
|
surface?: boolean;
|
|
122
|
-
|
|
123
|
-
title?: string;
|
|
124
|
-
headerTitle?: (props?: any) => React.ReactElement;
|
|
125
|
-
headerTitleAlign?: 'left' | 'center';
|
|
153
|
+
hiddenBack?: boolean;
|
|
126
154
|
customTitle?: TitleCustomProps;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
155
|
+
toolkitParams?: {
|
|
156
|
+
pinnedTool?: PinnedToolType;
|
|
157
|
+
runtimeTools?: RuntimeToolType[];
|
|
158
|
+
preventClose?: PopupNotifyProps;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
130
161
|
|
|
131
162
|
export interface HeaderBackProps extends NavigationButtonProps {
|
|
132
163
|
preventBack?: PopupNotifyProps;
|
|
164
|
+
onPressLeftHeader?: () => void;
|
|
133
165
|
}
|
|
134
166
|
|
|
135
167
|
export type HeaderBackgroundProps = {
|
|
136
168
|
image?: string | null;
|
|
137
|
-
backgroundColor?: string | null;
|
|
138
169
|
animatedValue?: Animated.Value;
|
|
139
|
-
|
|
170
|
+
useSurface?: boolean;
|
|
140
171
|
};
|
|
141
172
|
|
|
142
173
|
export type TitleCustomProps = {
|
|
@@ -152,24 +183,45 @@ 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;
|
|
226
|
+
headerTitle?: (props?: any) => React.ReactElement;
|
|
175
227
|
};
|