@momo-kits/foundation 0.81.43-rc.6 → 0.88.1-beta.1

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.
@@ -244,7 +244,7 @@ const HeaderCustom: React.FC<TitleCustomProps> = ({
244
244
  )}
245
245
  </View>
246
246
  <View style={[Styles.flex, {paddingHorizontal: 8}]}>
247
- <Text typography="action_default_bold" color={tintColor}>
247
+ <Text typography="header_default_bold" color={tintColor}>
248
248
  {title}
249
249
  </Text>
250
250
  <Text typography="description_default_regular" color={tintColor}>
@@ -6,7 +6,7 @@ import {
6
6
  NavigationContainerRef,
7
7
  } from '@react-navigation/native';
8
8
  import {createStackNavigator} from '@react-navigation/stack';
9
- import {DeviceEventEmitter, NativeModules} from 'react-native';
9
+ import {Alert, DeviceEventEmitter, NativeModules} from 'react-native';
10
10
  import StackScreen from './StackScreen';
11
11
  import ModalScreen from './ModalScreen';
12
12
  import Navigator from './Navigator';
@@ -5,6 +5,10 @@ import {ApplicationContext} from './index';
5
5
  import {GridSystem} from '../Layout';
6
6
  import {useHeaderHeight} from '@react-navigation/stack';
7
7
 
8
+ const {
9
+ ScreenContext,
10
+ } = require('react-native/Libraries/Components/ScreenContext');
11
+
8
12
  const StackScreen: React.FC<ScreenParams> = props => {
9
13
  const {screen: Component, options}: ScreenParams = props.route.params;
10
14
  const {theme, showGrid, navigator} = useContext(ApplicationContext);
@@ -64,10 +68,16 @@ const StackScreen: React.FC<ScreenParams> = props => {
64
68
  }, []);
65
69
 
66
70
  return (
67
- <>
71
+ <ScreenContext.Provider
72
+ value={{
73
+ app_id: navigator?.trackingInfo?.appId,
74
+ screen_name: Component.name,
75
+ feature_code: navigator?.trackingInfo?.code,
76
+ autoTracking: navigator?.maxApi?.autoTracking,
77
+ }}>
68
78
  <Component heightHeader={heightHeader} {...params} />
69
79
  {showGrid && <GridSystem />}
70
- </>
80
+ </ScreenContext.Provider>
71
81
  );
72
82
  };
73
83
 
@@ -207,3 +207,9 @@ export type AnimatedHeader = {
207
207
  type: 'default' | 'surface';
208
208
  component?: (props?: any) => React.ReactElement;
209
209
  };
