@momo-kits/foundation 0.103.1-beta.0 → 0.103.1-beta.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.
@@ -26,6 +26,7 @@ import {
26
26
  HeaderBackgroundProps,
27
27
  HeaderBackProps,
28
28
  NavigationButtonProps,
29
+ RouteParams,
29
30
  TitleCustomProps,
30
31
  } from './types';
31
32
  import {scaleSize, Text} from '../Text';
@@ -153,7 +154,9 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
153
154
  const params = {
154
155
  appId: context.appId,
155
156
  code: context.code,
156
- screen_name: currentRoute?.params?.screen?.name ?? currentRoute?.name,
157
+ screen_name:
158
+ (currentRoute?.params as RouteParams)?.screen?.name ??
159
+ currentRoute?.name,
157
160
  trigger_id: '111154000000000000',
158
161
  icon_name: 'back',
159
162
  };
@@ -337,7 +340,6 @@ const HeaderRight: React.FC<any> = ({type, children, onLayout, ...props}) => {
337
340
  const HeaderToolkitAction: React.FC<any> = ({
338
341
  tintColor,
339
342
  pinnedTool,
340
- runtimeTools = [],
341
343
  preventClose,
342
344
  }) => {
343
345
  const {navigator} = useContext(ApplicationContext);
@@ -374,13 +376,15 @@ const HeaderToolkitAction: React.FC<any> = ({
374
376
  const onMore = () => {
375
377
  onAction?.('onMore');
376
378
  navigator?.maxApi?.dispatchFunction?.(
377
- 'showTools',
378
- {runtimeTools},
379
- (res: {item: {action?: string; key: string}}) => {
380
- const {item} = res;
381
- navigator?.toolkitCallback?.(item.key);
382
- getToolkitConfig();
383
- }
379
+ 'showToolkit',
380
+ {
381
+ tools: miniContext?.toolkitConfig?.oldTools ?? [
382
+ 'addFavorite',
383
+ 'addShortcut',
384
+ 'share',
385
+ ],
386
+ },
387
+ () => {}
384
388
  );
385
389
  };
386
390
 
@@ -248,6 +248,11 @@ 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
+ }
251
256
  type NavigatorActionSuccessCallbackType = {
252
257
  status: NavigationActionCallbackStatusEnum.Success;
253
258
  };
@@ -7,6 +7,7 @@ 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';
10
11
 
11
12
  const PopupNotify: React.FC<PopupNotifyProps> = ({
12
13
  id,
@@ -35,9 +36,10 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
35
36
  useEffect(() => {
36
37
  const routes = navigator?.ref.current?.getRootState()?.routes || [];
37
38
  const routesLength = routes.length;
38
- let screen_name = routes?.[0]?.params?.screen?.name;
39
+ let screen_name = (routes?.[0]?.params as RouteParams)?.screen?.name;
39
40
  if (routesLength > 1) {
40
- screen_name = routes[routesLength - 2]?.params?.screen?.name;
41
+ screen_name = (routes[routesLength - 2]?.params as RouteParams)?.screen
42
+ ?.name;
41
43
  }
42
44
  const tracking = {
43
45
  appId: context.appId,
@@ -5,6 +5,7 @@ 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';
8
9
 
9
10
  const PopupPromotion: React.FC<PopupPromotionProps> = ({
10
11
  id,
@@ -21,9 +22,10 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
21
22
  useEffect(() => {
22
23
  const routes = navigator?.ref.current?.getRootState()?.routes || [];
23
24
  const routesLength = routes.length;
24
- let screen_name = routes?.[0]?.params?.screen?.name;
25
+ let screen_name = (routes?.[0]?.params as RouteParams)?.screen?.name;
25
26
  if (routesLength > 1) {
26
- screen_name = routes[routesLength - 2]?.params?.screen?.name;
27
+ screen_name = (routes[routesLength - 2]?.params as RouteParams)?.screen
28
+ ?.name;
27
29
  }
28
30
  const tracking = {
29
31
  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.0",
3
+ "version": "0.103.1-beta.2",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},