@momo-kits/foundation 0.76.1-beta.2 → 0.77.1-optimize.3

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.
Files changed (100) hide show
  1. package/Application/BottomTab/BottomTabBar.tsx +478 -0
  2. package/Application/BottomTab/index.tsx +134 -0
  3. package/Application/Components.tsx +339 -161
  4. package/Application/ModalScreen.tsx +113 -99
  5. package/Application/Navigation.ts +22 -16
  6. package/Application/NavigationContainer.tsx +99 -48
  7. package/Application/Navigator.ts +110 -41
  8. package/Application/StackScreen.tsx +129 -8
  9. package/Application/index.ts +23 -4
  10. package/Application/types.ts +84 -33
  11. package/Application/utils.tsx +71 -49
  12. package/Assets/DotAnimation.json +256 -0
  13. package/Assets/SpinnerAnimation.json +1027 -0
  14. package/Assets/icon.json +83 -5
  15. package/Assets/icon_bank.json +506 -0
  16. package/Assets/language.json +202 -0
  17. package/Badge/Badge.tsx +56 -0
  18. package/Badge/BadgeDot.tsx +11 -0
  19. package/Badge/BadgeRibbon.tsx +125 -0
  20. package/Badge/Shape.tsx +29 -0
  21. package/Badge/index.tsx +7 -0
  22. package/Badge/styles.ts +58 -0
  23. package/Badge/types.ts +63 -0
  24. package/Button/index.tsx +90 -39
  25. package/Button/styles.ts +19 -0
  26. package/CheckBox/index.tsx +58 -43
  27. package/CheckBox/styles.ts +1 -1
  28. package/CheckBox/types.ts +6 -4
  29. package/Consts/colors+spacing+radius.ts +18 -0
  30. package/Consts/styles.ts +0 -26
  31. package/Consts/theme.ts +4 -0
  32. package/Divider/index.tsx +2 -0
  33. package/Icon/index.tsx +14 -9
  34. package/Icon/types.ts +4 -3
  35. package/IconButton/index.tsx +24 -15
  36. package/Image/index.tsx +63 -47
  37. package/Image/styles.ts +1 -9
  38. package/Image/types.ts +5 -1
  39. package/Input/Input.tsx +227 -116
  40. package/Input/InputDropDown.tsx +132 -0
  41. package/Input/InputMoney.tsx +174 -111
  42. package/Input/InputOTP.tsx +257 -0
  43. package/Input/InputSearch.tsx +160 -132
  44. package/Input/InputTextArea.tsx +150 -123
  45. package/Input/common.tsx +42 -17
  46. package/Input/index.tsx +204 -18
  47. package/Input/styles.ts +44 -7
  48. package/Input/utils.ts +2 -2
  49. package/Layout/Card.tsx +67 -29
  50. package/Layout/FloatingButton.tsx +149 -0
  51. package/Layout/GridSystem.tsx +31 -21
  52. package/Layout/Item.tsx +21 -25
  53. package/Layout/ItemList.tsx +55 -0
  54. package/Layout/ItemSectionList.tsx +39 -0
  55. package/Layout/Screen.tsx +343 -153
  56. package/Layout/Section.tsx +66 -34
  57. package/Layout/index.ts +13 -3
  58. package/Layout/styles.ts +101 -0
  59. package/Layout/types.ts +1 -39
  60. package/Layout/utils.ts +27 -52
  61. package/Loader/DotLoader.tsx +37 -0
  62. package/Loader/Loader.tsx +13 -0
  63. package/Loader/ProgressBar.tsx +44 -0
  64. package/Loader/Spinner.tsx +29 -0
  65. package/Loader/index.tsx +4 -0
  66. package/Loader/styles.ts +10 -0
  67. package/Loader/types.ts +35 -0
  68. package/Loader/utils.ts +25 -0
  69. package/Pagination/PaginationDot.tsx +7 -2
  70. package/Pagination/PaginationNumber.tsx +8 -6
  71. package/Pagination/PaginationScroll.tsx +0 -1
  72. package/Pagination/PaginationWhiteDot.tsx +8 -5
  73. package/Pagination/styles.ts +3 -0
  74. package/Pagination/types.ts +2 -0
  75. package/Popup/PopupNotify.tsx +108 -46
  76. package/Popup/PopupPromotion.tsx +63 -22
  77. package/Popup/types.ts +15 -4
  78. package/Radio/index.tsx +35 -21
  79. package/Radio/types.ts +7 -5
  80. package/Skeleton/index.tsx +1 -1
  81. package/Skeleton/types.ts +3 -0
  82. package/Switch/index.tsx +35 -24
  83. package/Switch/types.ts +5 -3
  84. package/Tag/index.tsx +2 -4
  85. package/Text/index.tsx +27 -22
  86. package/Text/styles.ts +38 -0
  87. package/Text/types.ts +25 -13
  88. package/Text/utils.ts +1 -1
  89. package/Title/index.tsx +186 -0
  90. package/Title/styles.ts +79 -0
  91. package/Title/types.ts +20 -0
  92. package/code-scanner.js +143 -0
  93. package/index.ts +6 -0
  94. package/migrate_typo.js +56 -0
  95. package/package.json +14 -9
  96. package/tsconfig.json +24 -0
  97. package/verify.js +47 -0
  98. package/Application/BottomTab.tsx +0 -52
  99. package/Application/NavigationButton.tsx +0 -54
  100. package/Assets/header-background.png +0 -0
package/Image/index.tsx CHANGED
@@ -1,82 +1,98 @@
1
- import React, {useContext, useState} from 'react';
2
- import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native';
3
- import FastImage from 'react-native-fast-image';
1
+ import React, {useContext, useEffect, useRef, useState} from 'react';
2
+ import {StyleSheet, View} from 'react-native';
3
+ import FastImage, {Source} from 'react-native-fast-image';
4
4
  import styles from './styles';
5
- import {ApplicationContext} from '../Application';
5
+ import {
6
+ ApplicationContext,
7
+ ComponentContext,
8
+ MiniAppContext,
9
+ } from '../Application';
6
10
  import {Skeleton} from '../Skeleton';
7
11
  import {Icon} from '../Icon';
8
12
  import {Styles} from '../Consts';
9
- import {FastImagePropsWithoutStyle} from './types';
13
+ import {ImageProps} from './types';
10
14
 
11
- export interface ImageProps extends FastImagePropsWithoutStyle {
12
- style?: StyleProp<ViewStyle>;
13
- loading?: boolean;
14
- accessibilityLabel?: string;
15
- }
15
+ type Status = 'success' | 'loading' | 'error';
16
16
 
17
17
  const Image: React.FC<ImageProps> = ({
18
18
  style,
19
19
  source,
20
+ loading = true,
21
+ children,
22
+ params,
20
23
  accessibilityLabel,
21
24
  ...rest
22
25
  }) => {
23
26
  const {theme} = useContext(ApplicationContext);
24
- const [loading, setLoading] = useState(rest.loading);
25
- const [fail, setFail] = useState(false);
27
+ const app = useContext<any>(MiniAppContext);
28
+ const component = useContext<any>(ComponentContext);
29
+ const error = useRef(false);
30
+ const [status, setStatus] = useState<Status>('success');
31
+
32
+ const test: any = {
33
+ accessibilityLabel: accessibilityLabel || `img|${(source as Source).uri}`,
34
+ };
35
+
36
+ useEffect(() => {
37
+ if (app.enableAutoId) {
38
+ component?.addChildren?.(test.accessibilityLabel, 'add');
39
+ return () => component?.addChildren?.(test.accessibilityLabel, 'remove');
40
+ }
41
+ }, []);
26
42
 
27
43
  /**
28
44
  * render content loading | fail | rendered
29
- * @returns {JSX.Element}
30
45
  */
31
46
  const renderContent = () => {
32
- if (loading || fail) {
33
- let content = (
34
- <Skeleton style={[StyleSheet.absoluteFill, styles.image]} />
35
- );
36
- if (fail) {
47
+ if (status === 'loading' || status === 'error') {
48
+ let content = <Skeleton />;
49
+ if (status === 'error') {
37
50
  content = (
38
- <View style={Styles.flexCenter}>
39
- <Icon source="media_fail" color={theme.colors.text.disable} />
40
- </View>
51
+ <Icon source="media_fail" color={theme.colors.text.disable} />
41
52
  );
42
53
  }
43
54
  return (
44
- <View
45
- style={[
46
- StyleSheet.absoluteFill,
47
- styles.image,
48
- {backgroundColor: theme.colors.background.disable},
49
- ]}>
55
+ <View style={[StyleSheet.absoluteFill, Styles.flexCenter]}>
50
56
  {content}
51
57
  </View>
52
58
  );
53
59
  }
60
+ return children;
54
61
  };
55
62
 
56
63
  return (
57
- <View
64
+ <FastImage
65
+ {...rest}
66
+ {...test}
67
+ source={source}
58
68
  style={[styles.container, style]}
59
- accessibilityLabel={`Image/${
60
- accessibilityLabel ?? (typeof source === 'number' ? source : source.uri)
61
- }`}>
62
- <FastImage
63
- {...rest}
64
- source={source}
65
- style={styles.image}
66
- onLoad={() => {
67
- setFail(false);
68
- setLoading(rest.loading);
69
- }}
70
- onLoadEnd={() => setLoading(false)}
71
- onError={() => setFail(true)}
72
- />
69
+ onProgress={() => {
70
+ error.current = false;
71
+ if (status !== 'loading' && loading) {
72
+ setStatus('loading');
73
+ }
74
+ }}
75
+ onLoadStart={() => {
76
+ error.current = false;
77
+ }}
78
+ onLoad={() => {
79
+ error.current = false;
80
+ }}
81
+ onLoadEnd={() => {
82
+ let current: Status = 'success';
83
+ if (error.current) {
84
+ current = 'error';
85
+ }
86
+ if (status !== current) {
87
+ setStatus(current);
88
+ }
89
+ }}
90
+ onError={() => {
91
+ error.current = true;
92
+ }}>
73
93
  {renderContent()}
74
- </View>
94
+ </FastImage>
75
95
  );
76
96
  };
77
97
 
78
- Image.defaultProps = {
79
- loading: true,
80
- };
81
-
82
98
  export {Image};
package/Image/styles.ts CHANGED
@@ -1,13 +1,5 @@
1
1
  import {StyleSheet} from 'react-native';
2
2
 
3
3
  export default StyleSheet.create({
4
- container: {
5
- overflow: 'hidden',
6
- alignItems: 'center',
7
- justifyContent: 'center',
8
- },
9
- image: {
10
- width: '100%',
11
- height: '100%',
12
- },
4
+ container: {},
13
5
  });
package/Image/types.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  import {FastImageProps} from 'react-native-fast-image';
2
2
 
3
- export type FastImagePropsWithoutStyle = Omit<FastImageProps, 'style'>;
3
+ export interface ImageProps extends FastImageProps {
4
+ loading?: boolean;
5
+ accessibilityLabel?: string;
6
+ params?: any;
7
+ }
package/Input/Input.tsx CHANGED
@@ -1,137 +1,248 @@
1
- import React, {FC, useContext, useEffect, useRef, useState} from 'react';
1
+ import React, {
2
+ forwardRef,
3
+ useContext,
4
+ useImperativeHandle,
5
+ useRef,
6
+ useState,
7
+ } from 'react';
2
8
  import {
3
9
  NativeSyntheticEvent,
10
+ Platform,
4
11
  TextInput,
5
12
  TextInputFocusEventData,
6
13
  TouchableOpacity,
7
14
  View,
8
15
  } from 'react-native';
9
- import {ApplicationContext} from '../Application';
10
- import styles from './styles';
16
+ import {ApplicationContext, ComponentContext} from '../Application';
17
+ import {Icon} from '../Icon';
18
+ import {Loader} from '../Loader';
11
19
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
12
20
  import {InputProps} from './index';
13
- import {Icon} from '../Icon';
21
+ import styles from './styles';
14
22
  import {checkTyping} from './utils';
15
23
 
16
- const Input: FC<InputProps> = ({
17
- value,
18
- onChangeText,
19
- floatingValue,
20
- floatingIcon,
21
- size,
22
- placeholder,
23
- onBlur,
24
- onFocus,
25
- errorMessage,
26
- icon,
27
- disabled,
28
- floatingIconColor,
29
- iconColor,
30
- required,
31
- ...props
32
- }) => {
33
- const {theme} = useContext(ApplicationContext);
34
- const [focused, setFocused] = useState(false);
35
- const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
36
-
37
- const inputRef = useRef<any>(null);
38
-
39
- const onClearText = () => {
40
- inputRef?.current?.clear();
41
- _onChangeText('');
42
- };
43
-
44
- const _onChangeText = (text: string) => {
45
- checkTyping(text, haveValue, setHaveValue);
46
- onChangeText?.(text);
47
- };
48
-
49
- const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
50
- setFocused(true);
51
- onFocus?.(e);
52
- };
53
-
54
- const _onBlur = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
55
- setFocused(false);
56
- onBlur?.(e);
57
- };
58
-
59
- const renderInputView = () => {
60
- const disabledColor = theme.colors.text.disable;
61
- let textColor = theme.colors.text.default;
62
- let placeholderColor = theme.colors.text.hint;
63
- let iconTintColor = iconColor;
24
+ const Input = forwardRef(
25
+ (
26
+ {
27
+ value,
28
+ onChangeText,
29
+ floatingValue,
30
+ floatingIcon,
31
+ size = 'small',
32
+ placeholder,
33
+ onBlur,
34
+ onFocus,
35
+ errorMessage,
36
+ icon,
37
+ disabled = false,
38
+ floatingIconColor,
39
+ iconColor,
40
+ required = false,
41
+ errorSpacing,
42
+ loading = false,
43
+ leadingIcon,
44
+ leadingIconColor,
45
+ fontWeight = 'Regular',
46
+ onPressIcon,
47
+ secureTextEntry,
48
+ keyboardType,
49
+ style,
50
+ params,
51
+ hintText,
52
+ accessibilityLabel,
53
+ editable = true,
54
+ ...props
55
+ }: InputProps,
56
+ ref,
57
+ ) => {
58
+ const {theme} = useContext(ApplicationContext);
59
+ const [focused, setFocused] = useState(false);
60
+ const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
61
+ const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
62
+ const inputRef = useRef<TextInput | null>(null);
63
+
64
+ const onClearText = () => {
65
+ inputRef?.current?.clear();
66
+ _onChangeText('');
67
+ };
68
+
69
+ const _onChangeText = (text: string) => {
70
+ checkTyping(text, haveValue, setHaveValue);
71
+ onChangeText?.(text);
72
+ };
73
+
74
+ const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
75
+ setFocused(true);
76
+ onFocus?.(e);
77
+ };
78
+
79
+ const _onBlur = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
80
+ setFocused(false);
81
+ onBlur?.(e);
82
+ };
83
+
84
+ useImperativeHandle(ref, () => {
85
+ return {
86
+ clear: onClearText,
87
+ focus: () => inputRef.current?.focus(),
88
+ blur: () => inputRef.current?.blur(),
89
+ setText: (text: string) => _onChangeText(text),
90
+ };
91
+ });
92
+
93
+ const renderIcon = (color: string | undefined) => {
94
+ if (loading) {
95
+ return <Loader type={'spinner'} color={color} style={styles.icon} />;
96
+ }
97
+ if (secureTextEntry) {
98
+ return (
99
+ <TouchableOpacity
100
+ onPress={() => setSecureTextInput(!secureTextInput)}
101
+ style={styles.icon}>
102
+ <Icon
103
+ color={color}
104
+ size={24}
105
+ source={
106
+ secureTextInput ? '24_security_eye_off' : '24_security_eye_open'
107
+ }
108
+ />
109
+ </TouchableOpacity>
110
+ );
111
+ }
112
+ if (icon) {
113
+ return (
114
+ <TouchableOpacity
115
+ onPress={onPressIcon}
116
+ disabled={!onPressIcon}
117
+ style={styles.icon}>
118
+ <Icon color={color} source={icon} size={24} />
119
+ </TouchableOpacity>
120
+ );
121
+ }
122
+ };
123
+
124
+ const renderInputView = () => {
125
+ const disabledColor = theme.colors.text.disable;
126
+ const secure = secureTextInput && secureTextEntry;
127
+ let textColor = theme.colors.text.default;
128
+ let placeholderColor = theme.colors.text.hint;
129
+ let iconTintColor = iconColor;
130
+
131
+ if (disabled) {
132
+ textColor = disabledColor;
133
+ placeholderColor = disabledColor;
134
+ iconTintColor = disabledColor;
135
+ }
136
+
137
+ if (secureTextEntry) {
138
+ keyboardType = Platform.select({
139
+ ios: 'ascii-capable',
140
+ android: 'visible-password',
141
+ });
142
+ }
143
+
144
+ return (
145
+ <View
146
+ style={[
147
+ styles.inputWrapper,
148
+ {backgroundColor: theme.colors.background.surface},
149
+ getSizeStyle(size),
150
+ getBorderColor(theme, focused, errorMessage, disabled),
151
+ ]}>
152
+ <FloatingView
153
+ floatingValue={floatingValue}
154
+ floatingIconColor={floatingIconColor}
155
+ disabled={disabled}
156
+ required={required}
157
+ floatingIcon={floatingIcon}
158
+ />
159
+ <View style={styles.inputView}>
160
+ {!!leadingIcon && (
161
+ <View style={styles.leadingIconContainer}>
162
+ <Icon
163
+ color={leadingIconColor}
164
+ source={leadingIcon}
165
+ size={size === 'small' ? 24 : 32}
166
+ />
167
+ </View>
168
+ )}
169
+ <TextInput
170
+ {...props}
171
+ accessibilityLabel={accessibilityLabel}
172
+ editable={editable || !disabled}
173
+ secureTextEntry={secure}
174
+ textAlignVertical="center"
175
+ ref={inputRef}
176
+ style={[
177
+ styles.input,
178
+ {
179
+ color: textColor,
180
+ fontFamily: `${theme.font}-${fontWeight}`,
181
+ },
182
+ secure && haveValue && {fontSize: size === 'small' ? 18 : 22},
183
+ ]}
184
+ textBreakStrategy="highQuality"
185
+ value={value}
186
+ onChangeText={_onChangeText}
187
+ onFocus={_onFocus}
188
+ onBlur={_onBlur}
189
+ placeholder={placeholder}
190
+ selectionColor={theme.colors.primary}
191
+ placeholderTextColor={placeholderColor}
192
+ keyboardType={keyboardType}
193
+ />
194
+ </View>
195
+ <View style={styles.iconView}>
196
+ {focused && haveValue && (
197
+ <TouchableOpacity
198
+ style={styles.iconWrapper}
199
+ onPress={onClearText}>
200
+ <Icon
201
+ source="24_navigation_close_circle_full"
202
+ size={16}
203
+ color={theme.colors.text.hint}
204
+ />
205
+ </TouchableOpacity>
206
+ )}
207
+ {renderIcon(iconTintColor)}
208
+ </View>
209
+ </View>
210
+ );
211
+ };
212
+
213
+ let inputState = 'active';
214
+
215
+ if (value && value?.length > 0) {
216
+ inputState = 'filled';
217
+ }
218
+ if (errorMessage && errorMessage?.length > 0) {
219
+ inputState = 'error';
220
+ }
64
221
 
65
222
  if (disabled) {
66
- textColor = disabledColor;
67
- placeholderColor = disabledColor;
68
- iconTintColor = disabledColor;
223
+ inputState = 'disabled';
69
224
  }
70
225
 
71
226
  return (
72
- <View
73
- style={[
74
- getSizeStyle(size),
75
- getBorderColor(focused, errorMessage, disabled),
76
- styles.inputWrapper,
77
- {backgroundColor: theme.colors.background.surface},
78
- ]}>
79
- <FloatingView
80
- floatingValue={floatingValue}
81
- floatingIconColor={floatingIconColor}
82
- disabled={disabled}
83
- required={required}
84
- floatingIcon={floatingIcon}
85
- />
86
- <View style={styles.inputView}>
87
- <TextInput
88
- {...props}
89
- accessibilityLabel={`TextInput`}
90
- editable={!disabled}
91
- textAlignVertical="top"
92
- ref={inputRef}
93
- style={[
94
- styles.input,
95
- {
96
- color: textColor,
97
- },
98
- ]}
99
- textBreakStrategy="highQuality"
100
- value={value}
101
- onChangeText={_onChangeText}
102
- onFocus={_onFocus}
103
- onBlur={_onBlur}
104
- placeholder={placeholder}
105
- selectionColor={theme.colors.primary}
106
- placeholderTextColor={placeholderColor}
227
+ <ComponentContext.Provider
228
+ value={{
229
+ componentName: 'Input',
230
+ params,
231
+ componentLabel: floatingValue,
232
+ state: inputState,
233
+ componentId: accessibilityLabel,
234
+ }}>
235
+ <View style={[style, styles.wrapper]}>
236
+ {renderInputView()}
237
+ <ErrorView
238
+ errorMessage={errorMessage}
239
+ errorSpacing={errorSpacing}
240
+ hintText={hintText}
107
241
  />
108
242
  </View>
109
- <View style={styles.iconView}>
110
- {focused && haveValue && (
111
- <TouchableOpacity style={styles.iconWrapper} onPress={onClearText}>
112
- <Icon
113
- source="24_navigation_close_circle_full"
114
- size={16}
115
- color={theme.colors.text.hint}
116
- />
117
- </TouchableOpacity>
118
- )}
119
- {!!icon && <Icon color={iconTintColor} source={icon} size={24} />}
120
- </View>
121
- </View>
243
+ </ComponentContext.Provider>
122
244
  );
123
- };
124
-
125
- return (
126
- <View style={styles.wrapper} accessibilityLabel={`Input`}>
127
- {renderInputView()}
128
- <ErrorView errorMessage={errorMessage} />
129
- </View>
130
- );
131
- };
132
-
133
- Input.defaultProps = {
134
- size: 'small',
135
- };
245
+ },
246
+ );
136
247
 
