@momo-kits/foundation 0.81.43-beta.17 → 0.81.43-beta.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.
@@ -55,7 +55,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
55
55
  return <BadgeDot size="small" style={styles.badgeDot} />;
56
56
  }
57
57
 
58
- if (!!badgeValue && isNaN(Number(badgeValue))) return null;
58
+ if (isNaN(Number(badgeValue))) return null;
59
59
 
60
60
  return <Badge label={badgeValue} style={styles.badge} />;
61
61
  }, [badgeType, badgeValue]);
@@ -290,7 +290,7 @@ const HeaderToolkitAction: React.FC<any> = ({
290
290
  }) => {
291
291
  const {theme, navigator} = useContext(ApplicationContext);
292
292
  const [toolConfig, setToolConfig] = useState<any>();
293
- const {onAction} = toolConfig ?? {};
293
+ const {appCode, onAction} = toolConfig ?? {};
294
294
 
295
295
  let backgroundColor;
296
296
  if (tintColor != Colors.black_01) {
@@ -305,6 +305,38 @@ const HeaderToolkitAction: React.FC<any> = ({
305
305
  }
306
306
  }, []);
307
307
 
308
+ useEffect(() => {
309
+ let addFavorite: any;
310
+ let removeFavorite: any;
311
+ if (appCode) {
312
+ const addSchema = `observerToolkit_addFavorite_${appCode}`;
313
+ const removeSchema = `observerToolkit_removeFavorite_${appCode}`;
314
+ addFavorite = navigator?.requestApi(
315
+ 'observer',
316
+ [addSchema],
317
+ (data: any) => {
318
+ if (data?.status) {
319
+ getToolkitConfig();
320
+ }
321
+ },
322
+ );
323
+ addFavorite = navigator?.requestApi(
324
+ 'observer',
325
+ [removeSchema],
326
+ (data: any) => {
327
+ if (data?.status) {
328
+ getToolkitConfig();
329
+ }
330
+ },
331
+ );
332
+ }
333
+
334
+ return () => {
335
+ addFavorite?.();
336
+ removeFavorite?.();
337
+ };
338
+ }, [appCode]);
339
+
308
340
  const getToolkitConfig = () => {
309
341
  navigator?.requestApi('getToolsConfig', [undefined], (config: any) => {
310
342
  navigator.toolkitConfig = config;
@@ -320,7 +352,6 @@ const HeaderToolkitAction: React.FC<any> = ({
320
352
  (res: {item: {action?: string; key: string}}) => {
321
353
  const {item} = res;
322
354
  navigator?.toolkitCallback?.(item);
323
- getToolkitConfig();
324
355
  },
325
356
  );
326
357
  };
@@ -361,9 +392,7 @@ const HeaderToolkitAction: React.FC<any> = ({
361
392
  badgeValue={badgeValue}
362
393
  badgeType={badgeType}
363
394
  onPress={() => {
364
- navigator?.requestApi('onToolAction', [pinTool?.key], () => {
365
- getToolkitConfig();
366
- });
395
+ navigator?.requestApi('onToolAction', [pinTool?.key], () => {});
367
396
  navigator?.toolkitCallback?.(pinTool.key);
368
397
  }}
369
398
  />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.43-beta.17",
3
+ "version": "0.81.43-beta.3",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {