@momo-kits/foundation 0.75.1-beta.8 → 0.75.2-beta.0

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 (112) hide show
  1. package/Application/BottomTab/BottomTabBar.tsx +478 -0
  2. package/Application/BottomTab/index.tsx +134 -0
  3. package/Application/Components.tsx +552 -0
  4. package/Application/ModalScreen.tsx +244 -0
  5. package/Application/Navigation.ts +50 -0
  6. package/Application/NavigationContainer.tsx +128 -0
  7. package/Application/Navigator.ts +151 -0
  8. package/Application/StackScreen.tsx +146 -0
  9. package/Application/index.ts +37 -0
  10. package/{Navigation → Application}/types.ts +96 -27
  11. package/Application/utils.tsx +175 -0
  12. package/Assets/DotAnimation.json +256 -0
  13. package/Assets/SpinnerAnimation.json +1027 -0
  14. package/Assets/icon.json +89 -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 +5 -1
  32. package/Divider/index.tsx +3 -1
  33. package/Icon/index.tsx +14 -10
  34. package/Icon/types.ts +4 -3
  35. package/IconButton/index.tsx +24 -15
  36. package/Image/index.tsx +63 -45
  37. package/Image/styles.ts +1 -9
  38. package/Image/types.ts +5 -1
  39. package/Input/Input.tsx +227 -115
  40. package/Input/InputDropDown.tsx +132 -0
  41. package/Input/InputMoney.tsx +174 -110
  42. package/Input/InputOTP.tsx +257 -0
  43. package/Input/InputSearch.tsx +160 -130
  44. package/Input/InputTextArea.tsx +149 -121
  45. package/Input/common.tsx +43 -18
  46. package/Input/index.tsx +205 -17
  47. package/Input/styles.ts +44 -7
  48. package/Input/utils.ts +2 -2
  49. package/Layout/Card.tsx +154 -62
  50. package/Layout/FloatingButton.tsx +128 -0
  51. package/Layout/GridSystem.tsx +35 -23
  52. package/Layout/Item.tsx +56 -0
  53. package/Layout/ItemList.tsx +55 -0
  54. package/Layout/ItemSectionList.tsx +39 -0
  55. package/Layout/Screen.tsx +378 -0
  56. package/Layout/Section.tsx +74 -39
  57. package/Layout/index.ts +14 -3
  58. package/Layout/styles.ts +101 -0
  59. package/Layout/types.ts +1 -39
  60. package/Layout/utils.ts +42 -37
  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/Dot.tsx +1 -1
  70. package/Pagination/PaginationDot.tsx +8 -3
  71. package/Pagination/PaginationNumber.tsx +8 -7
  72. package/Pagination/PaginationScroll.tsx +1 -1
  73. package/Pagination/PaginationWhiteDot.tsx +8 -5
  74. package/Pagination/styles.ts +3 -0
  75. package/Pagination/types.ts +2 -0
  76. package/Popup/PopupNotify.tsx +102 -44
  77. package/Popup/PopupPromotion.tsx +63 -22
  78. package/Popup/types.ts +15 -4
  79. package/Radio/index.tsx +35 -21
  80. package/Radio/types.ts +7 -5
  81. package/Skeleton/index.tsx +1 -1
  82. package/Skeleton/types.ts +3 -0
  83. package/Switch/index.tsx +35 -24
  84. package/Switch/types.ts +5 -3
  85. package/Tag/index.tsx +1 -1
  86. package/Text/index.tsx +32 -26
  87. package/Text/styles.ts +38 -0
  88. package/Text/types.ts +25 -13
  89. package/Text/utils.ts +14 -0
  90. package/Title/index.tsx +186 -0
  91. package/Title/styles.ts +79 -0
  92. package/Title/types.ts +20 -0
  93. package/code-scanner.js +143 -0
  94. package/index.ts +17 -3
  95. package/migrate_typo.js +56 -0
  96. package/package.json +44 -39
  97. package/publish.sh +2 -5
  98. package/tsconfig.json +24 -0
  99. package/verify.js +47 -0
  100. package/Assets/header-background.png +0 -0
  101. package/Layout/ScreenContainer.tsx +0 -122
  102. package/Navigation/BottomTab.tsx +0 -39
  103. package/Navigation/Components.tsx +0 -365
  104. package/Navigation/ModalScreen.tsx +0 -226
  105. package/Navigation/Navigation.ts +0 -44
  106. package/Navigation/NavigationButton.tsx +0 -54
  107. package/Navigation/NavigationContainer.tsx +0 -77
  108. package/Navigation/Navigator.ts +0 -82
  109. package/Navigation/Observer.ts +0 -79
  110. package/Navigation/StackScreen.tsx +0 -27
  111. package/Navigation/index.ts +0 -14
  112. package/Navigation/utils.tsx +0 -137
package/Image/index.tsx CHANGED
@@ -1,80 +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 '../Navigation';
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/${accessibilityLabel ?? source}`}>
60
- <FastImage
61
- {...rest}
62
- source={source}
63
- style={styles.image}
64
- onLoad={() => {
65
- setFail(false);
66
- setLoading(rest.loading);
67
- }}
68
- onLoadEnd={() => setLoading(false)}
69
- onError={() => setFail(true)}
70
- />
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
+ }}>
71
93
  {renderContent()}
72
- </View>
94
+ </FastImage>
73
95
  );
74
96
  };
75
97
 
76
- Image.defaultProps = {
77
- loading: true,
78
- };
79
-
80
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,136 +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 '../Navigation';
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
- editable={!disabled}
90
- textAlignVertical="top"
91
- ref={inputRef}
92
- style={[
93
- styles.input,
94
- {
95
- color: textColor,
96
- },
97
- ]}
98
- textBreakStrategy="highQuality"
99
- value={value}
100
- onChangeText={_onChangeText}
101
- onFocus={_onFocus}
102
- onBlur={_onBlur}
103
- placeholder={placeholder}
104
- selectionColor={theme.colors.primary}
105
- 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}
106
241
  />
107
242
  </View>
108
- <View style={styles.iconView}>
109
- {focused && haveValue && (
110
- <TouchableOpacity style={styles.iconWrapper} onPress={onClearText}>
111
- <Icon
112
- source="24_navigation_close_circle_full"
113
- size={16}
114
- color={theme.colors.text.hint}
115
- />
116
- </TouchableOpacity>
117
- )}
118
- {!!icon && <Icon color={iconTintColor} source={icon} size={24} />}
119
- </View>
120
- </View>
243
+ </ComponentContext.Provider>
121
244
  );
122
- };
123
-
124
- return (
125
- <View style={styles.wrapper} accessibilityLabel={`Input`}>
126
- {renderInputView()}
127
- <ErrorView errorMessage={errorMessage} />
128
- </View>
129
- );
130
- };
131
-
132
- Input.defaultProps = {
133
- size: 'small',
134
- };
245
+ },
246
+ );
135
247
 
136
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, 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;