137
248
  export default Input;
@@ -0,0 +1,132 @@
1
+ import React, {useContext} from 'react';
2
+ import {TextInput, TouchableOpacity, View} from 'react-native';
3
+ import {ApplicationContext, ComponentContext} from '../Application';
4
+ import {Styles} from '../Consts';
5
+ import {Icon} from '../Icon';
6
+ import {Loader} from '../Loader';
7
+ import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
8
+ import {InputDropDownProps} from './index';
9
+ import styles from './styles';
10
+
11
+ const InputDropDown = ({
12
+ value,
13
+ floatingValue,
14
+ floatingIcon,
15
+ size = 'small',
16
+ onPress,
17
+ placeholder,
18
+ errorMessage,
19
+ icon = 'arrow_chevron_down_small',
20
+ disabled = false,
21
+ floatingIconColor,
22
+ iconColor,
23
+ required = false,
24
+ errorSpacing,
25
+ loading = false,
26
+ leadingIcon,
27
+ leadingIconColor,
28
+ style,
29
+ params,
30
+ accessibilityLabel,
31
+ hintText,
32
+ ...props
33
+ }: InputDropDownProps) => {
34
+ const {theme} = useContext(ApplicationContext);
35
+ const full = !!value || !!placeholder;
36
+
37
+ const renderIcon = (color: string | undefined) => {
38
+ if (loading) {
39
+ return <Loader type={'spinner'} color={color} />;
40
+ }
41
+ if (icon) {
42
+ return <Icon color={color} source={icon} size={24} />;
43
+ }
44
+ };
45
+
46
+ const renderInputView = () => {
47
+ const disabledColor = theme.colors.text.disable;
48
+ let textColor = theme.colors.text.default;
49
+ let placeholderColor = theme.colors.text.hint;
50
+ let iconTintColor = iconColor;
51
+
52
+ if (disabled) {
53
+ textColor = disabledColor;
54
+ placeholderColor = disabledColor;
55
+ iconTintColor = disabledColor;
56
+ }
57
+
58
+ return (
59
+ <View
60
+ style={[
61
+ styles.inputWrapper,
62
+ {backgroundColor: theme.colors.background.surface},
63
+ getSizeStyle(size),
64
+ getBorderColor(theme, false, errorMessage, disabled),
65
+ ]}>
66
+ <FloatingView
67
+ floatingValue={floatingValue}
68
+ floatingIconColor={floatingIconColor}
69
+ disabled={disabled}
70
+ required={required}
71
+ floatingIcon={floatingIcon}
72
+ />
73
+ <View style={full ? styles.inputView : Styles.row}>
74
+ {!!leadingIcon && (
75
+ <View style={styles.leadingIconContainer}>
76
+ <Icon
77
+ color={leadingIconColor}
78
+ source={leadingIcon}
79
+ size={size === 'small' ? 24 : 32}
80
+ />
81
+ </View>
82
+ )}
83
+ {full && (
84
+ <TextInput
85
+ {...props}
86
+ accessibilityLabel={accessibilityLabel}
87
+ onPressIn={onPress}
88
+ editable={false}
89
+ style={[
90
+ styles.input,
91
+ {
92
+ color: textColor,
93
+ fontFamily: `${theme.font}-Regular`,
94
+ },
95
+ ]}
96
+ textBreakStrategy="highQuality"
97
+ value={value}
98
+ placeholder={placeholder}
99
+ selectionColor={theme.colors.primary}
100
+ placeholderTextColor={placeholderColor}
101
+ />
102
+ )}
103
+ </View>
104
+ <View style={styles.iconView}>{renderIcon(iconTintColor)}</View>
105
+ </View>
106
+ );
107
+ };
108
+
109
+ return (
110
+ <ComponentContext.Provider
111
+ value={{
112
+ componentName: 'InputDropDown',
113
+ params,
114
+ state: 'enabled',
115
+ componentLabel: floatingValue,
116
+ componentId: accessibilityLabel,
117
+ }}>
118
+ <TouchableOpacity
119
+ onPress={onPress}
120
+ style={[style, full && styles.wrapper]}>
121
+ {renderInputView()}
122
+ <ErrorView
123
+ errorMessage={errorMessage}
124
+ errorSpacing={errorSpacing}
125
+ hintText={hintText}
126
+ />
127
+ </TouchableOpacity>
128
+ </ComponentContext.Provider>
129
+ );
130
+ };
131
+
132
+ export default InputDropDown;