@momo-kits/foundation 0.81.43-tracking.4 → 0.81.43-tracking.6

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.
@@ -308,15 +308,19 @@ const HeaderToolkitAction: React.FC<any> = ({
308
308
  }, []);
309
309
 
310
310
  const getToolkitConfig = () => {
311
- navigator?.requestApi('getToolsConfig', [undefined], (config: any) => {
312
- navigator.toolkitConfig = config;
313
- setToolConfig(navigator?.toolkitConfig);
314
- });
311
+ navigator?.maxApi?.dispatchFunction?.(
312
+ 'getToolsConfig',
313
+ [undefined],
314
+ (config: any) => {
315
+ navigator.toolkitConfig = config;
316
+ setToolConfig(navigator?.toolkitConfig);
317
+ },
318
+ );
315
319
  };
316
320
 
317
321
  const onMore = () => {
318
322
  onAction?.('onMore');
319
- navigator?.requestApi(
323
+ navigator?.maxApi?.dispatchFunction?.(
320
324
  'showTools',
321
325
  [undefined],
322
326
  (res: {item: {action?: string; key: string}}) => {
@@ -337,14 +341,18 @@ const HeaderToolkitAction: React.FC<any> = ({
337
341
  title: preventBack.primary.title,
338
342
  onPress: () => {
339
343
  preventBack?.primary.onPress();
340
- navigator?.requestApi('dismiss', undefined, undefined);
344
+ navigator?.maxApi?.dispatchFunction?.(
345
+ 'dismiss',
346
+ undefined,
347
+ undefined,
348
+ );
341
349
  },
342
350
  }}
343
351
  />
344
352
  ),
345
353
  });
346
354
  } else {
347
- navigator?.requestApi('dismiss', undefined, undefined);
355
+ navigator?.maxApi?.dispatchFunction?.('dismiss', undefined, undefined);
348
356
  }
349
357
  };
350
358
 
@@ -362,9 +370,13 @@ const HeaderToolkitAction: React.FC<any> = ({
362
370
  badgeValue={badgeValue}
363
371
  badgeType={badgeType}
364
372
  onPress={() => {
365
- navigator?.requestApi('onToolAction', [pinTool?.key], () => {
366
- getToolkitConfig();
367
- });
373
+ navigator?.maxApi?.dispatchFunction?.(
374
+ 'onToolAction',
375
+ [pinTool?.key],
376
+ () => {
377
+ getToolkitConfig();
378
+ },
379
+ );
368
380
  navigator?.toolkitCallback?.(pinTool.key);
369
381
  }}
370
382
  />
@@ -109,18 +109,6 @@ class Navigator {
109
109
  );
110
110
  };
111
111
 
112
- /**
113
- * request max api for mini app
114
- * @param func
115
- * @param args
116
- * @param callback
117
- */
118
- requestApi = (func: any, args: any = [], callback: any) => {
119
- if (this.maxApi) {
120
- this.maxApi[func]?.(...args, callback);
121
- }
122
- };
123
-
124
112
  setToolkitCallback = (
125
113
  callback: (item: {key: string; action: string}) => void,
126
114
  ) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.43-tracking.4",
3
+ "version": "0.81.43-tracking.6",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {