@momo-kits/foundation 0.92.1-tracking.2 → 0.92.1-tracking.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.
@@ -29,7 +29,7 @@ import {scaleSize, Text} from '../Text';
29
29
  import {Icon} from '../Icon';
30
30
  import {PopupNotify} from '../Popup';
31
31
  import {Badge, BadgeDot} from '../Badge';
32
- import {getAccessibilityID} from "./utils";
32
+ import {getAccessibilityID} from './utils';
33
33
 
34
34
  const NavigationButton: React.FC<NavigationButtonProps> = ({
35
35
  icon,
@@ -38,7 +38,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
38
38
  useBorder = true,
39
39
  badgeType,
40
40
  badgeValue,
41
- accessibilityID = ''
41
+ accessibilityID = '',
42
42
  }) => {
43
43
  const {theme} = useContext(ApplicationContext);
44
44
  let buttonStyle: ViewStyle = {backgroundColor: '#00000066'};
@@ -65,7 +65,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
65
65
  }
66
66
  }, [badgeType, badgeValue]);
67
67
 
68
- const ID = getAccessibilityID(accessibilityID)
68
+ const ID = getAccessibilityID(accessibilityID);
69
69
  return (
70
70
  <View {...ID} style={{width: scaleSize(28)}}>
71
71
  <TouchableOpacity
@@ -170,9 +170,9 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
170
170
  return true;
171
171
  };
