@momo-kits/foundation 0.103.1-optimize.0 → 0.103.1-optimize.3
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.
|
@@ -149,7 +149,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
149
149
|
const goBackSafe = () => {
|
|
150
150
|
const goBack = () => {
|
|
151
151
|
const canGoBack = navigator?.ref?.current?.canGoBack?.();
|
|
152
|
-
const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
|
|
152
|
+
const currentRoute: any = navigator?.ref?.current?.getCurrentRoute?.();
|
|
153
153
|
const params = {
|
|
154
154
|
appId: context.appId,
|
|
155
155
|
code: context.code,
|
|
@@ -337,7 +337,6 @@ const HeaderRight: React.FC<any> = ({type, children, onLayout, ...props}) => {
|
|
|
337
337
|
const HeaderToolkitAction: React.FC<any> = ({
|
|
338
338
|
tintColor,
|
|
339
339
|
pinnedTool,
|
|
340
|
-
runtimeTools = [],
|
|
341
340
|
preventClose,
|
|
342
341
|
}) => {
|
|
343
342
|
const {navigator} = useContext(ApplicationContext);
|
|
@@ -374,13 +373,15 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
374
373
|
const onMore = () => {
|
|
375
374
|
onAction?.('onMore');
|
|
376
375
|
navigator?.maxApi?.dispatchFunction?.(
|
|
377
|
-
'
|
|
378
|
-
{
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
376
|
+
'showToolkit',
|
|
377
|
+
{
|
|
378
|
+
tools: miniContext?.toolkitConfig?.oldTools ?? [
|
|
379
|
+
'addFavorite',
|
|
380
|
+
'addShortcut',
|
|
381
|
+
'share',
|
|
382
|
+
],
|
|
383
|
+
},
|
|
384
|
+
() => {}
|
|
384
385
|
);
|
|
385
386
|
};
|
|
386
387
|
|
package/Application/Localize.ts
CHANGED
|
@@ -17,6 +17,10 @@ class Localize {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
get getCurrentLanguage() {
|
|
21
|
+
return this.currentLanguage;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
translate(key: string) {
|
|
21
25
|
return this.assets[this.currentLanguage]?.[key] || key;
|
|
22
26
|
}
|
|
@@ -26,7 +30,10 @@ class Localize {
|
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
addTranslations(translations: LocalizationObject) {
|
|
29
|
-
this.assets =
|
|
33
|
+
this.assets = {
|
|
34
|
+
vi: {...translations?.vi, ...this.assets.vi},
|
|
35
|
+
en: {...translations?.en, ...this.assets.en},
|
|
36
|
+
};
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
setLanguage(language: 'en' | 'vi') {
|
package/Application/Navigator.ts
CHANGED
|
@@ -58,49 +58,79 @@ class Navigator {
|
|
|
58
58
|
* push new stack screen
|
|
59
59
|
* @param params
|
|
60
60
|
*/
|
|
61
|
-
push = (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
push = (
|
|
62
|
+
params: ScreenParams,
|
|
63
|
+
callback?: (params: NavigatorCallbackParamsType) => void
|
|
64
|
+
) => {
|
|
65
|
+
this.validateRefAndRunAction({
|
|
66
|
+
action: navigationRef => {
|
|
67
|
+
navigationRef.dispatch(StackActions.push('Stack', params));
|
|
68
|
+
},
|
|
69
|
+
callback,
|
|
70
|
+
});
|
|
65
71
|
};
|
|
66
72
|
|
|
67
73
|
/**
|
|
68
74
|
* replace current screen with new screen
|
|
69
75
|
* @param params
|
|
70
76
|
*/
|
|
71
|
-
replace = (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
replace = (
|
|
78
|
+
params: ScreenParams,
|
|
79
|
+
callback?: (params: NavigatorCallbackParamsType) => void
|
|
80
|
+
) => {
|
|
81
|
+
this.validateRefAndRunAction({
|
|
82
|
+
action: navigationRef => {
|
|
83
|
+
navigationRef.dispatch(StackActions.replace('Stack', params));
|
|
84
|
+
},
|
|
85
|
+
callback,
|
|
86
|
+
});
|
|
75
87
|
};
|
|
76
88
|
/**
|
|
77
89
|
* pop to dismiss a screen
|
|
78
90
|
* @param count
|
|
79
91
|
*/
|
|
80
|
-
pop = (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
pop = (
|
|
93
|
+
count?: number,
|
|
94
|
+
callback?: (params: NavigatorCallbackParamsType) => void
|
|
95
|
+
) => {
|
|
96
|
+
this.validateRefAndRunAction({
|
|
97
|
+
action: navigationRef => {
|
|
98
|
+
navigationRef.dispatch(StackActions.pop(count ?? 1));
|
|
99
|
+
},
|
|
100
|
+
callback,
|
|
101
|
+
});
|
|
84
102
|
};
|
|
85
103
|
|
|
86
104
|
/**
|
|
87
105
|
* present a new screen, show from bottom iOS
|
|
88
106
|
* @param params
|
|
89
107
|
*/
|
|
90
|
-
present = (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
present = (
|
|
109
|
+
params: ScreenParams,
|
|
110
|
+
callback?: (params: NavigatorCallbackParamsType) => void
|
|
111
|
+
) => {
|
|
112
|
+
this.validateRefAndRunAction({
|
|
113
|
+
action: navigationRef => {
|
|
114
|
+
navigationRef.dispatch(StackActions.push('Dialog', params));
|
|
115
|
+
},
|
|
116
|
+
callback,
|
|
117
|
+
});
|
|
94
118
|
};
|
|
95
119
|
|
|
96
120
|
/**
|
|
97
121
|
* show a modal popup
|
|
98
122
|
* @param params
|
|
99
123
|
*/
|
|
100
|
-
showModal = (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
124
|
+
showModal = (
|
|
125
|
+
params: ModalParams,
|
|
126
|
+
callback?: (params: NavigatorCallbackParamsType) => void
|
|
127
|
+
) => {
|
|
128
|
+
this.validateRefAndRunAction({
|
|
129
|
+
action: navigationRef => {
|
|
130
|
+
navigationRef.dispatch(StackActions.push('Modal', params));
|
|
131
|
+
},
|
|
132
|
+
callback,
|
|
133
|
+
});
|
|
104
134
|
};
|
|
105
135
|
|
|
106
136
|
/**
|
|
@@ -128,10 +158,13 @@ class Navigator {
|
|
|
128
158
|
/**
|
|
129
159
|
* pop all screen route
|
|
130
160
|
*/
|
|
131
|
-
popToTop = () => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
161
|
+
popToTop = (callback?: (params: NavigatorCallbackParamsType) => void) => {
|
|
162
|
+
this.validateRefAndRunAction({
|
|
163
|
+
action: navigationRef => {
|
|
164
|
+
navigationRef.dispatch(StackActions.popToTop());
|
|
165
|
+
},
|
|
166
|
+
callback,
|
|
167
|
+
});
|
|
135
168
|
};
|
|
136
169
|
|
|
137
170
|
/**
|
|
@@ -139,36 +172,49 @@ class Navigator {
|
|
|
139
172
|
* @param name
|
|
140
173
|
* @param params
|
|
141
174
|
*/
|
|
142
|
-
navigate = (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
175
|
+
navigate = (
|
|
176
|
+
name: string,
|
|
177
|
+
params: any,
|
|
178
|
+
callback?: (params: NavigatorCallbackParamsType) => void
|
|
179
|
+
) => {
|
|
180
|
+
this.validateRefAndRunAction({
|
|
181
|
+
action: navigationRef => {
|
|
182
|
+
navigationRef.dispatch(
|
|
183
|
+
CommonActions.navigate({
|
|
184
|
+
name,
|
|
185
|
+
params,
|
|
186
|
+
})
|
|
187
|
+
);
|
|
188
|
+
},
|
|
189
|
+
callback,
|
|
190
|
+
});
|
|
151
191
|
};
|
|
152
192
|
|
|
153
193
|
/**
|
|
154
194
|
* reset a navigation flow with new screen
|
|
155
195
|
* @param params
|
|
156
196
|
*/
|
|
157
|
-
reset = (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
197
|
+
reset = (
|
|
198
|
+
params: ScreenParams,
|
|
199
|
+
callback?: (params: NavigatorCallbackParamsType) => void
|
|
200
|
+
) => {
|
|
201
|
+
this.validateRefAndRunAction({
|
|
202
|
+
action: navigationRef => {
|
|
203
|
+
navigationRef.dispatch(
|
|
204
|
+
CommonActions.reset({
|
|
205
|
+
index: 0,
|
|
206
|
+
routes: [
|
|
207
|
+
{
|
|
208
|
+
name: 'Stack',
|
|
209
|
+
key: `Stack_${new Date().getTime()}`,
|
|
210
|
+
params,
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
})
|
|
214
|
+
);
|
|
215
|
+
},
|
|
216
|
+
callback,
|
|
217
|
+
});
|
|
172
218
|
};
|
|
173
219
|
|
|
174
220
|
/**
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -33,7 +33,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
33
33
|
* tracking
|
|
34
34
|
*/
|
|
35
35
|
useEffect(() => {
|
|
36
|
-
const routes = navigator?.ref.current?.getRootState()?.routes || [];
|
|
36
|
+
const routes: any = navigator?.ref.current?.getRootState()?.routes || [];
|
|
37
37
|
const routesLength = routes.length;
|
|
38
38
|
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
39
39
|
if (routesLength > 1) {
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -19,7 +19,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
19
19
|
* tracking
|
|
20
20
|
*/
|
|
21
21
|
useEffect(() => {
|
|
22
|
-
const routes = navigator?.ref.current?.getRootState()?.routes || [];
|
|
22
|
+
const routes: any = navigator?.ref.current?.getRootState()?.routes || [];
|
|
23
23
|
const routesLength = routes.length;
|
|
24
24
|
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
25
25
|
if (routesLength > 1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.103.1-optimize.
|
|
3
|
+
"version": "0.103.1-optimize.3",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {},
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"react-test-renderer": "17.0.1",
|
|
40
40
|
"typescript": "^4.0.3",
|
|
41
41
|
"@momo-platform/versions": "4.1.11",
|
|
42
|
-
"react-scanner": "^1.1.0"
|
|
42
|
+
"react-scanner": "^1.1.0",
|
|
43
|
+
"@types/color": "3.0.6"
|
|
43
44
|
},
|
|
44
45
|
"author": "@momo-kits/foundation",
|
|
45
46
|
"license": "ISC"
|