@momo-kits/foundation 0.154.1-beta.4 → 0.154.1-beta.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.
@@ -41,17 +41,22 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
41
41
  enableForceFoundationList: false,
42
42
  enableHapticBottomTab: true,
43
43
  scaleSizeMaxRate: 1.5,
44
+ showBaseLineDebug: false,
44
45
  },
45
46
  }) => {
46
47
  const context = useContext<any>(MiniAppContext);
47
48
  const [currentContext, setCurrentContext] = useState({});
49
+
48
50
  return (
49
51
  <SafeAreaProvider>
50
52
  <MiniAppContext.Provider
51
53
  value={{
52
54
  ...context,
53
55
  ...currentContext,
54
- features,
56
+ features: {
57
+ ...context?.features,
58
+ ...features,
59
+ },
55
60
  }}
56
61
  >
57
62
  <Navigation
@@ -142,11 +142,12 @@ export type Tool = {
142
142
  onPress: () => void;
143
143
  };
144
144
 
145
- export type FeaturesFlag = {
145
+ export type FeatureFlags = {
146
146
  enableFoundationList?: boolean;
147
147
  enableBottomTabAnimation?: boolean;
148
148
  enableHapticBottomTab?: boolean;
149
149
  enableHapticDialog?: boolean;
150
+ showBaseLineDebug?: boolean;
150
151
  };
151
152
 
152
153
  export type NavigationContainerProps = {
@@ -156,7 +157,7 @@ export type NavigationContainerProps = {
156
157
  maxApi: any;
157
158
  initialParams?: any;
158
159
  localize: LocalizeProps;
159
- features?: FeaturesFlag;
160
+ features?: FeatureFlags;
160
161
  };
161
162
 
162
163
  export type WidgetContainerProps = {
package/Input/Input.tsx CHANGED
@@ -70,6 +70,7 @@ const Input = forwardRef(
70
70
  ) => {
71
71
  const { theme } = useContext(ApplicationContext);
72
72
  const scaledFontSize = useScaleSize(14);
73
+ const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
73
74
  const [focused, setFocused] = useState(false);
74
75
  const haveValue = !!value || !!defaultValue;
75
76
  const inputRef = useRef<TextInput | null>(null);
@@ -135,7 +136,7 @@ const Input = forwardRef(
135
136
  style={[
136
137
  styles.inputWrapper,
137
138
  { backgroundColor: theme.colors.background.surface },
138
- getSizeStyle(size),
139
+ getSizeStyle(size, undefined, scaleHeight),
139
140
  getBorderColor(theme, focused, errorMessage, disabled),
140
141
  ]}
141
142
  >
@@ -10,7 +10,7 @@ import {
10
10
  getSizeStyle,
11
11
  } from './common';
12
12
  import { InputDropDownProps } from './index';
13
- import { Text } from '../Text';
13
+ import { Text, useScaleSize } from '../Text';
14
14
  import styles from './styles';
15
15
  import { Spacing } from '../Consts';
16
16
 
@@ -35,6 +35,7 @@ const InputDropDown = ({
35
35
  ...props
36
36
  }: InputDropDownProps) => {
37
37
  const { theme } = useContext(ApplicationContext);
38
+ const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
38
39
  const componentName = 'InputDropDown';
39
40
 
40
41
  const { componentId } = useComponentId(
@@ -60,7 +61,7 @@ const InputDropDown = ({
60
61
  style={[
61
62
  styles.inputDropDownWrapper,
62
63
  { backgroundColor: theme.colors.background.surface },
63
- getSizeStyle(size, multiline),
64
+ getSizeStyle(size, multiline, scaleHeight),
64
65
  getBorderColor(theme, false, errorMessage, disabled as boolean),
65
66
  ]}
66
67
  >
@@ -62,6 +62,7 @@ const InputMoney = forwardRef(
62
62
  ref,
63
63
  ) => {
64
64
  const { theme } = useContext(ApplicationContext);
65
+ const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
65
66
  const scaledFontSize = useScaleSize(20);
66
67
  const [focused, setFocused] = useState(false);
67
68
  const [displayValue, setDisplayValue] = useState('');
@@ -198,7 +199,7 @@ const InputMoney = forwardRef(
198
199
  style={[
199
200
  styles.inputWrapper,
200
201
  { backgroundColor: theme.colors.background.surface },
201
- getSizeStyle(size),
202
+ getSizeStyle(size, undefined, scaleHeight),
202
203
  getBorderColor(theme, focused, errorMessage, disabled),
203
204
  ]}
204
205
  >
@@ -62,6 +62,7 @@ const InputPhoneNumber = forwardRef(
62
62
  ref,
63
63
  ) => {
64
64
  const { theme } = useContext(ApplicationContext);
65
+ const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
65
66
  const [focused, setFocused] = useState(false);
66
67
  const haveValue = !!value || !!defaultValue;
67
68
  const inputRef = useRef<TextInput | null>(null);
@@ -142,7 +143,7 @@ const InputPhoneNumber = forwardRef(
142
143
  style={[
143
144
  styles.inputWrapper,
144
145
  { backgroundColor: theme.colors.background.surface },
145
- getSizeStyle(size),
146
+ getSizeStyle(size, undefined, scaleHeight),
146
147
  { borderWidth },
147
148
  getBorderColor(theme, focused, errorMessage, disabled),
148
149
  ]}
package/Input/common.tsx CHANGED
@@ -61,8 +61,12 @@ export const getBorderColor = (
61
61
  export const getSizeStyle = (
62
62
  size?: 'small' | 'large',
63
63
  multiline: boolean = false,
64
+ height?: number,
64
65
  ) => {
65
- const scaleInputHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
66
+ let scaleStyle: ViewStyle = {};
67
+ if (height) {
68
+ scaleStyle = { height };
69
+ }
66
70
 
67
71
  if (multiline)
68
72
  return [
@@ -70,13 +74,15 @@ export const getSizeStyle = (
70
74
  {
71
75
  minHeight: size === 'small' ? 48 : 56,
72
76
  },
77
+ scaleStyle,
73
78
  ];
74
79
 
75
80
  if (size === 'small') {
76
- return [styles.smallContainer, { height: scaleInputHeight }];
81
+ return [styles.smallContainer, scaleStyle];
77
82
  }
78
- return [styles.container, { height: scaleInputHeight }];
83
+ return [styles.container, scaleStyle];
79
84
  };
85
+
80
86
  export const ErrorView: FC<{
81
87
  errorMessage?: string;
82
88
  errorSpacing?: boolean;
package/Text/index.tsx CHANGED
@@ -2,10 +2,13 @@ import React, { useContext } from 'react';
2
2
  import { Text as RNText, TextProps as RNTextProps, View } from 'react-native';
3
3
  import styles from './styles';
4
4
  import { Typography, TypographyWeight } from './types';
5
- import { ApplicationContext, SkeletonContext } from '../Context';
5
+ import {
6
+ ApplicationContext,
7
+ MiniAppContext,
8
+ SkeletonContext,
9
+ } from '../Context';
6
10
  import { scaleSize, useScaleSize } from './utils';
7
11
  import { Skeleton } from '../Skeleton';
8
- import { Colors } from '../Consts';
9
12
 
10
13
  const SFProText: TypographyWeight = {
11
14
  100: 'Thin',
@@ -156,6 +159,7 @@ const Text: React.FC<TextProps> = ({
156
159
  ...rest
157
160
  }) => {
158
161
  const { theme } = useContext(ApplicationContext);
162
+ const context = useContext<any>(MiniAppContext);
159
163
  const skeleton = useContext(SkeletonContext);
160
164
  const textStyle = TypoStyles(typography, fontFamily, maxScaleRate);
161
165
 
@@ -165,6 +169,8 @@ const Text: React.FC<TextProps> = ({
165
169
  );
166
170
  }
167
171
 
172
+ const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
173
+
168
174
  if (skeleton.loading) {
169
175
  return (
170
176
  <View style={style}>
@@ -192,10 +198,9 @@ const Text: React.FC<TextProps> = ({
192
198
  style={[
193
199
  style,
194
200
  textStyle,
201
+ showBaseLineDebug && styles.debugBaseLine,
195
202
  {
196
203
  color: color ?? theme.colors.text.default,
197
- borderWidth: 1,
198
- borderColor: Colors.green_06,
199
204
  },
200
205
  ]}
201
206
  >
package/Text/styles.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Colors } from '../Consts';
2
+
1
3
  export default {
2
4
  headline_l_bold: { fontSize: 28, lineHeight: 40, fontWeight: '700' },
3
5
  headline_default_bold: { fontSize: 24, lineHeight: 34, fontWeight: '700' },
@@ -71,4 +73,6 @@ export default {
71
73
  action_xxs: { fontSize: 10, lineHeight: 14, fontWeight: '700' },
72
74
  action_xs: { fontSize: 12, lineHeight: 16, fontWeight: '700' },
73
75
  action_s: { fontSize: 15, lineHeight: 22, fontWeight: '700' },
76
+
77
+ debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
74
78
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.154.1-beta.4",
3
+ "version": "0.154.1-beta.6",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},