@momo-kits/foundation 0.103.1-beta.2 → 0.103.1-beta.4

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.
@@ -26,7 +26,6 @@ import {
26
26
  HeaderBackgroundProps,
27
27
  HeaderBackProps,
28
28
  NavigationButtonProps,
29
- RouteParams,
30
29
  TitleCustomProps,
31
30
  } from './types';
32
31
  import {scaleSize, Text} from '../Text';
@@ -150,13 +149,11 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
150
149
  const goBackSafe = () => {
151
150
  const goBack = () => {
152
151
  const canGoBack = navigator?.ref?.current?.canGoBack?.();
153
- const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
152
+ const currentRoute: any = navigator?.ref?.current?.getCurrentRoute?.();
154
153
  const params = {
155
154
  appId: context.appId,
156
155
  code: context.code,
157
- screen_name:
158
- (currentRoute?.params as RouteParams)?.screen?.name ??
159
- currentRoute?.name,
156
+ screen_name: currentRoute?.params?.screen?.name ?? currentRoute?.name,
160
157
  trigger_id: '111154000000000000',
161
158
  icon_name: 'back',
162
159
  };
@@ -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 = translations;
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') {
@@ -248,11 +248,6 @@ export type AnimatedHeader = {
248
248
  headerTitle?: (props?: any) => React.ReactElement;
249
249
  };
250
250
 
251
- export interface RouteParams {
252
- screen?: {
253
- name?: string;
254
- };
255
- }
256
251
  type NavigatorActionSuccessCallbackType = {
257
252
  status: NavigationActionCallbackStatusEnum.Success;
258
253
  };
@@ -7,7 +7,6 @@ import {Icon} from '../Icon';
7
7
  import {Image} from '../Image';
8
8
  import {scaleSize, Text} from '../Text';
9
9
  import {PopupNotifyProps} from './types';
10
- import {RouteParams} from '../Application/types';
11
10
 
12
11
  const PopupNotify: React.FC<PopupNotifyProps> = ({
13
12
  id,
@@ -34,12 +33,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
34
33
  * tracking
35
34
  */
36
35
  useEffect(() => {
37
- const routes = navigator?.ref.current?.getRootState()?.routes || [];
36
+ const routes: any = navigator?.ref.current?.getRootState()?.routes || [];
38
37
  const routesLength = routes.length;
39
- let screen_name = (routes?.[0]?.params as RouteParams)?.screen?.name;
38
+ let screen_name = routes?.[0]?.params?.screen?.name;
40
39
  if (routesLength > 1) {
41
- screen_name = (routes[routesLength - 2]?.params as RouteParams)?.screen
42
- ?.name;
40
+ screen_name = routes[routesLength - 2]?.params?.screen?.name;
43
41
  }
44
42
  const tracking = {
45
43
  appId: context.appId,
@@ -5,7 +5,6 @@ import {ApplicationContext, MiniAppContext} from '../Application';
5
5
  import {Image} from '../Image';
6
6
  import {Radius, Spacing} from '../Consts';
7
7
  import {Icon} from '../Icon';
8
- import {RouteParams} from '../Application/types';
9
8
 
10
9
  const PopupPromotion: React.FC<PopupPromotionProps> = ({
11
10
  id,
@@ -20,12 +19,11 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
20
19
  * tracking
21
20
  */
22
21
  useEffect(() => {
23
- const routes = navigator?.ref.current?.getRootState()?.routes || [];
22
+ const routes: any = navigator?.ref.current?.getRootState()?.routes || [];
24
23
  const routesLength = routes.length;
25
- let screen_name = (routes?.[0]?.params as RouteParams)?.screen?.name;
24
+ let screen_name = routes?.[0]?.params?.screen?.name;
26
25
  if (routesLength > 1) {
27
- screen_name = (routes[routesLength - 2]?.params as RouteParams)?.screen
28
- ?.name;
26
+ screen_name = routes[routesLength - 2]?.params?.screen?.name;
29
27
  }
30
28
  const tracking = {
31
29
  appId: context.appId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.103.1-beta.2",
3
+ "version": "0.103.1-beta.4",
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"