@momo-kits/foundation 0.109.1-optimize.17-beta.19 → 0.109.1-optimize.18

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.
@@ -16,7 +16,7 @@ import {
16
16
  View,
17
17
  } from 'react-native';
18
18
  import {EdgeInsets, useSafeAreaInsets} from 'react-native-safe-area-context';
19
- import {Colors, Radius} from '../../Consts';
19
+ import {Radius} from '../../Consts';
20
20
  import {Icon} from '../../Icon';
21
21
  import {Text} from '../../Text';
22
22
  import {FloatingButtonProps} from '../types';
@@ -207,7 +207,7 @@ export default function BottomTabBar({
207
207
  return (
208
208
  <Animated.View
209
209
  style={[
210
- floatingButton ? styles.tabBarFloatingButton : styles.tabBar,
210
+ styles.tabBar,
211
211
  {
212
212
  backgroundColor: theme.colors.background.surface,
213
213
  borderTopColor: theme.colors.border.default,
@@ -253,17 +253,6 @@ const styles = StyleSheet.create({
253
253
  borderTopWidth: StyleSheet.hairlineWidth,
254
254
  elevation: 8,
255
255
  },
256
- tabBarFloatingButton: {
257
- left: 0,
258
- right: 0,
259
- bottom: 0,
260
- zIndex: 1,
261
- shadowColor: Colors.black_20,
262
- shadowOffset: {width: 0, height: -2},
263
- shadowOpacity: 0.05,
264
- shadowRadius: 3,
265
- elevation: 8,
266
- },
267
256
  floatingContainer: {
268
257
  position: 'absolute',
269
258
  alignItems: 'center',
@@ -7,7 +7,7 @@ import {EventArg} from '@react-navigation/core';
7
7
  import {useSafeAreaInsets} from 'react-native-safe-area-context';
8
8
  import {Colors} from '../../Consts';
9
9
  import {Icon} from '../../Icon';
10
- import {exportFontFamily, Text} from '../../Text';
10
+ import {Text} from '../../Text';
11
11
  import {ApplicationContext} from '../index';
12
12
  import StackScreen from '../StackScreen';
13
13
  import {BottomTabProps, NavigationScreenProps} from '../types';
@@ -146,7 +146,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
146
146
  lineHeight: Platform.OS === 'android' ? 17 : 14,
147
147
  fontWeight: 'bold',
148
148
  alignSelf: 'center',
149
- fontFamily: exportFontFamily('bold'),
149
+ fontFamily: `${theme.font}-Bold`,
150
150
  left: isDot ? 8 : 4,
151
151
  top: isDot ? -2 : -6,
152
152
  backgroundColor: isNum ? Colors.red_03 : Colors.orange_03,
@@ -13,7 +13,7 @@ const LinearGradientAnimated = Animated.createAnimatedComponent(LinearGradient);
13
13
  */
14
14
  const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
15
15
  image,
16
- animatedValue = new Animated.Value(0),
16
+ animatedValue,
17
17
  useGradient = true,
18
18
  useShadowHeader = true,
19
19
  gradientColor,
@@ -46,7 +46,6 @@ const HeaderExtendHeader: React.FC<{
46
46
  const gradientColor = customGradientColor ?? theme.colors.gradient;
47
47
  const headerBackground = customBackground ?? theme.assets?.headerBackground;
48
48
  const leftPosition = inputSearchProps?.leftPosition || BACK_WIDTH + 20;
49
- const isIos = Platform.OS === 'ios';
50
49
 
51
50
  const opacityBackground = animatedValue?.interpolate({
52
51
  inputRange: [0, 52],
@@ -95,9 +94,7 @@ const HeaderExtendHeader: React.FC<{
95
94
  <Animated.View style={{height: height}} />
96
95
  <Animated.View
97
96
  style={[
98
- isIos && useShadowHeader
99
- ? styles.shadowHeader
100
- : styles.dividerHeader,
97
+ useShadowHeader ? styles.shadowHeader : styles.dividerHeader,
101
98
  {
102
99
  backgroundColor: theme.colors.background.surface,
103
100
  opacity: opacityBackground,
@@ -247,14 +244,8 @@ const styles = StyleSheet.create({
247
244
  shadowRadius: 10,
248
245
  },
249
246
  android: {
250
- shadowColor: Colors.black_17,
251
- shadowOffset: {
252
- width: 3,
253
- height: 3,
254
- },
255
- shadowOpacity: 0.12,
256
- shadowRadius: 10,
257
- elevation: 10,
247
+ borderBottomWidth: 1,
248
+ borderColor: Colors.black_04,
258
249
  },
259
250
  }),
260
251
  },
@@ -65,7 +65,7 @@ const HeaderToolkitAction: React.FC<any> = ({
65
65
  if (useShortcut) {
66
66
  checkAppIsFavorite();
67
67
  }
68
- }, [useShortcut, useMore, tools]);
68
+ }, []);
69
69
 
70
70
  let buttonStyle: ViewStyle = {};
71
71
  if (tintColor === Colors.black_01) {
@@ -147,9 +147,6 @@ const HeaderToolkitAction: React.FC<any> = ({
147
147
  const onPressHelpCenter = () => {
148
148
  const appName = translate?.(context?.name);
149
149
  const appDescription = translate?.(context?.description);
150
- const isShowDescription =
151
- context?.description && Object.keys(context?.description).length > 0;
152
-
153
150
  navigator?.showBottomSheet({
154
151
  options: {
155
152
  header: (
@@ -160,7 +157,7 @@ const HeaderToolkitAction: React.FC<any> = ({
160
157
  />
161
158
  <View>
162
159
  <Text typography={'label_default_medium'}>{appName}</Text>
163
- {isShowDescription && (
160
+ {!!appDescription && (
164
161
  <Text
165
162
  typography={'description_default_regular'}
166
163
  color={Colors.black_12}>
@@ -7,7 +7,7 @@ import {
7
7
  View,
8
8
  } from 'react-native';
9
9
  import {ApplicationContext, MiniAppContext} from '../index';
10
- import {exportFontFamily, scaleSize, Text} from '../../Text';
10
+ import {scaleSize, Text} from '../../Text';
11
11
  import {Colors, Spacing, Styles} from '../../Consts';
12
12
  import {TitleJourneyProps, TitleLocationProps, TitleUserProps} from '../types';
13
13
  import {Image} from '../../Image';
@@ -17,6 +17,7 @@ import {Icon} from '../../Icon';
17
17
  * default header title used for nav
18
18
  */
19
19
  const HeaderTitle: React.FC<any> = props => {
20
+ const {theme} = useContext(ApplicationContext);
20
21
  const opacity = props.animatedValue?.interpolate(
21
22
  props.interpolate ?? {
22
23
  inputRange: [0, 200],
@@ -32,11 +33,7 @@ const HeaderTitle: React.FC<any> = props => {
32
33
  accessibilityLabel={'title_navigation_header'}
33
34
  style={[
34
35
  styles.title,
35
- {
36
- fontFamily: exportFontFamily('bold', 'action_xs_bold'),
37
- opacity,
38
- color: props.tintColor,
39
- },
36
+ {fontFamily: `${theme.font}-Bold`, opacity, color: props.tintColor},
40
37
  ]}
41
38
  numberOfLines={1}
42
39
  />
@@ -194,18 +191,13 @@ const TitleJourney: React.FC<TitleJourneyProps> = ({
194
191
  tintColor,
195
192
  onPress,
196
193
  }) => {
197
- const {width} = Dimensions.get('screen');
198
- const startWidth = width * 0.25;
199
- const endWidth = width * 0.75 - 212;
200
194
  return (
201
- <TouchableOpacity style={styles.headerTitleContainer} onPress={onPress}>
195
+ <TouchableOpacity
196
+ style={[styles.headerTitleContainer, {overflow: 'hidden'}]}
197
+ onPress={onPress}>
202
198
  <View style={styles.rowJourney}>
203
199
  <View style={Styles.row}>
204
- <Text
205
- typography="action_xs_bold"
206
- style={{maxWidth: startWidth}}
207
- color={tintColor}
208
- numberOfLines={1}>
200
+ <Text typography="action_xs_bold" color={tintColor} numberOfLines={1}>
209
201
  {start}
210
202
  </Text>
211
203
  <Icon
@@ -216,7 +208,6 @@ const TitleJourney: React.FC<TitleJourneyProps> = ({
216
208
  />
217
209
  {!!end && (
218
210
  <Text
219
- style={{maxWidth: endWidth}}
220
211
  typography="action_xs_bold"
221
212
  color={tintColor}
222
213
  numberOfLines={1}>
@@ -239,7 +239,12 @@ const StackScreen: React.FC<ScreenParams> = props => {
239
239
  }, 2000);
240
240
  },
241
241
  }}>
242
- <Component heightHeader={heightHeader} {...data} />
242
+ <Component
243
+ {...data}
244
+ heightHeader={heightHeader}
245
+ onScreenLoad={onScreenLoad}
246
+ onScreenInteraction={onScreenInteraction}
247
+ />
243
248
  {showGrid && <GridSystem />}
244
249
  </ScreenContext.Provider>
245
250
  );
package/Input/Input.tsx CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  import {ApplicationContext, ComponentContext} from '../Application';
18
18
  import {Icon} from '../Icon';
19
19
  import {Loader} from '../Loader';
20
- import {exportFontFamily, Text} from '../Text';
20
+ import {Text} from '../Text';
21
21
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
22
22
  import {InputProps} from './index';
23
23
  import styles from './styles';
@@ -51,7 +51,7 @@ const Input = forwardRef(
51
51
  loading = false,
52
52
  leadingIcon,
53
53
  leadingIconColor,
54
- fontWeight,
54
+ fontWeight = 'Regular',
55
55
  secureTextEntry,
56
56
  keyboardType,
57
57
  style,
@@ -93,17 +93,12 @@ const Input = forwardRef(
93
93
  onBlur?.(e);
94
94
  };
95
95
 
96
- const _setText = (text: string) => {
97
- inputRef?.current?.setNativeProps({text});
98
- _onChangeText(text);
99
- };
100
-
101
96
  useImperativeHandle(ref, () => {
102
97
  return {
103
98
  clear: onClearText,
104
99
  focus: () => inputRef.current?.focus(),
105
100
  blur: () => inputRef.current?.blur(),
106
- setText: _setText,
101
+ setText: (text: string) => _onChangeText(text),
107
102
  };
108
103
  });
109
104
 
@@ -223,7 +218,7 @@ const Input = forwardRef(
223
218
  styles.input,
224
219
  {
225
220
  color: textColor,
226
- fontFamily: exportFontFamily(fontWeight ?? 'regular'),
221
+ fontFamily: `${theme.font}-${fontWeight}`,
227
222
  },
228
223
  secure && haveValue && {fontSize: size === 'small' ? 18 : 22},
229
224
  ]}
@@ -165,17 +165,12 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
165
165
  onChangeText?.(text);
166
166
  };
167
167
 
168
- const _setText = (text: string) => {
169
- inputRef?.current?.setNativeProps({text});
170
- _onChangeText(text);
171
- };
172
-
173
168
  useImperativeHandle(ref, () => {
174
169
  return {
175
170
  clear: onClearText,
176
171
  focus: () => inputRef.current?.focus(),
177
172
  blur: () => inputRef.current?.blur(),
178
- setText: _setText,
173
+ setText: (text: string) => _onChangeText(text),
179
174
  };
180
175
  });
181
176
 
@@ -213,7 +208,6 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
213
208
  ]}
214
209
  value={value}
215
210
  onChangeText={_onChangeText}
216
- defaultValue={defaultValue}
217
211
  onFocus={_onFocus}
218
212
  onBlur={_onBlur}
219
213
  placeholder={placeholder}
package/Input/index.tsx CHANGED
@@ -110,7 +110,7 @@ export interface InputProps extends TextInputProps {
110
110
  /**
111
111
  * Optional. Represents the font weight of the text in the Input component.
112
112
  */
113
- fontWeight?: string;
113
+ fontWeight?: 'Regular' | 'Bold';
114
114
 
115
115
  /**
116
116
  * Optional. params for element tracking.
package/Layout/Screen.tsx CHANGED
@@ -344,8 +344,12 @@ const Screen = forwardRef(
344
344
  const setSearchHeader = (params: SearchHeaderProps) => {
345
345
  const options: StackNavigationOptions = {
346
346
  headerRight: undefined,
347
- headerTitle: () => (
348
- <SearchHeader {...params} animatedValue={animatedValue.current} />
347
+ headerTitle: (props: any) => (
348
+ <SearchHeader
349
+ {...props}
350
+ {...params}
351
+ animatedValue={animatedValue.current}
352
+ />
349
353
  ),
350
354
  };
351
355
 
package/Radio/index.tsx CHANGED
@@ -64,10 +64,10 @@ const Radio: FC<RadioProps> = ({
64
64
  styles.radio,
65
65
  checkBoxStyle,
66
66
  disabledStyle,
67
- {marginRight: label ? Spacing.S : 0},
67
+ {marginRight: label ? Spacing.XS : 0},
68
68
  ]}
69
69
  />
70
- {!!label && <Text typography={'body_default_regular'} style={styles.radioText}>{label}</Text>}
70
+ {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
71
71
  </TouchableOpacity>
72
72
  </ComponentContext.Provider>
73
73
  );
package/Radio/styles.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {StyleSheet} from 'react-native';
2
- import {Radius, Spacing} from '../Consts';
2
+ import {Radius} from '../Consts';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  radio: {
@@ -8,7 +8,4 @@ export default StyleSheet.create({
8
8
  borderRadius: Radius.M,
9
9
  },
10
10
  container: {flex: 1},
11
- radioText: {
12
- marginRight: Spacing.M,
13
- }
14
11
  });
package/Text/index.tsx CHANGED
@@ -33,20 +33,6 @@ const AlegreyaSans: TypographyWeight = {
33
33
  bold: 'Bold',
34
34
  };
35
35
 
36
- const MomoTrustSans: TypographyWeight = {
37
- 100: 'Light',
38
- 200: 'Light',
39
- 300: 'Light',
40
- 400: 'Regular',
41
- 500: 'Medium',
42
- 600: 'Medium',
43
- 700: 'Medium',
44
- 800: 'Medium',
45
- 900: 'Medium',
46
- normal: 'Regular',
47
- bold: 'Medium',
48
- };
49
-
50
36
  const FontStyle: {[key: string]: string} = {
51
37
  italic: 'Italic',
52
38
  normal: '',
@@ -64,12 +50,6 @@ export interface TextProps extends RNTextProps {
64
50
  * It can be any valid color string (e.g., hex, rgb, rgba, etc.).
65
51
  */
66
52
  color?: string;
67
-
68
- /**
69
- * Optional. Represents the font-family of the text in the Text component.
70
- * Ex: MomoSignature, MomoTrustDisplay
71
- */
72
- fontFamily?: string;
73
53
  }
74
54
 
75
55
  const deprecatedValues: Typography[] = [
@@ -87,61 +67,49 @@ const deprecatedValues: Typography[] = [
87
67
  'action_s',
88
68
  ];
89
69
 
90
- const getTypoStyle = (typo: Typography, newFontFamily?: string) => {
91
- const {theme} = useContext(ApplicationContext);
92
- const styleSheet: {
93
- [key: string]: any;
94
- } = styles;
95
- const typoStyle = styleSheet[typo] ?? styleSheet.paragraph_default;
96
- const {fontWeight, fontSize, fontStyle, lineHeight} = typoStyle;
97
- const style = FontStyle[fontStyle ?? 'normal'];
98
- const font = newFontFamily ?? theme.font;
99
- let fontFamily: string;
100
-
101
- switch (font) {
102
- case 'SFProText': {
103
- fontFamily = `${font}-${SFProText[fontWeight]}${style}`;
104
- break;
105
- }
106
- case 'AlegreyaSans': {
107
- fontFamily = `${font}-${AlegreyaSans[fontWeight]}${style}`;
108
- break;
109
- }
110
- case 'MomoTrustSans': {
111
- fontFamily = `${font}-${MomoTrustSans[fontWeight]}${style}`;
112
- break;
113
- }
114
- case 'MomoTrustDisplay':
115
- case 'MomoSignature': {
116
- fontFamily = font;
117
- break;
118
- }
119
- default: {
120
- fontFamily = `SFProText-${SFProText[fontWeight]}${style}`;
121
- }
122
- }
123
-
124
- return {
125
- ...typoStyle,
126
- fontFamily,
127
- fontSize: scaleSize(fontSize),
128
- lineHeight: scaleSize(lineHeight),
129
- fontStyle,
130
- fontWeight,
131
- };
132
- };
133
-
134
70
  const Text: React.FC<TextProps> = ({
135
71
  typography = 'body_default_regular',
136
72
  color,
137
73
  children,
138
74
  style,
139
- fontFamily,
140
75
  ...rest
141
76
  }) => {
142
77
  const {theme} = useContext(ApplicationContext);
143
78
 
144
- const textStyle = getTypoStyle(typography, fontFamily);
79
+ const getTypoStyle = (typo: Typography) => {
80
+ const styleSheet: {
81
+ [key: string]: any;
82
+ } = styles;
83
+ const typoStyle = styleSheet[typo] ?? styleSheet.paragraph_default;
84
+ const {fontWeight, fontSize, fontStyle, lineHeight} = typoStyle;
85
+ const style = FontStyle[fontStyle ?? 'normal'];
86
+ let fontFamily: string;
87
+
88
+ switch (theme.font) {
89
+ case 'SFProText': {
90
+ fontFamily = `${theme.font}-${SFProText[fontWeight]}${style}`;
91
+ break;
92
+ }
93
+ case 'AlegreyaSans': {
94
+ fontFamily = `${theme.font}-${AlegreyaSans[fontWeight]}${style}`;
95
+ break;
96
+ }
97
+ default: {
98
+ fontFamily = `SFProText-${SFProText[fontWeight]}${style}`;
99
+ }
100
+ }
101
+
102
+ return {
103
+ ...typoStyle,
104
+ fontFamily,
105
+ fontSize: scaleSize(fontSize),
106
+ lineHeight: scaleSize(lineHeight),
107
+ fontStyle,
108
+ fontWeight,
109
+ };
110
+ };
111
+
112
+ const textStyle = getTypoStyle(typography);
145
113
 
146
114
  if (deprecatedValues.includes(typography)) {
147
115
  console.warn(
@@ -153,42 +121,10 @@ const Text: React.FC<TextProps> = ({
153
121
  <RNText
154
122
  {...rest}
155
123
  {...getAccessibilityID(rest.accessibilityLabel)}
156
- style={[
157
- style,
158
- textStyle,
159
- {
160
- color: color ?? theme.colors.text.default,
161
- },
162
- ]}>
124
+ style={[style, textStyle, {color: color ?? theme.colors.text.default}]}>
163
125
  {children ?? ''}
164
126
  </RNText>
165
127
  );
166
128
  };
167
129
 
168
- const exportFontFamily = (
169
- fontWeight: string,
170
- typography?: Typography,
171
- fontFamily?: string
172
- ): string => {
173
- let newFontFamily;
174
-
175
- switch (fontWeight) {
176
- case 'bold': {
177
- typography = 'action_xs_bold';
178
- break;
179
- }
180
- case 'regular': {
181
- typography = 'body_default_regular';
182
- break;
183
- }
184
- default: {
185
- typography = 'body_default_regular';
186
- }
187
- }
188
-
189
- newFontFamily = getTypoStyle(typography, fontFamily).fontFamily;
190
-
191
- return newFontFamily;
192
- };
193
-
194
- export {Text, scaleSize, exportFontFamily, getTypoStyle};
130
+ export {Text, scaleSize};
package/Title/index.tsx CHANGED
@@ -38,7 +38,7 @@ const Title: FC<TitleProps> = ({
38
38
  const numberOfLines = showTrailingAction || !!badgeLabel ? 1 : 2;
39
39
  const buttonTypo: Typography =
40
40
  buttonSize === 'small' ? 'action_xs_bold' : 'action_s_bold';
41
- const flexStyle = showTrailingAction && {maxWidth: '95%'};
41
+ const flexStyle = showTrailingAction && {maxWidth: '70%'};
42
42
 
43
43
  const renderIcon = () => {
44
44
  if (!icon) return null;
package/code-scanner.js CHANGED
@@ -153,7 +153,7 @@ const main = async () => {
153
153
  sendMessage(result);
154
154
  console.log(result);
155
155
  } catch (error) {
156
- console.error('Error during scan:', error);
156
+ console.error('Error during scan or calculation:', error);
157
157
  }
158
158
  };
159
159
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.109.1-optimize.17-beta.19",
3
+ "version": "0.109.1-optimize.18",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": ".",
4
+ "allowUnreachableCode": false,
5
+ "allowUnusedLabels": false,
6
+ "esModuleInterop": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "jsx": "react",
9
+ "lib": ["esnext"],
10
+ "module": "esnext",
11
+ "moduleResolution": "node",
12
+ "noFallthroughCasesInSwitch": true,
13
+ "noImplicitReturns": false,
14
+ "noImplicitUseStrict": false,
15
+ "noStrictGenericChecks": false,
16
+ "noUncheckedIndexedAccess": true,
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "resolveJsonModule": true,
20
+ "skipLibCheck": true,
21
+ "strict": true,
22
+ "target": "esnext"
23
+ }
24
+ }
package/verify.js CHANGED
@@ -27,7 +27,7 @@ if (
27
27
 
28
28
  if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
29
29
  throw new Error(
30
- `\x1b[41m Package ${packageInfo.name} version:${packageInfo.version} require deploymentTarget ${packageVersion}`
30
+ `\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`
31
31
  );
32
32
  }
33
33