@momo-kits/foundation 0.92.1-tracking.2 → 0.92.1-tracking.21

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.
@@ -17,11 +17,12 @@ import {
17
17
  } from './common';
18
18
  import {InputTextAreaProps} from './index';
19
19
  import {Icon} from '../Icon';
20
- import {ApplicationContext, MiniAppContext} from '../Application';
21
- import {getAccessibilityID} from "../Application/utils";
20
+ import {ApplicationContext} from '../Application';
21
+ import {getAccessibilityID} from '../Application/utils';
22
22
 
23
23
  const {
24
- ScreenContext,
24
+ ScreenContext,
25
+ MiniAppContext,
25
26
  } = require('react-native/Libraries/Components/ScreenContext');
26
27
 
27
28
  const InputTextArea = forwardRef(
@@ -48,8 +49,8 @@ const InputTextArea = forwardRef(
48
49
  ref,
49
50
  ) => {
50
51
  const {theme} = useContext(ApplicationContext);
51
- const screenInfo = useContext<any>(ScreenContext);
52
- const {appId} = useContext(MiniAppContext)
52
+ const screenInfo = useContext<any>(ScreenContext);
53
+ const {appId} = useContext<any>(MiniAppContext);
53
54
  const [focused, setFocused] = useState(false);
54
55
  const [inputValue, setInputValue] = useState(defaultValue ?? '');
55
56
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
@@ -95,6 +96,12 @@ const InputTextArea = forwardRef(
95
96
  placeholderColor = disabledColor;
96
97
  }
97
98
 
99
+ const accessibilityID = getAccessibilityID(
100
+ `${appId}/${screenInfo.screenName}/input_${floatingValue}${
101
+ disabled && '_disabled'
102
+ }`,
103
+ );
104
+
98
105
  return (
99
106
  <View
100
107
  style={[
@@ -116,6 +123,7 @@ const InputTextArea = forwardRef(
116
123
  <View style={styles.textAreaView}>
117
124
  <TextInput
118
125
  {...props}
126
+ {...accessibilityID}
119
127
  ref={inputRef}
120
128
  editable={!disabled}
121
129
  textAlignVertical="top"
@@ -153,12 +161,9 @@ const InputTextArea = forwardRef(
153
161
  </View>
154
162
  );
155
163
  };
156
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
157
164
 
158
165
  return (
159
- <View
160
- {...accessibilityID}
161
- style={[style, styles.wrapper]}>
166
+ <View style={[style, styles.wrapper]}>
162
167
  {renderInputView()}
163
168
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
164
169
  </View>
package/Input/styles.ts CHANGED
@@ -7,7 +7,7 @@ export default StyleSheet.create({
7
7
  input: {
8
8
  flex: 1,
9
9
  paddingLeft: Spacing.M,
10
- fontSize: scaleSize(15),
10
+ fontSize: scaleSize(14),
11
11
  },
12
12
  wrapper: {
13
13
  width: '100%',
@@ -75,7 +75,7 @@ export default StyleSheet.create({
75
75
  flex: 1,
76
76
  paddingRight: Spacing.XS,
77
77
  paddingVertical: Spacing.XS,
78
- fontSize: scaleSize(15),
78
+ fontSize: scaleSize(14),
79
79
  },
80
80
  textAreaWrapper: {
81
81
  borderWidth: 1,
@@ -108,7 +108,7 @@ export default StyleSheet.create({
108
108
  height: 36,
109
109
  marginLeft: Spacing.S,
110
110
  flex: 1,
111
- fontSize: scaleSize(15),
111
+ fontSize: scaleSize(14),
112
112
  paddingVertical: Spacing.XS,
113
113
  },
114
114
  searchInputView: {
@@ -4,10 +4,14 @@ import {PopupNotifyProps} from './types';
4
4
  import {Radius, Spacing, Styles} from '../Consts';
5
5
  import {Image} from '../Image';
6
6
  import {Text} from '../Text';
7
- import {ApplicationContext, MiniAppContext} from '../Application';
7
+ import {ApplicationContext} from '../Application';
8
8
  import {Button} from '../Button';
9
9
  import {Icon} from '../Icon';
10
- import {getAccessibilityID} from "../Application/utils";
10
+ import {getAccessibilityID} from '../Application/utils';
11
+
12
+ const {
13
+ MiniAppContext,
14
+ } = require('react-native/Libraries/Components/ScreenContext');
11
15
 
12
16
  const PopupNotify: React.FC<PopupNotifyProps> = ({
13
17
  id,
@@ -20,7 +24,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
20
24
  buttonDirection = 'row',
21
25
  onIconClose,
22
26
  }) => {
23
- const context = useContext(MiniAppContext);
27
+ const context = useContext<any>(MiniAppContext);
24
28
  const {theme, navigator, translate} = useContext(ApplicationContext);
25
29
  const [scrollContent, setScrollContent] = useState(false);
26
30
  const closeAction = useRef('touch_outside');
@@ -109,13 +113,10 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
109
113
  );
110
114
  };
111
115
  const renderColumn = () => {
112
- const accessibilityPrimaryID = getAccessibilityID('btn_popup_allow')
113
- const accessibilitySecondID = getAccessibilityID('btn_popup_cancel')
114
-
115
116
  return (
116
117
  <View style={Styles.columnCenter}>
117
118
  <Button
118
- {...accessibilityPrimaryID}
119
+ accessibilityLabel={'btn_popup_allow'}
119
120
  title={primary.title}
120
121
  size="medium"
121
122
  onPress={() => {
@@ -127,7 +128,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
127
128
  <>
128
129
  <View style={styles.buttonSpace} />
129
130
  <Button
130
- {...accessibilitySecondID}
131
+ accessibilityLabel={'btn_popup_cancel'}
131
132
  title={secondary?.title}
132
133
  type="text"
133
134
  size="medium"
@@ -161,11 +162,9 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
161
162
  * build close action
162
163
  */
163
164
  const buildCloseIcon = () => {
164
- const accessibilityCloseID = getAccessibilityID('ic_popup_close')
165
-
166
165
  return (
167
166
  <TouchableOpacity
168
- {...accessibilityCloseID}
167
+ {...getAccessibilityID?.('ic_popup_close')}
169
168
  style={styles.iconCloseContainer}
170
169
  onPress={() => {
171
170
  closeAction.current = 'icon_close';
@@ -189,11 +188,9 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
189
188
  );
190
189
  };
191
190
 
192
- const accessibilityID = getAccessibilityID(`pu_${context.code}_notify`)
193
-
194
191
  return (
195
192
  <View
196
- {...accessibilityID}
193
+ {...getAccessibilityID?.(`pu_${context.code}_notify`)}
197
194
  style={[
198
195
  styles.container,
199
196
  {backgroundColor: theme.colors.background.surface},
@@ -1,18 +1,22 @@
1
1
  import React, {useContext, useEffect, useRef} from 'react';
2
2
  import {StyleSheet, TouchableOpacity, View} from 'react-native';
3
3
  import {PopupPromotionProps} from './types';
4
- import {ApplicationContext, MiniAppContext} from '../Application';
4
+ import {ApplicationContext} from '../Application';
5
5
  import {Image} from '../Image';
6
6
  import {Radius, Spacing} from '../Consts';
7
7
  import {Icon} from '../Icon';
8
- import {getAccessibilityID} from "../Application/utils";
8
+ import {getAccessibilityID} from '../Application/utils';
9
+
10
+ const {
11
+ MiniAppContext,
12
+ } = require('react-native/Libraries/Components/ScreenContext');
9
13
 
10
14
  const PopupPromotion: React.FC<PopupPromotionProps> = ({
11
15
  id,
12
16
  image,
13
17
  onIconClose,
14
18
  }) => {
15
- const context = useContext(MiniAppContext);
19
+ const context = useContext<any>(MiniAppContext);
16
20
  const {theme, navigator} = useContext(ApplicationContext);
17
21
  const closeAction = useRef('touch_outside');
18
22
 
@@ -49,10 +53,10 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
49
53
  * build close action
50
54
  */
51
55
  const buildCloseIcon = () => {
52
- const accessibilityCloseID = getAccessibilityID('ic_popup_close')
53
-
54
56
  return (
55
- <View {...accessibilityCloseID} style={styles.iconCloseContainer}>
57
+ <View
58
+ {...getAccessibilityID?.('ic_popup_close')}
59
+ style={styles.iconCloseContainer}>
56
60
  <TouchableOpacity
57
61
  onPress={() => {
58
62
  closeAction.current = 'icon_close';
@@ -78,12 +82,9 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
78
82
  </View>
79
83
  );
80
84
  };
81
- const accessibilityID = getAccessibilityID(`pu_${context.code}_promotion`)
82
85
 
83
86
  return (
84
- <View
85
- {...accessibilityID}
86
- >
87
+ <View {...getAccessibilityID?.(`pu_${context.code}_promotion`)}>
87
88
  <Image
88
89
  source={{
89
90
  uri: image,
package/Radio/index.tsx CHANGED
@@ -4,12 +4,13 @@ import {TouchableOpacity, View} from 'react-native';
4
4
  import {RadioProps} from './types';
5
5
  import {Text} from '../Text';
6
6
  import styles from './styles';
7
- import {ApplicationContext, MiniAppContext} from '../Application';
7
+ import {ApplicationContext} from '../Application';
8
8
  import {Spacing} from '../Consts';
9
9
  import {formatNameLength, getAccessibilityID} from '../Application/utils';
10
10
 
11
11
  const {
12
12
  ScreenContext,
13
+ MiniAppContext,
13
14
  } = require('react-native/Libraries/Components/ScreenContext');
14
15
 
15
16
  const Radio: FC<RadioProps> = ({
@@ -22,7 +23,7 @@ const Radio: FC<RadioProps> = ({
22
23
  params,
23
24
  componentId,
24
25
  }) => {
25
- const {appId} = useContext(MiniAppContext)
26
+ const {appId} = useContext<any>(MiniAppContext);
26
27
  const {theme} = useContext(ApplicationContext);
27
28
  const screenInfo = useContext<any>(ScreenContext);
28
29
  const selected = value === groupValue;
@@ -45,7 +46,10 @@ const Radio: FC<RadioProps> = ({
45
46
  : theme.colors.text.disable,
46
47
  };
47
48
  }
48
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|rdo_${label}_${value}`)
49
+
50
+ const accessibilityID = getAccessibilityID?.(
51
+ `${appId}/${screenInfo.screenName}/rdo_${label}_${value}`,
52
+ );
49
53
 
50
54
  return (
51
55
  <ScreenContext.Provider
@@ -60,7 +64,7 @@ const Radio: FC<RadioProps> = ({
60
64
  action: 'click',
61
65
  }}>
62
66
  <TouchableOpacity
63
- {...accessibilityID}
67
+ {...accessibilityID}
64
68
  onPress={onChange}
65
69
  disabled={disabled}
66
70
  style={[
package/Switch/index.tsx CHANGED
@@ -3,15 +3,15 @@ import {TouchableOpacity, View} from 'react-native';
3
3
  import {SwitchProps} from './types';
4
4
  import styles from './styles';
5
5
  import {Colors} from '../Consts';
6
- import {getAccessibilityID} from "../Application/utils";
7
- import {MiniAppContext} from "../Application";
6
+ import {getAccessibilityID} from '../Application/utils';
8
7
 
9
8
  const {
10
9
  ScreenContext,
10
+ MiniAppContext,
11
11
  } = require('react-native/Libraries/Components/ScreenContext');
12
12
 
13
13
  const Switch: FC<SwitchProps> = props => {
14
- const {appId} = useContext(MiniAppContext)
14
+ const {appId} = useContext<any>(MiniAppContext);
15
15
  const {value, onChange, disabled, style, params, componentId} = props;
16
16
  const screenInfo = useContext<any>(ScreenContext);
17
17
 
@@ -22,7 +22,10 @@ const Switch: FC<SwitchProps> = props => {
22
22
  if (disabled) {
23
23
  backgroundColor = value ? Colors.green_09 : Colors.black_05;
24
24
  }
25
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|swt_${value}`)
25
+
26
+ const accessibilityID = getAccessibilityID?.(
27
+ `${appId}/${screenInfo.screenName}/swt_${value}`,
28
+ );
26
29
 
27
30
  return (
28
31
  <ScreenContext.Provider
@@ -36,7 +39,7 @@ const Switch: FC<SwitchProps> = props => {
36
39
  action: 'click',
37
40
  }}>
38
41
  <TouchableOpacity
39
- {...accessibilityID}
42
+ {...accessibilityID}
40
43
  disabled={disabled}
41
44
  onPress={() => onChange?.(!value)}
42
45
  style={[
package/Text/index.tsx CHANGED
@@ -51,8 +51,9 @@ export interface TextProps extends RNTextProps {
51
51
  */
52
52
  color?: string;
53
53
  }
54
+
54
55
  const Text: React.FC<TextProps> = ({
55
- typography,
56
+ typography = 'body_default_regular',
56
57
  color,
57
58
  children,
58
59
  style,
@@ -94,6 +95,7 @@ const Text: React.FC<TextProps> = ({
94
95
  };
95
96
 
96
97
  const textStyle = getTypoStyle(typography);
98
+
97
99
  return (
98
100
  <RNText
99
101
  {...rest}
@@ -103,8 +105,4 @@ const Text: React.FC<TextProps> = ({
103
105
  );
104
106
  };
105
107
 
106
- Text.defaultProps = {
107
- typography: 'body_default_regular',
108
- };
109
-
110
108
  export {Text, scaleSize};
package/Text/styles.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export default {
2
- headline_default_bold: {fontSize: 24, lineHeight: 32, fontWeight: '700'},
3
- header_m_bold: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
2
+ headline_default_bold: {fontSize: 24, lineHeight: 34, fontWeight: '700'},
3
+ header_m_bold: {fontSize: 18, lineHeight: 26, fontWeight: '700'},
4
4
  header_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
5
5
  header_s_semibold: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
6
- header_xs_semibold: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
6
+ header_xs_semibold: {fontSize: 12, lineHeight: 18, fontWeight: '600'},
7
7
  body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
8
8
  body_regularstrikethrought: {
9
9
  fontSize: 14,
@@ -13,12 +13,12 @@ export default {
13
13
  },
14
14
  description_default_regular: {
15
15
  fontSize: 12,
16
- lineHeight: 16,
16
+ lineHeight: 18,
17
17
  fontWeight: '400',
18
18
  },
19
19
  description_default_regularstrikethrought: {
20
20
  fontSize: 12,
21
- lineHeight: 16,
21
+ lineHeight: 18,
22
22
  fontWeight: '400',
23
23
  textDecorationLine: 'line-through',
24
24
  },
@@ -30,11 +30,11 @@ export default {
30
30
  textDecorationLine: 'line-through',
31
31
  },
32
32
  label_default_medium: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
33
- label_s_medium: {fontSize: 12, lineHeight: 16, fontWeight: '500'},
33
+ label_s_medium: {fontSize: 12, lineHeight: 18, fontWeight: '500'},
34
34
  label_xs_medium: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
35
35
  action_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
36
36
  action_s_bold: {fontSize: 14, lineHeight: 20, fontWeight: '700'},
37
- action_xs_bold: {fontSize: 12, lineHeight: 16, fontWeight: '700'},
37
+ action_xs_bold: {fontSize: 12, lineHeight: 18, fontWeight: '700'},
38
38
  action_xxs_bold: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
39
39
  /**non-support**/
40
40
  headline_default: {
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.21",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -14,6 +14,7 @@
14
14
  "react-native-safe-area-context": "3.1.4",
15
15
  "react-native-linear-gradient": "2.8.3",
16
16
  "react-native-gesture-handler": "1.10.3",
17
+ "react-native-modalize": "2.1.1",
17
18
  "react-native-fast-image": "8.1.5",
18
19
  "@react-navigation/bottom-tabs": "git+https://gitlab.com/momo-platform/react-navigation-bottom-tabs.git#main",
19
20
  "@react-navigation/core": "5.16.1",
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}`,