@momo-kits/foundation 0.89.4-rc.4 → 0.89.4-react-native.0.71.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.
@@ -62,9 +62,11 @@ const BottomTab: React.FC<BottomTabProps> = ({
62
62
  <Tab.Navigator
63
63
  initialRouteName={initialRouteName}
64
64
  backBehavior={'firstRoute'}
65
+ screenOptions={{headerShown: false}}
65
66
  tabBarOptions={{
66
67
  style: {
67
68
  height: 68 + Math.min(insets.bottom, 21),
69
+ borderWidth: 0,
68
70
  },
69
71
  tabStyle: {
70
72
  height: 68,
@@ -287,7 +287,6 @@ const HeaderToolkitAction: React.FC<any> = ({
287
287
  preventBack,
288
288
  }) => {
289
289
  const {theme, navigator} = useContext(ApplicationContext);
290
- const miniContext = useContext(MiniAppContext);
291
290
  const [toolConfig, setToolConfig] = useState<any>();
292
291
  const {onAction} = toolConfig ?? {};
293
292
 
@@ -297,12 +296,10 @@ const HeaderToolkitAction: React.FC<any> = ({
297
296
  }
298
297
 
299
298
  useEffect(() => {
300
- if (miniContext?.toolkitConfig?.hidden === false) {
301
- if (navigator?.toolkitConfig) {
302
- setToolConfig(navigator?.toolkitConfig);
303
- } else {
304
- getToolkitConfig();
305
- }
299
+ if (navigator?.toolkitConfig) {
300
+ setToolConfig(navigator?.toolkitConfig);
301
+ } else {
302
+ getToolkitConfig();
306
303
  }
307
304
  }, []);
308
305
 
@@ -3,11 +3,7 @@ import {ScreenParams} from './types';
3
3
  import Navigation from './Navigation';
4
4
  import {ApplicationContext, MiniAppContext} from './index';
5
5
  import {GridSystem} from '../Layout';
6
- import {useHeaderHeight} from '@react-navigation/stack';
7
-
8
- const {
9
- ScreenContext,
10
- } = require('react-native/Libraries/Components/ScreenContext');
6
+ import {useHeaderHeight} from '@react-navigation/elements';
11
7
 
12
8
  const StackScreen: React.FC<ScreenParams> = props => {
13
9
  const {theme, showGrid, navigator} = useContext(ApplicationContext);
@@ -65,18 +61,10 @@ const StackScreen: React.FC<ScreenParams> = props => {
65
61
  }, []);
66
62
 
67
63
  return (
68
- <ScreenContext.Provider
69
- value={{
70
- appId: context.appId,
71
- code: context.code,
72
- screenName: Component.name,
73
- autoTracking: (data: any) => {
74
- navigator?.maxApi?.dispatchFunction?.('autoTracking', data);
75
- },
76
- }}>
64
+ <>
77
65
  <Component heightHeader={heightHeader} {...params} />
78
66
  {showGrid && <GridSystem />}
79
- </ScreenContext.Provider>
67
+ </>
80
68
  );
81
69
  };
82
70
 
@@ -76,7 +76,7 @@ export type MiniAppInfo = {
76
76
  appId: string;
77
77
  buildNumber: number;
78
78
  flowPartnerId?: string;
79
- toolkitConfig?: any;
79
+ toolkitConfig?: object;
80
80
  fromCode?: string;
81
81
  };
82
82
 
@@ -148,39 +148,4 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
148
148
  };
149
149
  };
150
150
 
151
- const formatComponentName= (word: string) =>{
152
- const accentsMap = {
153
- 'a': 'á|à|ả|ã|ạ|â|ấ|ầ|ẩ|ẫ|ậ|ă|ắ|ằ|ẳ|ẵ|ặ',
154
- 'A': 'Á|À|Ả|Ã|Ạ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ă|Ắ|Ằ|Ẳ|Ẵ|Ặ',
155
- 'e': 'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ',
156
- 'E': 'É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ',
157
- 'i': 'í|ì|ỉ|ĩ|ị',
158
- 'I': 'Í|Ì|Ỉ|Ĩ|Ị',
159
- 'o': 'ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ',
160
- 'O': 'Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ',
161
- 'u': 'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự',
162
- 'U': 'Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự',
163
- 'y': 'ý|ỳ|ỷ|ỹ|ỵ',
164
- 'Y': 'Ý|Ỳ|Ỷ|Ỹ|Ỵ',
165
- 'd': 'đ',
166
- 'D': 'Đ'
167
- };
168
-
169
- for (const [nonAccent, accentGroup] of Object.entries(accentsMap)) {
170
- const accents = new RegExp(accentGroup, 'g');
171
- word = word.replace(accents, nonAccent);
172
- }
173
-
174
- word = word.replace(/\s+/g, '_').toLowerCase();
175
-
176
- return word;
177
- }
178
-
179
- const formatNameLength = (name: string) =>{
180
- let formattedName = name
181
- if (formattedName.length > 100) {
182
- formattedName = formattedName.substring(0, 100);
183
- }
184
- return formattedName
185
- }
186
- export {getStackOptions, getDialogOptions, getModalOptions, getOptions, formatComponentName, formatNameLength};
151
+ export {getStackOptions, getDialogOptions, getModalOptions, getOptions};
package/Button/index.tsx CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  TouchableOpacityProps,
7
7
  View,
8
8
  } from 'react-native';
9
+
9
10
  import LinearGradient from 'react-native-linear-gradient';
10
11
  import {ApplicationContext} from '../Application';
11
12
  import {Text} from '../Text';
@@ -14,11 +15,6 @@ import {Colors, Spacing} from '../Consts';
14
15
  import styles from './styles';
15
16
  import {Icon} from '../Icon';
16
17
  import {Loader} from '../Loader';
17
- import {formatComponentName} from '../Application/utils';
18
-
19
- const {
20
- ScreenContext,
21
- } = require('react-native/Libraries/Components/ScreenContext');
22
18
 
23
19
  const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
24
20
 
@@ -74,10 +70,6 @@ export interface ButtonProps extends TouchableOpacityProps {
74
70
  * A callback function that is called when the button is pressed.
75
71
  */
76
72
  onPress: () => void;
77
-
78
- params?: any;
79
-
80
- componentId?: string;
81
73
  }
82
74
 
83
75
  const Button: FC<ButtonProps> = ({
@@ -90,8 +82,6 @@ const Button: FC<ButtonProps> = ({
90
82
  loading = false,
91
83
  title = 'Button',
92
84
  onPress,
93
- params,
94
- componentId,
95
85
  ...rest
96
86
  }) => {
97
87
  const {theme, config} = useContext(ApplicationContext);
@@ -104,8 +94,6 @@ const Button: FC<ButtonProps> = ({
104
94
  end: {x: 0, y: 0.5},
105
95
  };
106
96
  }
107
-
108
- const screenInfo = useContext<any>(ScreenContext);
109
97
  const getSizeStyle = () => {
110
98
  const styleSheet: {[key: string]: any} = styles;
111
99
  return styleSheet[size ?? 'small'];
@@ -303,34 +291,19 @@ const Button: FC<ButtonProps> = ({
303
291
  const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
304
292
 
305
293
  return (
306
- <ScreenContext.Provider
307
- value={{
308
- ...screenInfo,
309
- componentName: 'Button',
310
- params,
311
- state: loading
312
- ? 'loading'
313
- : type === 'disabled'
314
- ? 'disabled'
315
- : 'enabled',
316
- componentId,
317
- componentValue: formatComponentName(title),
318
- action: 'click',
319
- }}>
320
- <TouchableOpacity
321
- {...rest}
322
- activeOpacity={activeOpacity}
323
- onPress={onPressButton}
324
- style={buttonStyle}>
325
- {renderLeading()}
326
- {renderTitle()}
327
- {renderTrailing()}
328
- {gradientPros && (
329
- <AnimationLinear {...gradientPros} style={styles.gradientView} />
330
- )}
331
- {gradientPros && <View style={styles.strokeView} />}
332
- </TouchableOpacity>
333
- </ScreenContext.Provider>
294
+ <TouchableOpacity
295
+ {...rest}
296
+ activeOpacity={activeOpacity}
297
+ onPress={onPressButton}
298
+ style={buttonStyle}>
299
+ {renderLeading()}
300
+ {renderTitle()}
301
+ {renderTrailing()}
302
+ {gradientPros && (
303
+ <AnimationLinear {...gradientPros} style={styles.gradientView} />
304
+ )}
305
+ {gradientPros && <View style={styles.strokeView} />}
306
+ </TouchableOpacity>
334
307
  );
335
308
  };
336
309
 
@@ -5,11 +5,6 @@ import styles from './styles';
5
5
  import {ApplicationContext} from '../Application';
6
6
  import {Text} from '../Text';
7
7
  import {Icon} from '../Icon';
8
- import {formatNameLength} from '../Application/utils';
9
-
10
- const {
11
- ScreenContext,
12
- } = require('react-native/Libraries/Components/ScreenContext');
13
8
 
14
9
  const CheckBox: FC<CheckBoxProps> = ({
15
10
  value,
@@ -18,11 +13,8 @@ const CheckBox: FC<CheckBoxProps> = ({
18
13
  style,
19
14
  label,
20
15
  indeterminate,
21
- params,
22
- componentId,
23
16
  }) => {
24
17
  const {theme} = useContext(ApplicationContext);
25
- const screenInfo = useContext<any>(ScreenContext);
26
18
  const haveValue = value || indeterminate;
27
19
  const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
28
20
  let borderColor = theme.colors.text.default;
@@ -43,38 +35,26 @@ const CheckBox: FC<CheckBoxProps> = ({
43
35
  }
44
36
 
45
37
  return (
46
- <ScreenContext.Provider
47
- value={{
48
- ...screenInfo,
49
- componentName: 'Button',
50
- params,
51
- state: disabled ? 'disabled' : 'filled',
52
- componentId,
53
- action: 'click',
54
- componentLabel: formatNameLength(label || ''),
55
- componentValue: indeterminate ? 'indetermine' : value,
56
- }}>
57
- <TouchableOpacity
58
- activeOpacity={0.8}
59
- onPress={() => onChange?.(!value)}
60
- disabled={disabled}
61
- style={[style, styles.container]}>
62
- <View
63
- style={[
64
- {borderColor, backgroundColor, borderWidth: 1},
65
- styles.checkbox,
66
- ]}>
67
- {haveValue && (
68
- <Icon
69
- color={theme.colors.background.surface}
70
- size={20}
71
- source={iconSource}
72
- />
73
- )}
74
- </View>
75
- {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
76
- </TouchableOpacity>
77
- </ScreenContext.Provider>
38
+ <TouchableOpacity
39
+ activeOpacity={0.8}
40
+ onPress={() => onChange?.(!value)}
41
+ disabled={disabled}
42
+ style={[style, styles.container]}>
43
+ <View
44
+ style={[
45
+ {borderColor, backgroundColor, borderWidth: 1},
46
+ styles.checkbox,
47
+ ]}>
48
+ {haveValue && (
49
+ <Icon
50
+ color={theme.colors.background.surface}
51
+ size={20}
52
+ source={iconSource}
53
+ />
54
+ )}
55
+ </View>
56
+ {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
57
+ </TouchableOpacity>
78
58
  );
79
59
  };
80
60
 
package/CheckBox/types.ts CHANGED
@@ -35,8 +35,4 @@ export type CheckBoxProps = {
35
35
  * Accepts an object of style properties.
36
36
  */
37
37
  style?: ViewStyle;
38
-
39
- params?: any
40
-
41
- componentId?: string
42
38
  };
@@ -9,11 +9,6 @@ import {ApplicationContext} from '../Application';
9
9
  import {Colors} from '../Consts';
10
10
  import {Icon} from '../Icon';
11
11
  import styles from './styles';
12
- import {formatComponentName} from '../Application/utils';
13
-
14
- const {
15
- ScreenContext,
16
- } = require('react-native/Libraries/Components/ScreenContext');
17
12
 
18
13
  export interface IconButtonProps extends TouchableOpacityProps {
19
14
  /**
@@ -31,10 +26,6 @@ export interface IconButtonProps extends TouchableOpacityProps {
31
26
  * Optional. Defines the size of the IconButton.
32
27
  */
33
28
  size?: 'large' | 'small';
34
-
35
- params?: any;
36
-
37
- componentId?: string;
38
29
  }
39
30
 
40
31
  const IconButton: React.FC<IconButtonProps> = ({
@@ -42,12 +33,9 @@ const IconButton: React.FC<IconButtonProps> = ({
42
33
  icon,
43
34
  size,
44
35
  onPress,
45
- params,
46
- componentId,
47
36
  ...rest
48
37
  }) => {
49
38
  const {theme} = useContext(ApplicationContext);
50
- const screenInfo = useContext<any>(ScreenContext);
51
39
 
52
40
  /**
53
41
  * get size icon button
@@ -133,24 +121,13 @@ const IconButton: React.FC<IconButtonProps> = ({
133
121
  const iconSize = size === 'small' ? 16 : 24;
134
122
 
135
123
  return (
136
- <ScreenContext.Provider
137
- value={{
138
- ...screenInfo,
139
- componentName: 'IconButton',
140
- params,
141
- state: type === 'disabled' ? 'disabled' : 'enabled',
142
- componentId,
143
- componentValue: formatComponentName(icon),
144
- action: 'click',
145
- }}>
146
- <TouchableOpacity
147
- {...rest}
148
- activeOpacity={activeOpacity}
149
- onPress={onPressButton}
150
- style={buttonStyle}>
151
- <Icon size={iconSize} source={icon} color={getIconColor()} />
152
- </TouchableOpacity>
153
- </ScreenContext.Provider>
124
+ <TouchableOpacity
125
+ {...rest}
126
+ activeOpacity={activeOpacity}
127
+ onPress={onPressButton}
128
+ style={buttonStyle}>
129
+ <Icon size={iconSize} source={icon} color={getIconColor()} />
130
+ </TouchableOpacity>
154
131
  );
155
132
  };
156
133
 
package/Image/index.tsx CHANGED
@@ -1,12 +1,13 @@
1
1
  import React, {useContext, useRef, useState} from 'react';
2
2
  import {StyleSheet, View} from 'react-native';
3
- import FastImage from 'react-native-fast-image';
3
+
4
4
  import styles from './styles';
5
5
  import {ApplicationContext} from '../Application';
6
6
  import {Skeleton} from '../Skeleton';
7
7
  import {Icon} from '../Icon';
8
8
  import {Styles} from '../Consts';
9
9
  import {ImageProps} from './types';
10
+ import FastImage from 'react-native-fast-image';
10
11
 
11
12
  type Status = 'success' | 'loading' | 'error';
12
13
 
package/Input/Input.tsx CHANGED
@@ -13,11 +13,6 @@ import {InputProps} from './index';
13
13
  import {Icon} from '../Icon';
14
14
  import {checkTyping} from './utils';
15
15
  import {Loader} from '../Loader';
16
- import {formatComponentName} from '../Application/utils';
17
-
18
- const {
19
- ScreenContext,
20
- } = require('react-native/Libraries/Components/ScreenContext');
21
16
 
22
17
  const Input = forwardRef(
23
18
  (
@@ -44,8 +39,6 @@ const Input = forwardRef(
44
39
  onPressIcon,
45
40
  secureTextEntry,
46
41
  style,
47
- params,
48
- componentId,
49
42
  ...props
50
43
  }: InputProps,
51
44
  ref,
@@ -55,7 +48,6 @@ const Input = forwardRef(
55
48
  const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
56
49
  const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
57
50
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
58
- const screenInfo = useContext<any>(ScreenContext);
59
51
 
60
52
  const onClearText = () => {
61
53
  inputRef?.current?.clear();
@@ -188,34 +180,11 @@ const Input = forwardRef(
188
180
  );
189
181
  };
190
182
 
191
- let inputState = 'active';
192
-
193
- if (value && value?.length > 0) {
194
- inputState = 'filled';
195
- }
196
- if (errorMessage && errorMessage?.length > 0) {
197
- inputState = 'error';
198
- }
199
-
200
- if (disabled) {
201
- inputState = 'disabled';
202
- }
203
-
204
183
  return (
205
- <ScreenContext.Provider
206
- value={{
207
- ...screenInfo,
208
- componentName: 'Input',
209
- params,
210
- componentLabel: formatComponentName(floatingValue || ''),
211
- state: inputState,
212
- componentId,
213
- }}>
214
- <View style={[style, styles.wrapper]}>
215
- {renderInputView()}
216
- <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
217
- </View>
218
- </ScreenContext.Provider>
184
+ <View style={[style, styles.wrapper]}>
185
+ {renderInputView()}
186
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
187
+ </View>
219
188
  );
220
189
  },
221
190
  );
@@ -7,11 +7,6 @@ import {InputDropDownProps} from './index';
7
7
  import {Icon} from '../Icon';
8
8
  import {Loader} from '../Loader';
9
9
  import {Styles} from '../Consts';
10
- import {formatComponentName} from '../Application/utils';
11
-
12
- const {
13
- ScreenContext,
14
- } = require('react-native/Libraries/Components/ScreenContext');
15
10
 
16
11
  const InputDropDown = ({
17
12
  value,
@@ -31,13 +26,10 @@ const InputDropDown = ({
31
26
  leadingIcon,
32
27
  leadingIconColor,
33
28
  style,
34
- params,
35
- componentId,
36
29
  ...props
37
30
  }: InputDropDownProps) => {
38
31
  const {theme} = useContext(ApplicationContext);
39
32
  const full = !!value || !!placeholder;
40
- const screenInfo = useContext<any>(ScreenContext);
41
33
 
42
34
  const renderIcon = (color: string | undefined) => {
43
35
  if (loading) {
@@ -112,22 +104,10 @@ const InputDropDown = ({
112
104
  };
113
105
 
114
106
  return (
115
- <ScreenContext.Provider
116
- value={{
117
- ...screenInfo,
118
- componentName: 'InputOTP',
119
- params,
120
- state: 'enabled',
121
- componentLabel: formatComponentName(floatingValue || ''),
122
- componentId,
123
- }}>
124
- <TouchableOpacity
125
- onPress={onPress}
126
- style={[style, full && styles.wrapper]}>
127
- {renderInputView()}
128
- <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
129
- </TouchableOpacity>
130
- </ScreenContext.Provider>
107
+ <TouchableOpacity onPress={onPress} style={[style, full && styles.wrapper]}>
108
+ {renderInputView()}
109
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
110
+ </TouchableOpacity>
131
111
  );
132
112
  };
133
113
 
@@ -18,11 +18,6 @@ import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
18
18
  import {InputMoneyProps} from './index';
19
19
  import {Icon} from '../Icon';
20
20
  import {formatMoneyToNumber, formatNumberToMoney} from './utils';
21
- import {formatComponentName} from '../Application/utils';
22
-
23
- const {
24
- ScreenContext,
25
- } = require('react-native/Libraries/Components/ScreenContext');
26
21
 
27
22
  const InputMoney = forwardRef(
28
23
  (
@@ -41,9 +36,7 @@ const InputMoney = forwardRef(
41
36
  required = false,
42
37
  errorSpacing,
43
38
  style,
44
- params,
45
39
  defaultValue = '',
46
- componentId,
47
40
  ...props
48
41
  }: InputMoneyProps,
49
42
  ref,
@@ -51,7 +44,6 @@ const InputMoney = forwardRef(
51
44
  const {theme} = useContext(ApplicationContext);
52
45
  const [focused, setFocused] = useState(false);
53
46
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
54
- const screenInfo = useContext<any>(ScreenContext);
55
47
 
56
48
  const validateText = (text: string) => {
57
49
  const valueFormat = formatMoneyToNumber(text, 'đ');
@@ -159,34 +151,11 @@ const InputMoney = forwardRef(
159
151
  );
160
152
  };
161
153
 
162
- let inputState = 'active';
163
-
164
- if (value && value?.length > 0) {
165
- inputState = 'filled';
166
- }
167
- if (errorMessage && errorMessage?.length > 0) {
168
- inputState = 'error';
169
- }
170
-
171
- if (disabled) {
172
- inputState = 'disabled';
173
- }
174
-
175
154
  return (
176
- <ScreenContext.Provider
177
- value={{
178
- ...screenInfo,
179
- componentName: 'InputMoney',
180
- params,
181
- componentLabel: formatComponentName(floatingValue || ''),
182
- state: inputState,
183
- componentId,
184
- }}>
185
- <View style={[style, styles.wrapper]}>
186
- {renderInputView()}
187
- <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
188
- </View>
189
- </ScreenContext.Provider>
155
+ <View style={[style, styles.wrapper]}>
156
+ {renderInputView()}
157
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
158
+ </View>
190
159
  );
191
160
  },
192
161
  );
@@ -21,11 +21,6 @@ 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 {formatComponentName} from '../Application/utils';
25
-
26
- const {
27
- ScreenContext,
28
- } = require('react-native/Libraries/Components/ScreenContext');
29
24
 
30
25
  const OTPCaret: FC<CaretProps> = ({index, length}) => {
31
26
  const DURATION = 300;
@@ -83,9 +78,7 @@ const InputOTP = forwardRef(
83
78
  onFocus,
84
79
  onBlur,
85
80
  dataType = 'number',
86
- params,
87
81
  style,
88
- componentId,
89
82
  ...props
90
83
  }: InputOTPProps,
91
84
  ref,
@@ -95,7 +88,6 @@ const InputOTP = forwardRef(
95
88
  const [focused, setFocused] = useState(false);
96
89
  const inputRef = useRef<TextInput>(null);
97
90
  const {theme} = useContext(ApplicationContext);
98
- const screenInfo = useContext<any>(ScreenContext);
99
91
 
100
92
  useImperativeHandle(ref, () => ({
101
93
  onChangeText: (text: string) => {
@@ -229,23 +221,13 @@ const InputOTP = forwardRef(
229
221
  };
230
222
 
231
223
  return (
232
- <ScreenContext.Provider
233
- value={{
234
- ...screenInfo,
235
- componentName: 'InputOTP',
236
- params,
237
- componentLabel: formatComponentName(floatingValue || ''),
238
- state: 'enabled',
239
- componentId,
240
- }}>
241
- <TouchableOpacity
242
- activeOpacity={1}
243
- onPress={onFocusInput}
244
- style={[style, styles.otpWrapper]}>
245
- {renderInputView()}
246
- <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
247
- </TouchableOpacity>
248
- </ScreenContext.Provider>
224
+ <TouchableOpacity
225
+ activeOpacity={1}
226
+ onPress={onFocusInput}
227
+ style={[style, styles.otpWrapper]}>
228
+ {renderInputView()}
229
+ <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
230
+ </TouchableOpacity>
249
231
  );
250
232
  },
251
233
  );
@@ -13,10 +13,6 @@ import {Icon} from '../Icon';
13
13
  import {Text} from '../Text';
14
14
  import {checkTyping} from './utils';
15
15
 
16
- const {
17
- ScreenContext,
18
- } = require('react-native/Libraries/Components/ScreenContext');
19
-
20
16
  const InputSearch = forwardRef(
21
17
  (
22
18
  {
@@ -32,9 +28,7 @@ const InputSearch = forwardRef(
32
28
  style,
33
29
  defaultValue,
34
30
  onPressButtonText,
35
- hasColorBG = true,
36
- params,
37
- componentId,
31
+ hasColorBG = true,
38
32
  ...props
39
33
  }: InputSearchProps,
40
34
  ref,
@@ -43,7 +37,6 @@ const InputSearch = forwardRef(
43
37
  const [focused, setFocused] = useState(false);
44
38
  const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
45
39
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
46
- const screenInfo = useContext<any>(ScreenContext);
47
40
 
48
41
  const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
49
42
  setFocused(true);
@@ -124,56 +117,33 @@ const InputSearch = forwardRef(
124
117
  );
125
118
  };
126
119
 
127
- let inputState = 'empty';
128
-
129
- if (focused) {
130
- inputState = 'focus';
131
- }
132
-
133
- if (value && value?.length > 0) {
134
- inputState = 'filled';
135
- }
136
-
137
- const backgroundColor = hasColorBG
138
- ? theme.colors.background.default
139
- : theme.colors.background.surface;
120
+ const backgroundColor = hasColorBG ?theme.colors.background.default:theme.colors.background.surface
140
121
  return (
141
- <ScreenContext.Provider
142
- value={{
143
- ...screenInfo,
144
- componentName: 'InputSearch',
145
- params,
146
- state: inputState,
147
- componentId,
148
- }}>
149
- <View style={[style, styles.searchInputContainer]}>
150
- <View
151
- style={[
152
- styles.searchInputWrapper,
153
- {
154
- backgroundColor,
155
- borderColor: theme.colors.background.surface,
156
- },
157
- ]}>
158
- <Icon
159
- source={'navigation_search'}
160
- size={24}
161
- color={theme.colors.text.hint}
162
- />
163
- {renderInputView()}
164
- {renderIconView()}
165
- </View>
166
- {showButtonText && (
167
- <TouchableOpacity onPress={onPressButtonText}>
168
- <Text
169
- typography={'action_default_bold'}
170
- style={styles.textButton}>
171
- {buttonText}
172
- </Text>
173
- </TouchableOpacity>
174
- )}
122
+ <View style={[style, styles.searchInputContainer]}>
123
+ <View
124
+ style={[
125
+ styles.searchInputWrapper,
126
+ {
127
+ backgroundColor,
128
+ borderColor: theme.colors.background.surface,
129
+ }
130
+ ]}>
131
+ <Icon
132
+ source={'navigation_search'}
133
+ size={24}
134
+ color={theme.colors.text.hint}
135
+ />
136
+ {renderInputView()}
137
+ {renderIconView()}
175
138
  </View>
176
- </ScreenContext.Provider>
139
+ {showButtonText && (
140
+ <TouchableOpacity onPress={onPressButtonText}>
141
+ <Text typography={'action_default_bold'} style={styles.textButton}>
142
+ {buttonText}
143
+ </Text>
144
+ </TouchableOpacity>
145
+ )}
146
+ </View>
177
147
  );
178
148
  },
179
149
  );
package/Input/index.tsx CHANGED
@@ -80,9 +80,6 @@ export interface InputProps extends TextInputProps {
80
80
  fontWeight?: 'Regular' | 'Bold';
81
81
 
82
82
  onPressIcon?: () => void;
83
-
84
- params?: any;
85
- componentId?: string;
86
83
  }
87
84
 
88
85
  type InputPropsWithoutSizeAndIcon = Omit<
@@ -124,14 +121,7 @@ export interface InputSearchProps extends TextInputProps {
124
121
  */
125
122
  icon?: string;
126
123
 
127
- /**
128
- *
129
- */
130
- hasColorBG?: boolean;
131
-
132
- params?: any;
133
-
134
- componentId?: string;
124
+ hasColorBG?: boolean
135
125
  }
136
126
 
137
127
  export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
@@ -255,22 +245,7 @@ export interface InputDropDownProps {
255
245
  */
256
246
  leadingIconColor?: string;
257
247
 
258
- /**
259
- * Optional. params for element tracking.
260
- */
261
- params?: {
262
- [key: string]: any;
263
- };
264
-
265
- /**
266
- * component id for element tracking.
267
- */
268
- componentId?: string;
269
-
270
- /**
271
- * Optional. Represents the style of the InputDropDown component.
272
- */
273
- style?: ViewStyle | ViewStyle[];
248
+ style: ViewStyle | ViewStyle[];
274
249
  }
275
250
 
276
251
  export {Input, InputTextArea, InputSearch, InputMoney, InputOTP, InputDropDown};
package/Layout/Screen.tsx CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  View,
9
9
  ViewProps,
10
10
  } from 'react-native';
11
- import {useHeaderHeight} from '@react-navigation/stack';
11
+ import {useHeaderHeight} from '@react-navigation/elements';
12
12
  import {useSafeAreaInsets} from 'react-native-safe-area-context';
13
13
  import React, {
14
14
  forwardRef,
package/Layout/index.ts CHANGED
@@ -7,6 +7,7 @@ import {GridContextProps} from './types';
7
7
  import Item from './Item';
8
8
  import ItemList from './ItemList';
9
9
  import ItemSectionList from './ItemSectionList';
10
+ import Screen from './Screen';
10
11
 
11
12
  const GridContext = createContext<GridContextProps>({
12
13
  numberOfColumns: 12,
@@ -24,4 +25,5 @@ export {
24
25
  Item,
25
26
  ItemList,
26
27
  ItemSectionList,
28
+ Screen,
27
29
  };
@@ -14,7 +14,7 @@ const DotLoader: FC<LoaderProps> = ({color}) => {
14
14
  color ?? theme.colors.primary,
15
15
  ];
16
16
 
17
- let source: any = animation;
17
+ let source: any = require('../Assets/DotAnimation.json');
18
18
  source.assets[0].layers[0].shapes[0].it.forEach((item: any) => {
19
19
  if (item.ty === 'fl' && item.c) {
20
20
  item.c.k.forEach((fillItem: any, index: number) => {
@@ -1,6 +1,5 @@
1
1
  import React, {FC, useContext} from 'react';
2
2
  import AnimatedLottieView from 'lottie-react-native';
3
- import animation from '../Assets/SpinnerAnimation.json';
4
3
  import {hexToRGBA} from './utils';
5
4
  import {ApplicationContext} from '../Application';
6
5
  import {LoaderProps} from './types';
@@ -8,7 +7,7 @@ import {LoaderProps} from './types';
8
7
  const Spinner: FC<LoaderProps> = ({color}) => {
9
8
  const {theme} = useContext(ApplicationContext);
10
9
 
11
- let source: any = animation;
10
+ let source: any = require('../Assets/DotAnimation.json');
12
11
  source.assets[0].layers.forEach((layer: any) => {
13
12
  layer.shapes[0].it.forEach((item: any) => {
14
13
  if (item.ty === 'fl' && item.c) {
package/Radio/index.tsx CHANGED
@@ -6,11 +6,6 @@ import {Text} from '../Text';
6
6
  import styles from './styles';
7
7
  import {ApplicationContext} from '../Application';
8
8
  import {Spacing} from '../Consts';
9
- import {formatNameLength} from '../Application/utils';
10
-
11
- const {
12
- ScreenContext,
13
- } = require('react-native/Libraries/Components/ScreenContext');
14
9
 
15
10
  const Radio: FC<RadioProps> = ({
16
11
  value,
@@ -19,11 +14,8 @@ const Radio: FC<RadioProps> = ({
19
14
  onChange,
20
15
  label,
21
16
  style,
22
- params,
23
- componentId,
24
17
  }) => {
25
18
  const {theme} = useContext(ApplicationContext);
26
- const screenInfo = useContext<any>(ScreenContext);
27
19
  const selected = value === groupValue;
28
20
  let disabledStyle = {};
29
21
  let checkBoxStyle = {
@@ -46,38 +38,26 @@ const Radio: FC<RadioProps> = ({
46
38
  }
47
39
 
48
40
  return (
49
- <ScreenContext.Provider
50
- value={{
51
- ...screenInfo,
52
- componentName: 'Button',
53
- params,
54
- state: disabled ? 'disabled' : 'enabled',
55
- componentId,
56
- componentLabel: formatNameLength(label || ''),
57
- componentValue: value,
58
- action: 'click',
59
- }}>
60
- <TouchableOpacity
61
- onPress={onChange}
62
- disabled={disabled}
41
+ <TouchableOpacity
42
+ onPress={onChange}
43
+ disabled={disabled}
44
+ style={[
45
+ style,
46
+ {
47
+ flexDirection: 'row',
48
+ alignItems: 'center',
49
+ },
50
+ ]}>
51
+ <View
63
52
  style={[
64
- style,
65
- {
66
- flexDirection: 'row',
67
- alignItems: 'center',
68
- },
69
- ]}>
70
- <View
71
- style={[
72
- styles.radio,
73
- checkBoxStyle,
74
- disabledStyle,
75
- {marginRight: label ? Spacing.XS : 0},
76
- ]}
77
- />
78
- {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
79
- </TouchableOpacity>
80
- </ScreenContext.Provider>
53
+ styles.radio,
54
+ checkBoxStyle,
55
+ disabledStyle,
56
+ {marginRight: label ? Spacing.XS : 0},
57
+ ]}
58
+ />
59
+ {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
60
+ </TouchableOpacity>
81
61
  );
82
62
  };
83
63
 
package/Radio/types.ts CHANGED
@@ -35,9 +35,4 @@ export type RadioProps = {
35
35
  * Accepts an object of style properties.
36
36
  */
37
37
  style?: ViewStyle;
38
-
39
-
40
- params?: any
41
-
42
- componentId?: string
43
38
  };
package/Switch/index.tsx CHANGED
@@ -1,17 +1,11 @@
1
- import React, {FC, useContext} from 'react';
1
+ import React, {FC} 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
-
11
7
  const Switch: FC<SwitchProps> = props => {
12
- const {value, onChange, disabled, style, params, componentId} = props;
13
- const screenInfo = useContext<any>(ScreenContext);
14
-
8
+ const {value, onChange, disabled, style} = props;
15
9
  const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
16
10
  const circleAlign = value ? 'flex-end' : 'flex-start';
17
11
 
@@ -21,29 +15,18 @@ const Switch: FC<SwitchProps> = props => {
21
15
  }
22
16
 
23
17
  return (
24
- <ScreenContext.Provider
25
- value={{
26
- ...screenInfo,
27
- componentName: 'Button',
28
- params,
29
- state: disabled ? 'disabled' : 'enabled',
30
- componentId,
31
- componentValue: value,
32
- action: 'click',
33
- }}>
34
- <TouchableOpacity
35
- disabled={disabled}
36
- onPress={() => onChange?.(!value)}
37
- style={[
38
- style,
39
- styles.container,
40
- {backgroundColor, alignItems: circleAlign},
41
- ]}>
42
- <View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
43
- <View style={[styles.circleSmall, {backgroundColor}]} />
44
- </View>
45
- </TouchableOpacity>
46
- </ScreenContext.Provider>
18
+ <TouchableOpacity
19
+ disabled={disabled}
20
+ onPress={() => onChange?.(!value)}
21
+ style={[
22
+ style,
23
+ styles.container,
24
+ {backgroundColor, alignItems: circleAlign},
25
+ ]}>
26
+ <View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
27
+ <View style={[styles.circleSmall, {backgroundColor}]} />
28
+ </View>
29
+ </TouchableOpacity>
47
30
  );
48
31
  };
49
32
 
package/Switch/types.ts CHANGED
@@ -23,8 +23,4 @@ export type SwitchProps = {
23
23
  * Accepts an object of style properties.
24
24
  */
25
25
  style?: ViewStyle;
26
-
27
- params?: any
28
-
29
- componentId?: string
30
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.89.4-rc.4",
3
+ "version": "0.89.4-react-native.0.71.1",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -10,34 +10,24 @@
10
10
  "@momo-kits/foundation"
11
11
  ],
12
12
  "dependencies": {
13
- "@gorhom/bottom-sheet": "git+https://gitlab.com/momo-platform/bottom-sheet.git#main",
14
- "react-native-safe-area-context": "3.1.4",
13
+ "@gorhom/bottom-sheet": "4.6.1",
14
+ "react-native-safe-area-context": "4.9.0",
15
15
  "react-native-linear-gradient": "2.8.3",
16
- "react-native-gesture-handler": "1.10.3",
17
- "react-native-fast-image": "8.1.5",
18
- "@react-navigation/bottom-tabs": "git+https://gitlab.com/momo-platform/react-navigation-bottom-tabs.git#main",
19
- "@react-navigation/core": "5.16.1",
20
- "@react-navigation/native": "5.9.8",
21
- "@react-navigation/routers": "5.7.4",
22
- "lottie-react-native": "3.3.2",
23
- "@react-navigation/stack": "git+https://gitlab.com/momo-platform/react-navigation-stack.git#main"
16
+ "react-native-gesture-handler": "2.16.0",
17
+ "react-native-fast-image": "8.6.3",
18
+ "@react-navigation/bottom-tabs": "6.5.20",
19
+ "@react-navigation/core": "6.4.16",
20
+ "@react-navigation/native": "6.1.17",
21
+ "@react-navigation/routers": "6.1.9",
22
+ "@react-navigation/stack": "6.3.29",
23
+ "lottie-react-native": "6.7.2"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react-native": "*"
27
27
  },
28
28
  "devDependencies": {
29
- "@babel/core": "^7.12.9",
30
- "@babel/runtime": "^7.12.5",
31
- "@react-native-community/eslint-config": "^2.0.0",
32
- "@types/jest": "26.0.23",
33
- "@types/react-native": "0.64.4",
34
- "@types/react-test-renderer": "16.9.2",
35
- "babel-jest": "^26.6.3",
36
- "eslint": "^7.14.0",
37
- "jest": "^26.6.3",
38
- "metro-react-native-babel-preset": "^0.64.0",
39
- "react-test-renderer": "17.0.1",
40
- "typescript": "^4.0.3",
29
+ "@types/react": "^18.2.6",
30
+ "typescript": "5.0.4",
41
31
  "@momo-platform/versions": "4.1.11",
42
32
  "react-scanner": "^1.1.0"
43
33
  },