172
172
  return (
173
- <View style={styles.headerLeft}>
173
+ <View style={styles.headerLeft}>
174
174
  <NavigationButton
175
- accessibilityID = "btn_navigation_back"
175
+ accessibilityID="btn_navigation_back"
176
176
  icon="ic_back"
177
177
  tintColor={tintColor}
178
178
  onPress={goBackSafe}
@@ -293,7 +293,7 @@ const HeaderToolkitAction: React.FC<any> = ({
293
293
  tintColor,
294
294
  pinnedTool,
295
295
  runtimeTools = [],
296
- preventBack,
296
+ preventClose,
297
297
  }) => {
298
298
  const {theme, navigator} = useContext(ApplicationContext);
299
299
  const miniContext = useContext(MiniAppContext);
@@ -340,15 +340,15 @@ const HeaderToolkitAction: React.FC<any> = ({
340
340
  };
341
341
 
342
342
  const onClose = () => {
343
- if (preventBack) {
343
+ if (preventClose) {
344
344
  navigator?.showModal({
345
345
  screen: () => (
346
346
  <PopupNotify
347
- {...preventBack}
347
+ {...preventClose}
348
348
  primary={{
349
- title: preventBack.primary.title,
349
+ title: preventClose.primary.title,
350
350
  onPress: () => {
351
- preventBack?.primary.onPress();
351
+ preventClose?.primary.onPress();
352
352
  navigator?.maxApi?.dispatchFunction?.(
353
353
  'dismiss',
354
354
  undefined,
@@ -372,7 +372,7 @@ const HeaderToolkitAction: React.FC<any> = ({
372
372
  if (pinTool)
373
373
  return (
374
374
  <NavigationButton
375
- accessibilityID = "btn_navigation_pin"
375
+ accessibilityID="btn_navigation_pin"
376
376
  icon={pinTool.icon as string}
377
377
  tintColor={tintColor}
378
378
  badgeValue={badgeValue}
@@ -403,14 +403,14 @@ const HeaderToolkitAction: React.FC<any> = ({
403
403
  },
404
404
  ]}>
405
405
  <TouchableOpacity
406
- {...getAccessibilityID("btn_navigation_more")}
407
- onPress={onMore}>
406
+ {...getAccessibilityID('btn_navigation_more')}
407
+ onPress={onMore}>
408
408
  <Icon color={tintColor} source="navigation_more_horiz" size={20} />
409
409
  </TouchableOpacity>
410
410
  <View style={[styles.divider, {backgroundColor: tintColor}]} />
411
411
  <TouchableOpacity
412
- {...getAccessibilityID("btn_navigation_close")}
413
- onPress={onClose}>
412
+ {...getAccessibilityID('btn_navigation_close')}
413
+ onPress={onClose}>
414
414
  <Icon
415
415
  color={tintColor}
416
416
  source="16_navigation_close_circle"
@@ -429,6 +429,7 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
429
429
  animatedValue,
430
430
  image,
431
431
  onPress,
432
+ children,
432
433
  }) => {
433
434
  const scale = animatedValue.interpolate({
434
435
  inputRange: [-300, 0, 300],
@@ -447,19 +448,21 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
447
448
  });
448
449
 
449
450
  return (
450
- <TouchableOpacity onPress={onPress}>
451
+ <TouchableOpacity onPress={onPress} disabled={!onPress}>
451
452
  <Animated.View
452
453
  style={{
453
454
  height: 210,
454
455
  opacity: opacity,
455
456
  transform: [{scale}, {translateY}],
456
457
  }}>
457
- <Image
458
- source={{
459
- uri: image,
460
- }}
461
- style={{width: '100%', height: '100%'}}
462
- />
458
+ {children ?? (
459
+ <Image
460
+ source={{
461
+ uri: image,
462
+ }}
463
+ style={{width: '100%', height: '100%'}}
464
+ />
465
+ )}
463
466
  </Animated.View>
464
467
  </TouchableOpacity>
465
468
  );
@@ -4,10 +4,8 @@ import {
4
4
  HeaderAnimated,
5
5
  HeaderBackground,
6
6
  HeaderCustom,
7
- HeaderLeft,
8
7
  HeaderRightAction,
9
8
  HeaderTitle,
10
- HeaderToolkitAction,
11
9
  NavigationButton,
12
10
  } from './Components';
13
11
  import BottomTab from './BottomTab';
@@ -32,10 +30,8 @@ export {
32
30
  BottomTab,
33
31
  NavigationButton,
34
32
  HeaderTitle,
35
- HeaderLeft,
36
33
  HeaderBackground,
37
34
  HeaderRightAction,
38
- HeaderToolkitAction,
39
35
  HeaderCustom,
40
36
  HeaderAnimated,
41
37
  };
@@ -1,4 +1,4 @@
1
- import {Animated} from 'react-native';
1
+ import {Animated, ViewProps} from 'react-native';
2
2
  import {StackNavigationOptions} from '@react-navigation/stack';
3
3
  import React from 'react';
4
4
  import Navigator from './Navigator';
@@ -154,6 +154,7 @@ export interface NavigationOptions extends StackNavigationOptions {
154
154
  toolkitParams?: {
155
155
  pinnedTool?: PinnedToolType;
156
156
  runtimeTools?: RuntimeToolType[];
157
+ preventClose?: PopupNotifyProps;
157
158
  };
158
159
  }
159
160
 
@@ -185,11 +186,11 @@ export type HeaderToolkitProps = {
185
186
  configs: any[];
186
187
  };
187
188
 
188
- export type HeaderAnimatedProps = {
189
+ export interface HeaderAnimatedProps extends ViewProps {
189
190
  animatedValue: Animated.Value;
190
191
  image: string;
191
192
  onPress?: () => void;
192
- };
193
+ }
193
194
 
194
195
  export type BottomTabItemProps = {
195
196
  name: string;
@@ -131,14 +131,7 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
131
131
  options = {
132
132
  ...options,
133
133
  headerRight: (props: any) => {
134
- return (
135
- <HeaderToolkitAction
136
- preventBack={params.preventBack}
137
- pinnedTool={params.toolkitParams?.pinnedTool}
138
- runtimeTools={params.toolkitParams?.runtimeTools}
139
- {...props}
140
- />
141
- );
134
+ return <HeaderToolkitAction {...params.toolkitParams} {...props} />;
142
135
  },
143
136
  };
144
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.1-tracking.2",
3
+ "version": "0.92.1-tracking.4",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
package/verify.js CHANGED
@@ -2,21 +2,24 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
4
  try {
5
- const package = path.join(`${__dirname}`, 'package.json');
6
- const packageInfo = JSON.parse(fs.readFileSync(package, 'utf8'));
5
+ const packageInfo = JSON.parse(
6
+ fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8'),
7
+ );
7
8
  const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
8
9
 
9
10
  const app = path.join(`${__dirname}/../../../`, 'app.json');
10
11
  const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
12
+
13
+ if (!fs.existsSync(app) || fs.existsSync(miniJson)) {
14
+ return;
15
+ }
16
+
11
17
  const appInfo = JSON.parse(fs.readFileSync(app, 'utf8'));
12
18
  const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
19
+
13
20
  const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
14
21
  const androidAppTarget = appInfo?.client?.android.deploymentTarget;
15
22
 
16
- if (Object.values(appInfo).length < 1) {
17
- return;
18
- }
19
-
20
23
  if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
21
24
  console.error(
22
25
  `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,