210
+
211
+ export type ScreenInfo = {
212
+ app_id: string;
213
+ feature_code: string;
214
+ screen_name: string;
215
+ };
package/Badge/Badge.tsx CHANGED
@@ -46,7 +46,7 @@ const Badge: FC<BadgeProps> = ({label = 'Label', style, backgroundColor}) => {
46
46
 
47
47
  return (
48
48
  <View style={[style, styles.badge, {backgroundColor: badgeColor}]}>
49
- <Text color={Colors.black_01} typography={'action_xxs_bold'}>
49
+ <Text color={Colors.black_01} typography={'action_xs_bold'}>
50
50
  {formatTitle()}
51
51
  </Text>
52
52
  </View>
package/Button/index.tsx CHANGED
@@ -6,7 +6,6 @@ import {
6
6
  TouchableOpacityProps,
7
7
  View,
8
8
  } from 'react-native';
9
-
10
9
  import LinearGradient from 'react-native-linear-gradient';
11
10
  import {ApplicationContext} from '../Application';
12
11
  import {Text} from '../Text';
@@ -15,6 +14,11 @@ import {Colors, Spacing} from '../Consts';
15
14
  import styles from './styles';
16
15
  import {Icon} from '../Icon';
17
16
  import {Loader} from '../Loader';
17
+ import {ScreenInfo} from '../Application/types';
18
+
19
+ const {
20
+ ScreenContext,
21
+ } = require('react-native/Libraries/Components/ScreenContext');
18
22
 
19
23
  const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
20
24
 
@@ -70,6 +74,8 @@ export interface ButtonProps extends TouchableOpacityProps {
70
74
  * A callback function that is called when the button is pressed.
71
75
  */
72
76
  onPress: () => void;
77
+
78
+ trackingParams?: any;
73
79
  }
74
80
 
75
81
  const Button: FC<ButtonProps> = ({
@@ -82,6 +88,7 @@ const Button: FC<ButtonProps> = ({
82
88
  loading = false,
83
89
  title = 'Button',
84
90
  onPress,
91
+ trackingParams,
85
92
  ...rest
86
93
  }) => {
87
94
  const {theme, config} = useContext(ApplicationContext);
@@ -94,6 +101,8 @@ const Button: FC<ButtonProps> = ({
94
101
  end: {x: 0, y: 0.5},
95
102
  };
96
103
  }
104
+
105
+ const screenInfo = useContext<ScreenInfo>(ScreenContext);
97
106
  const getSizeStyle = () => {
98
107
  const styleSheet: {[key: string]: any} = styles;
99
108
  return styleSheet[size ?? 'small'];
@@ -291,20 +300,27 @@ const Button: FC<ButtonProps> = ({
291
300
  const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
292
301
 
293
302
  return (
294
- <TouchableOpacity
295
- {...rest}
296
- accessibilityLabel={`Button/${title}`}
297
- activeOpacity={activeOpacity}
298
- onPress={onPressButton}
299
- style={buttonStyle}>
300
- {renderLeading()}
301
- {renderTitle()}
302
- {renderTrailing()}
303
- {gradientPros && (
304
- <AnimationLinear {...gradientPros} style={styles.gradientView} />
305
- )}
306
- {gradientPros && <View style={styles.strokeView} />}
307
- </TouchableOpacity>
303
+ <ScreenContext.Provider
304
+ value={{
305
+ ...screenInfo,
306
+ componentName: 'Button',
307
+ params: trackingParams,
308
+ state: type === 'disabled' ? 'disabled' : 'enabled',
309
+ }}>
310
+ <TouchableOpacity
311
+ {...rest}
312
+ activeOpacity={activeOpacity}
313
+ onPress={onPressButton}
314
+ style={buttonStyle}>
315
+ {renderLeading()}
316
+ {renderTitle()}
317
+ {renderTrailing()}
318
+ {gradientPros && (
319
+ <AnimationLinear {...gradientPros} style={styles.gradientView} />
320
+ )}
321
+ {gradientPros && <View style={styles.strokeView} />}
322
+ </TouchableOpacity>
323
+ </ScreenContext.Provider>
308
324
  );
309
325
  };
310
326
 
@@ -6,6 +6,10 @@ import {ApplicationContext} from '../Application';
6
6
  import {Text} from '../Text';
7
7
  import {Icon} from '../Icon';
8
8
 
9
+ const {
10
+ ScreenContext,
11
+ } = require('react-native/Libraries/Components/ScreenContext');
12
+
9
13
  const CheckBox: FC<CheckBoxProps> = ({
10
14
  value,
11
15
  disabled,
@@ -19,6 +23,7 @@ const CheckBox: FC<CheckBoxProps> = ({
19
23
  const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
20
24
  let borderColor = theme.colors.text.default;
21
25
  let backgroundColor = theme.colors.background.surface;
26
+ const screenInfo = useContext<any>(ScreenContext);
22
27
 
23
28
  if (haveValue) {
24
29
  borderColor = theme.colors.primary;
@@ -35,27 +40,35 @@ const CheckBox: FC<CheckBoxProps> = ({
35
40
  }
36
41
 
37
42
  return (
38
- <TouchableOpacity
39
- accessibilityLabel={`CheckBox/${label}/${value}`}
40
- activeOpacity={0.8}
41
- onPress={() => onChange?.(!value)}
42
- disabled={disabled}
43
- style={[style, styles.container]}>
44
- <View
45
- style={[
46
- {borderColor, backgroundColor, borderWidth: 1},
47
- styles.checkbox,
48
- ]}>
49
- {haveValue && (
50
- <Icon
51
- color={theme.colors.background.surface}
52
- size={20}
53
- source={iconSource}
54
- />
55
- )}
56
- </View>
57
- {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
58
- </TouchableOpacity>
43
+ <ScreenContext.Provider
44
+ value={{
45
+ ...screenInfo,
46
+ componentName: 'CheckBox',
47
+ params: {
48
+ value,
49
+ },
50
+ }}>
51
+ <TouchableOpacity
52
+ activeOpacity={0.8}
53
+ onPress={() => onChange?.(!value)}
54
+ disabled={disabled}
55
+ style={[style, styles.container]}>
56
+ <View
57
+ style={[
58
+ {borderColor, backgroundColor, borderWidth: 1},
59
+ styles.checkbox,
60
+ ]}>
61
+ {haveValue && (
62
+ <Icon
63
+ color={theme.colors.background.surface}
64
+ size={20}
65
+ source={iconSource}
66
+ />
67
+ )}
68
+ </View>
69
+ {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
70
+ </TouchableOpacity>
71
+ </ScreenContext.Provider>
59
72
  );
60
73
  };
61
74
 
@@ -10,6 +10,10 @@ import {Colors} from '../Consts';
10
10
  import {Icon} from '../Icon';
11
11
  import styles from './styles';
12
12
 
13
+ const {
14
+ ScreenContext,
15
+ } = require('react-native/Libraries/Components/ScreenContext');
16
+
13
17
  export interface IconButtonProps extends TouchableOpacityProps {
14
18
  /**
15
19
  * Represents the name or key of the icon to be displayed on the IconButton.
@@ -36,6 +40,7 @@ const IconButton: React.FC<IconButtonProps> = ({
36
40
  ...rest
37
41
  }) => {
38
42
  const {theme} = useContext(ApplicationContext);
43
+ const screenInfo = useContext<any>(ScreenContext);
39
44
 
40
45
  /**
41
46
  * get size icon button
@@ -121,14 +126,22 @@ const IconButton: React.FC<IconButtonProps> = ({
121
126
  const iconSize = size === 'small' ? 16 : 24;
122
127
 
123
128
  return (
124
- <TouchableOpacity
125
- {...rest}
126
- accessibilityLabel={`IconButton/${icon}`}
127
- activeOpacity={activeOpacity}
128
- onPress={onPressButton}
129
- style={buttonStyle}>
130
- <Icon size={iconSize} source={icon} color={getIconColor()} />
131
- </TouchableOpacity>
129
+ <ScreenContext.Provider
130
+ value={{
131
+ ...screenInfo,
132
+ componentName: 'IconButton',
133
+ params: {
134
+ icon,
135
+ },
136
+ }}>
137
+ <TouchableOpacity
138
+ {...rest}
139
+ activeOpacity={activeOpacity}
140
+ onPress={onPressButton}
141
+ style={buttonStyle}>
142
+ <Icon size={iconSize} source={icon} color={getIconColor()} />
143
+ </TouchableOpacity>
144
+ </ScreenContext.Provider>
132
145
  );
133
146
  };
134
147
 
package/Input/Input.tsx CHANGED
@@ -13,6 +13,10 @@ import {InputProps} from './index';
13
13
  import {Icon} from '../Icon';
14
14
  import {checkTyping} from './utils';
15
15
  import {Loader} from '../Loader';
16
+ import {ScreenInfo} from '../Application/types';
17
+ const {
18
+ ScreenContext,
19
+ } = require('react-native/Libraries/Components/ScreenContext');
16
20
 
17
21
  const Input = forwardRef(
18
22
  (
@@ -38,6 +42,7 @@ const Input = forwardRef(
38
42
  fontWeight = 'Regular',
39
43
  onPressIcon,
40
44
  style,
45
+ trackingParams,
41
46
  ...props
42
47
  }: InputProps,
43
48
  ref,
@@ -47,6 +52,7 @@ const Input = forwardRef(
47
52
  const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
48
53
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
49
54
  const accessibilityLabel = `Input/${floatingValue ?? placeholder}`;
55
+ const screenInfo = useContext<ScreenInfo>(ScreenContext);
50
56
 
51
57
  const onClearText = () => {
52
58
  inputRef?.current?.clear();
@@ -160,12 +166,20 @@ const Input = forwardRef(
160
166
  };
161
167
 
162
168
  return (
163
- <View
164
- style={[style, styles.wrapper]}
165
- accessibilityLabel={accessibilityLabel}>
166
- {renderInputView()}
167
- <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
168
- </View>
169
+ <ScreenContext.Provider
170
+ value={{
171
+ ...screenInfo,
172
+ componentName: 'Input',
173
+ params: trackingParams,
174
+ state: disabled ? 'disabled' : 'enabled',
175
+ }}>
176
+ <View
177
+ style={[style, styles.wrapper]}
178
+ accessibilityLabel={accessibilityLabel}>
179
+ {renderInputView()}
180
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
181
+ </View>
182
+ </ScreenContext.Provider>
169
183
  );
170
184
  },
171
185
  );
@@ -12,6 +12,10 @@ import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
12
12
  import {InputMoneyProps} from './index';
13
13
  import {Icon} from '../Icon';
14
14
  import {formatMoneyToNumber, formatNumberToMoney} from './utils';
15
+ import {ScreenInfo} from '../Application/types';
16
+ const {
17
+ ScreenContext,
18
+ } = require('react-native/Libraries/Components/ScreenContext');
15
19
 
16
20
  const InputMoney = forwardRef(
17
21
  (
@@ -30,6 +34,7 @@ const InputMoney = forwardRef(
30
34
  required = false,
31
35
  errorSpacing,
32
36
  style,
37
+ trackingParams,
33
38
  defaultValue = '',
34
39
  ...props
35
40
  }: InputMoneyProps,
@@ -39,6 +44,7 @@ const InputMoney = forwardRef(
39
44
  const [focused, setFocused] = useState(false);
40
45
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
41
46
  const accessibilityLabel = `InputMoney/${floatingValue}`;
47
+ const screenInfo = useContext<ScreenInfo>(ScreenContext);
42
48
 
43
49
  const validateText = (text: string) => {
44
50
  const valueFormat = formatMoneyToNumber(text, 'đ');
@@ -142,12 +148,20 @@ const InputMoney = forwardRef(
142
148
  };
143
149
 
144
150
  return (
145
- <View
146
- style={[style, styles.wrapper]}
147
- accessibilityLabel={accessibilityLabel}>
148
- {renderInputView()}
149
- <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
150
- </View>
151
+ <ScreenContext.Provider
152
+ value={{
153
+ ...screenInfo,
154
+ componentName: 'InputMoney',
155
+ params: trackingParams,
156
+ state: 'enable',
157
+ }}>
158
+ <View
159
+ style={[style, styles.wrapper]}
160
+ accessibilityLabel={accessibilityLabel}>
161
+ {renderInputView()}
162
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
163
+ </View>
164
+ </ScreenContext.Provider>
151
165
  );
152
166
  },
153
167
  );
@@ -21,6 +21,10 @@ import styles from './styles';
21
21
  import {ErrorView, getBorderColor} from './common';
22
22
  import {ApplicationContext} from '../Application';
23
23
  import {Spacing} from '../Consts';
24
+ import {ScreenInfo} from '../Application/types';
25
+ const {
26
+ ScreenContext,
27
+ } = require('react-native/Libraries/Components/ScreenContext');
24
28
 
25
29
  const OTPCaret: FC<CaretProps> = ({index, length}) => {
26
30
  const DURATION = 300;
@@ -78,6 +82,7 @@ const InputOTP = forwardRef(
78
82
  onFocus,
79
83
  onBlur,
80
84
  dataType = 'number',
85
+ trackingParams,
81
86
  style,
82
87
  ...props
83
88
  }: InputOTPProps,
@@ -89,6 +94,7 @@ const InputOTP = forwardRef(
89
94
  const inputRef = useRef<TextInput>(null);
90
95
  const {theme} = useContext(ApplicationContext);
91
96
  const accessibilityLabel = `InputOTP/${floatingValue ?? placeholder}`;
97
+ const screenInfo = useContext<ScreenInfo>(ScreenContext);
92
98
 
93
99
  useImperativeHandle(ref, () => ({
94
100
  onChangeText: (text: string) => {
@@ -223,14 +229,22 @@ const InputOTP = forwardRef(
223
229
  };
224
230
 
225
231
  return (
226
- <TouchableOpacity
227
- activeOpacity={1}
228
- onPress={onFocusInput}
229
- style={[style, styles.otpWrapper]}
230
- accessibilityLabel={accessibilityLabel}>
231
- {renderInputView()}
232
- <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
233
- </TouchableOpacity>
232
+ <ScreenContext.Provider
233
+ value={{
234
+ ...screenInfo,
235
+ componentName: 'InputOTP',
236
+ params: trackingParams,
237
+ state: 'enable',
238
+ }}>
239
+ <TouchableOpacity
240
+ activeOpacity={1}
241
+ onPress={onFocusInput}
242
+ style={[style, styles.otpWrapper]}
243
+ accessibilityLabel={accessibilityLabel}>
244
+ {renderInputView()}
245
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
246
+ </TouchableOpacity>
247
+ </ScreenContext.Provider>
234
248
  );
235
249
  },
236
250
  );
@@ -12,6 +12,10 @@ import styles from './styles';
12
12
  import {Icon} from '../Icon';
13
13
  import {Text} from '../Text';
14
14
  import {checkTyping} from './utils';
15
+ import {ScreenInfo} from '../Application/types';
16
+ const {
17
+ ScreenContext,
18
+ } = require('react-native/Libraries/Components/ScreenContext');
15
19
 
16
20
  const InputSearch = forwardRef(
17
21
  (
@@ -29,6 +33,7 @@ const InputSearch = forwardRef(
29
33
  style,
30
34
  defaultValue,
31
35
  onPressButtonText,
36
+ trackingParams,
32
37
  ...props
33
38
  }: InputSearchProps,
34
39
  ref,
@@ -38,6 +43,7 @@ const InputSearch = forwardRef(
38
43
  const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
39
44
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
40
45
  const accessibilityLabel = `InputMoney/${placeholder}`;
46
+ const screenInfo = useContext<ScreenInfo>(ScreenContext);
41
47
 
42
48
  const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
43
49
  setFocused(true);
@@ -119,35 +125,45 @@ const InputSearch = forwardRef(
119
125
  );
120
126
  };
121
127
  return (
122
- <View
123
- style={[style, styles.searchInputContainer]}
124
- accessibilityLabel={accessibilityLabel}>
128
+ <ScreenContext.Provider
129
+ value={{
130
+ ...screenInfo,
131
+ componentName: 'InputSearch',
132
+ params: trackingParams,
133
+ state: 'enabled',
134
+ }}>
125
135
  <View
126
- style={[
127
- styles.searchInputWrapper,
128
- {
129
- backgroundColor: theme.colors.background.surface,
130
- borderColor: theme.colors.background.surface,
131
- },
132
- showBorder && {borderColor: theme.colors.border.default},
133
- focused && {borderColor: theme.colors.primary},
134
- ]}>
135
- <Icon
136
- source={'navigation_search'}
137
- size={24}
138
- color={theme.colors.text.hint}
139
- />
140
- {renderInputView()}
141
- {renderIconView()}
136
+ style={[style, styles.searchInputContainer]}
137
+ accessibilityLabel={accessibilityLabel}>
138
+ <View
139
+ style={[
140
+ styles.searchInputWrapper,
141
+ {
142
+ backgroundColor: theme.colors.background.surface,
143
+ borderColor: theme.colors.background.surface,
144
+ },
145
+ showBorder && {borderColor: theme.colors.border.default},
146
+ focused && {borderColor: theme.colors.primary},
147
+ ]}>
148
+ <Icon
149
+ source={'navigation_search'}
150
+ size={24}
151
+ color={theme.colors.text.hint}
152
+ />
153
+ {renderInputView()}
154
+ {renderIconView()}
155
+ </View>
156
+ {showButtonText && (
157
+ <TouchableOpacity onPress={onPressButtonText}>
158
+ <Text
159
+ typography={'action_default_bold'}
160
+ style={styles.textButton}>
161
+ {buttonText}
162
+ </Text>
163
+ </TouchableOpacity>
164
+ )}
142
165
  </View>
143
- {showButtonText && (
144
- <TouchableOpacity onPress={onPressButtonText}>
145
- <Text typography={'action_default_bold'} style={styles.textButton}>
146
- {buttonText}
147
- </Text>
148
- </TouchableOpacity>
149
- )}
150
- </View>
166
+ </ScreenContext.Provider>
151
167
  );
152
168
  },
153
169
  );
package/Input/index.tsx CHANGED
@@ -80,6 +80,8 @@ export interface InputProps extends TextInputProps {
80
80
  fontWeight?: 'Regular' | 'Bold';
81
81
 
82
82
  onPressIcon?: () => void;
83
+
84
+ trackingParams?: any;
83
85
  }
84
86
 
85
87
  type InputPropsWithoutSizeAndIcon = Omit<
@@ -126,6 +128,8 @@ export interface InputSearchProps extends TextInputProps {
126
128
  * Optional. Represents the name or key of the icon to be displayed in the Input component.
127
129
  */
128
130
  icon?: string;
131
+
132
+ trackingParams?: any;
129
133
  }
130
134
 
131
135
  export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
@@ -192,7 +192,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
192
192
  ]}>
193
193
  {!!image && <Image source={{uri: image}} style={styles.image} />}
194
194
  <View style={styles.content}>
195
- <Text typography={'action_default_bold'} numberOfLines={1}>
195
+ <Text typography={'header_default_bold'} numberOfLines={1}>
196
196
  {title}
197
197
  </Text>
198
198
  <Description style={[styles.description, descriptionStyle]}>
package/Radio/index.tsx CHANGED
@@ -7,6 +7,10 @@ import styles from './styles';
7
7
  import {ApplicationContext} from '../Application';
8
8
  import {Spacing} from '../Consts';
9
9
 
10
+ const {
11
+ ScreenContext,
12
+ } = require('react-native/Libraries/Components/ScreenContext');
13
+
10
14
  const Radio: FC<RadioProps> = ({
11
15
  value,
12
16
  groupValue,
@@ -37,28 +41,38 @@ const Radio: FC<RadioProps> = ({
37
41
  };
38
42
  }
39
43
 
44
+ const screenInfo = useContext<any>(ScreenContext);
45
+
40
46
  return (
41
- <TouchableOpacity
42
- accessibilityLabel={`Radio/${label}/${value}`}
43
- onPress={onChange}
44
- disabled={disabled}
45
- style={[
46
- style,
47
- {
48
- flexDirection: 'row',
49
- alignItems: 'center',
47
+ <ScreenContext.Provider
48
+ value={{
49
+ ...screenInfo,
50
+ componentName: 'Radio',
51
+ params: {
52
+ value,
50
53
  },
51
- ]}>
52
- <View
54
+ }}>
55
+ <TouchableOpacity
56
+ onPress={onChange}
57
+ disabled={disabled}
53
58
  style={[
54
- styles.radio,
55
- checkBoxStyle,
56
- disabledStyle,
57
- {marginRight: label ? Spacing.XS : 0},
58
- ]}
59
- />
60
- {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
61
- </TouchableOpacity>
59
+ style,
60
+ {
61
+ flexDirection: 'row',
62
+ alignItems: 'center',
63
+ },
64
+ ]}>
65
+ <View
66
+ style={[
67
+ styles.radio,
68
+ checkBoxStyle,
69
+ disabledStyle,
70
+ {marginRight: label ? Spacing.XS : 0},
71
+ ]}
72
+ />
73
+ {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
74
+ </TouchableOpacity>
75
+ </ScreenContext.Provider>
62
76
  );
63
77
  };
64
78
 
package/Switch/index.tsx CHANGED
@@ -1,13 +1,18 @@
1
- import React, {FC} from 'react';
1
+ import React, {FC, useContext} from 'react';
2
2
  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
6
 
7
+ const {
8
+ ScreenContext,
9
+ } = require('react-native/Libraries/Components/ScreenContext');
10
+
7
11
  const Switch: FC<SwitchProps> = props => {
8
12
  const {value, onChange, disabled, style} = props;
9
13
  const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
10
14
  const circleAlign = value ? 'flex-end' : 'flex-start';
15
+ const screenInfo = useContext<any>(ScreenContext);
11
16
 
12
17
  let backgroundColor = value ? Colors.green_03 : Colors.black_07;
13
18
  if (disabled) {
@@ -15,19 +20,27 @@ const Switch: FC<SwitchProps> = props => {
15
20
  }
16
21
 
17
22
  return (
18
- <TouchableOpacity
19
- accessibilityLabel={'Switch'}
20
- disabled={disabled}
21
- onPress={() => onChange?.(!value)}
22
- style={[
23
- style,
24
- styles.container,
25
- {backgroundColor, alignItems: circleAlign},
26
- ]}>
27
- <View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
28
- <View style={[styles.circleSmall, {backgroundColor}]} />
29
- </View>
30
- </TouchableOpacity>
23
+ <ScreenContext.Provider
24
+ value={{
25
+ ...screenInfo,
26
+ componentName: 'Switch',
27
+ params: {
28
+ value,
29
+ },
30
+ }}>
31
+ <TouchableOpacity
32
+ disabled={disabled}
33
+ onPress={() => onChange?.(!value)}
34
+ style={[
35
+ style,
36
+ styles.container,
37
+ {backgroundColor, alignItems: circleAlign},
38
+ ]}>
39
+ <View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
40
+ <View style={[styles.circleSmall, {backgroundColor}]} />
41
+ </View>
42
+ </TouchableOpacity>
43
+ </ScreenContext.Provider>
31
44
  );
32
45
  };
33
46
 
package/Text/styles.ts CHANGED
@@ -5,7 +5,7 @@ export default {
5
5
  header_s_semibold: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
6
6
  header_xs_semibold: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
7
7
  body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
8
- body_default_regularstrikethrought: {
8
+ body_regularstrikethrought: {
9
9
  fontSize: 14,
10
10
  lineHeight: 20,
11
11
  fontWeight: '400',
package/Text/types.ts CHANGED
@@ -20,7 +20,7 @@ export type Typography =
20
20
  | 'header_s_semibold'
21
21
  | 'header_xs_semibold'
22
22
  | 'body_default_regular'
23
- | 'body_default_regularstrikethrought'
23
+ | 'body_regularstrikethrought'
24
24
  | 'description_default_regular'
25
25
  | 'description_default_regularstrikethrought'
26
26
  | 'description_xs_regular'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.43-rc.6",
3
+ "version": "0.88.1-beta.1",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {