@momo-kits/foundation 0.81.51-beta.0 → 0.81.52
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.
- package/Application/{BottomTab/index.tsx → BottomTab.tsx} +18 -42
- package/Application/Components.tsx +91 -356
- package/Application/ModalScreen.tsx +185 -14
- package/Application/Navigation.ts +19 -5
- package/Application/NavigationContainer.tsx +72 -62
- package/Application/Navigator.ts +48 -154
- package/Application/StackScreen.tsx +32 -289
- package/Application/index.ts +15 -13
- package/Application/types.ts +35 -81
- package/Application/utils.tsx +30 -76
- package/Assets/icon_bank.json +1 -1
- package/Badge/Badge.tsx +1 -1
- package/Badge/index.tsx +1 -2
- package/Badge/styles.ts +6 -50
- package/Button/index.tsx +26 -44
- package/CheckBox/index.tsx +26 -37
- package/CheckBox/types.ts +3 -5
- package/Consts/colors+spacing+radius.ts +0 -14
- package/Icon/index.tsx +8 -9
- package/Icon/types.ts +2 -2
- package/IconButton/index.tsx +14 -24
- package/Image/index.tsx +8 -23
- package/Image/types.ts +0 -2
- package/Input/Input.tsx +26 -116
- package/Input/InputDropDown.tsx +51 -66
- package/Input/InputMoney.tsx +15 -106
- package/Input/InputOTP.tsx +26 -49
- package/Input/InputSearch.tsx +99 -252
- package/Input/InputTextArea.tsx +6 -26
- package/Input/common.tsx +22 -48
- package/Input/index.tsx +77 -112
- package/Input/styles.ts +11 -48
- package/Input/utils.ts +1 -1
- package/Layout/Card.tsx +3 -4
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +2 -3
- package/Layout/Screen.tsx +121 -242
- package/Layout/Section.tsx +3 -4
- package/Layout/styles.ts +13 -11
- package/Layout/types.ts +1 -1
- package/Layout/utils.ts +4 -4
- package/Loader/index.tsx +0 -2
- package/Pagination/PaginationScroll.tsx +2 -2
- package/Pagination/styles.ts +1 -1
- package/Popup/PopupNotify.tsx +46 -57
- package/Popup/PopupPromotion.tsx +8 -6
- package/Popup/types.ts +7 -1
- package/Radio/index.tsx +20 -35
- package/Radio/types.ts +3 -5
- package/Switch/index.tsx +18 -32
- package/Switch/types.ts +3 -5
- package/Tag/index.tsx +2 -9
- package/Tag/styles.ts +2 -3
- package/Tag/types.ts +0 -12
- package/Text/index.tsx +5 -24
- package/Text/styles.ts +8 -8
- package/Title/index.tsx +103 -170
- package/Title/styles.ts +9 -36
- package/Title/types.ts +48 -16
- package/code-scanner.js +16 -125
- package/index.ts +0 -7
- package/package.json +7 -8
- package/publish.sh +21 -16
- package/tsconfig.json +1 -1
- package/Application/BottomSheet.tsx +0 -216
- package/Application/BottomTab/BottomTabBar.tsx +0 -278
- package/Application/Localize.ts +0 -44
- package/Application/constants.ts +0 -9
- package/Badge/BadgeDotAnimation.tsx +0 -95
- package/Input/TextTyping.tsx +0 -113
- package/Layout/FloatingButton.tsx +0 -168
package/CheckBox/index.tsx
CHANGED
|
@@ -2,20 +2,17 @@ import React, {FC, useContext} from 'react';
|
|
|
2
2
|
import {TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {CheckBoxProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {ApplicationContext
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
6
|
import {Text} from '../Text';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
|
-
import {formatNameLength} from '../Application/utils';
|
|
9
8
|
|
|
10
9
|
const CheckBox: FC<CheckBoxProps> = ({
|
|
11
10
|
value,
|
|
12
|
-
disabled
|
|
11
|
+
disabled,
|
|
13
12
|
onChange,
|
|
14
13
|
style,
|
|
15
14
|
label,
|
|
16
15
|
indeterminate,
|
|
17
|
-
params,
|
|
18
|
-
accessibilityLabel,
|
|
19
16
|
}) => {
|
|
20
17
|
const {theme} = useContext(ApplicationContext);
|
|
21
18
|
const haveValue = value || indeterminate;
|
|
@@ -38,39 +35,31 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
]}>
|
|
62
|
-
{haveValue && (
|
|
63
|
-
<Icon
|
|
64
|
-
color={theme.colors.background.surface}
|
|
65
|
-
size={20}
|
|
66
|
-
source={iconSource}
|
|
67
|
-
/>
|
|
68
|
-
)}
|
|
69
|
-
</View>
|
|
70
|
-
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
71
|
-
</TouchableOpacity>
|
|
72
|
-
</ComponentContext.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>
|
|
73
58
|
);
|
|
74
59
|
};
|
|
75
60
|
|
|
61
|
+
CheckBox.defaultProps = {
|
|
62
|
+
disabled: false,
|
|
63
|
+
};
|
|
64
|
+
|
|
76
65
|
export {CheckBox};
|
package/CheckBox/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export type CheckBoxProps = {
|
|
4
4
|
/**
|
|
5
5
|
* Represents whether the CheckBox is currently checked (`true`) or unchecked (`false`).
|
|
6
6
|
*/
|
|
@@ -35,6 +35,4 @@ export interface CheckBoxProps extends TouchableOpacityProps {
|
|
|
35
35
|
* Accepts an object of style properties.
|
|
36
36
|
*/
|
|
37
37
|
style?: ViewStyle;
|
|
38
|
-
|
|
39
|
-
params?: any;
|
|
40
|
-
}
|
|
38
|
+
};
|
|
@@ -213,20 +213,6 @@ const Shadow = {
|
|
|
213
213
|
elevation: 6,
|
|
214
214
|
},
|
|
215
215
|
}),
|
|
216
|
-
|
|
217
|
-
Pink: Platform.select({
|
|
218
|
-
ios: {
|
|
219
|
-
shadowColor: '#e27eb5',
|
|
220
|
-
shadowOffset: {width: 0, height: 6},
|
|
221
|
-
shadowOpacity: 0.25,
|
|
222
|
-
shadowRadius: 8,
|
|
223
|
-
},
|
|
224
|
-
android: {
|
|
225
|
-
elevation: 16,
|
|
226
|
-
shadowColor: '#e27eb5',
|
|
227
|
-
shadowOpacity: 0.25,
|
|
228
|
-
},
|
|
229
|
-
}),
|
|
230
216
|
};
|
|
231
217
|
|
|
232
218
|
export {Colors, Spacing, Radius, Shadow};
|
package/Icon/index.tsx
CHANGED
|
@@ -5,12 +5,7 @@ import {IconProps} from './types';
|
|
|
5
5
|
import {ApplicationContext} from '../Application';
|
|
6
6
|
import {Image} from '../Image';
|
|
7
7
|
|
|
8
|
-
const Icon: React.FC<IconProps> = ({
|
|
9
|
-
source = 'ic_back',
|
|
10
|
-
size = 24,
|
|
11
|
-
color,
|
|
12
|
-
style = {},
|
|
13
|
-
}) => {
|
|
8
|
+
const Icon: React.FC<IconProps> = ({source, size, color, style = {}}) => {
|
|
14
9
|
const {theme} = useContext(ApplicationContext);
|
|
15
10
|
|
|
16
11
|
/**
|
|
@@ -25,18 +20,22 @@ const Icon: React.FC<IconProps> = ({
|
|
|
25
20
|
};
|
|
26
21
|
|
|
27
22
|
const tintColorProps = color !== null && {
|
|
28
|
-
tintColor: color ?? theme.colors.text.default
|
|
29
|
-
}
|
|
23
|
+
tintColor: color ?? theme.colors.text.default
|
|
24
|
+
}
|
|
30
25
|
|
|
31
26
|
return (
|
|
32
27
|
<Image
|
|
33
28
|
loading={false}
|
|
34
29
|
source={getIconSource()}
|
|
35
30
|
style={[style, {width: size, height: size}]}
|
|
36
|
-
resizeMode="contain"
|
|
37
31
|
{...tintColorProps}
|
|
38
32
|
/>
|
|
39
33
|
);
|
|
40
34
|
};
|
|
41
35
|
|
|
36
|
+
Icon.defaultProps = {
|
|
37
|
+
source: 'ic_back',
|
|
38
|
+
size: 24,
|
|
39
|
+
};
|
|
40
|
+
|
|
42
41
|
export {Icon, IconSources, IconBankSources};
|
package/Icon/types.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {ImageStyle} from 'react-native-fast-image';
|
|
2
|
-
import {StyleProp} from 'react-native';
|
|
3
2
|
|
|
4
3
|
export type IconProps = {
|
|
5
4
|
/**
|
|
@@ -16,6 +15,7 @@ export type IconProps = {
|
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Optional. Represents the color of the icon.
|
|
18
|
+
* It can be any valid color in @momo-kits/foundation.
|
|
19
19
|
*/
|
|
20
20
|
color?: string | null;
|
|
21
21
|
|
|
@@ -23,5 +23,5 @@ export type IconProps = {
|
|
|
23
23
|
* Optional. Used to apply custom styling to the Icon component.
|
|
24
24
|
* Accepts an object of style properties.
|
|
25
25
|
*/
|
|
26
|
-
style?:
|
|
26
|
+
style?: ImageStyle;
|
|
27
27
|
};
|
package/IconButton/index.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
TouchableOpacity,
|
|
6
6
|
TouchableOpacityProps,
|
|
7
7
|
} from 'react-native';
|
|
8
|
-
import {ApplicationContext
|
|
8
|
+
import {ApplicationContext} from '../Application';
|
|
9
9
|
import {Colors} from '../Consts';
|
|
10
10
|
import {Icon} from '../Icon';
|
|
11
11
|
import styles from './styles';
|
|
@@ -26,17 +26,13 @@ export interface IconButtonProps extends TouchableOpacityProps {
|
|
|
26
26
|
* Optional. Defines the size of the IconButton.
|
|
27
27
|
*/
|
|
28
28
|
size?: 'large' | 'small';
|
|
29
|
-
|
|
30
|
-
params?: any;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
const IconButton: React.FC<IconButtonProps> = ({
|
|
34
|
-
type
|
|
32
|
+
type,
|
|
35
33
|
icon,
|
|
36
34
|
size,
|
|
37
35
|
onPress,
|
|
38
|
-
params,
|
|
39
|
-
accessibilityLabel,
|
|
40
36
|
...rest
|
|
41
37
|
}) => {
|
|
42
38
|
const {theme} = useContext(ApplicationContext);
|
|
@@ -125,25 +121,19 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
125
121
|
const iconSize = size === 'small' ? 16 : 24;
|
|
126
122
|
|
|
127
123
|
return (
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
action: 'click',
|
|
136
|
-
}}>
|
|
137
|
-
<TouchableOpacity
|
|
138
|
-
{...rest}
|
|
139
|
-
accessibilityLabel={accessibilityLabel}
|
|
140
|
-
activeOpacity={activeOpacity}
|
|
141
|
-
onPress={onPressButton}
|
|
142
|
-
style={buttonStyle}>
|
|
143
|
-
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
144
|
-
</TouchableOpacity>
|
|
145
|
-
</ComponentContext.Provider>
|
|
124
|
+
<TouchableOpacity
|
|
125
|
+
{...rest}
|
|
126
|
+
activeOpacity={activeOpacity}
|
|
127
|
+
onPress={onPressButton}
|
|
128
|
+
style={buttonStyle}>
|
|
129
|
+
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
130
|
+
</TouchableOpacity>
|
|
146
131
|
);
|
|
147
132
|
};
|
|
148
133
|
|
|
134
|
+
IconButton.defaultProps = {
|
|
135
|
+
type: 'primary',
|
|
136
|
+
disabled: false,
|
|
137
|
+
};
|
|
138
|
+
|
|
149
139
|
export {IconButton};
|
package/Image/index.tsx
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import React, {useContext,
|
|
1
|
+
import React, {useContext, useRef, useState} from 'react';
|
|
2
2
|
import {StyleSheet, View} from 'react-native';
|
|
3
|
-
import FastImage
|
|
3
|
+
import FastImage from 'react-native-fast-image';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {
|
|
6
|
-
ApplicationContext,
|
|
7
|
-
ComponentContext,
|
|
8
|
-
MiniAppContext,
|
|
9
|
-
} from '../Application';
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
10
6
|
import {Skeleton} from '../Skeleton';
|
|
11
7
|
import {Icon} from '../Icon';
|
|
12
8
|
import {Styles} from '../Consts';
|
|
@@ -17,28 +13,14 @@ type Status = 'success' | 'loading' | 'error';
|
|
|
17
13
|
const Image: React.FC<ImageProps> = ({
|
|
18
14
|
style,
|
|
19
15
|
source,
|
|
20
|
-
loading
|
|
16
|
+
loading,
|
|
21
17
|
children,
|
|
22
|
-
accessibilityLabel,
|
|
23
18
|
...rest
|
|
24
19
|
}) => {
|
|
25
20
|
const {theme} = useContext(ApplicationContext);
|
|
26
|
-
const app = useContext<any>(MiniAppContext);
|
|
27
|
-
const component = useContext<any>(ComponentContext);
|
|
28
21
|
const error = useRef(false);
|
|
29
22
|
const [status, setStatus] = useState<Status>('success');
|
|
30
23
|
|
|
31
|
-
const test: any = {
|
|
32
|
-
accessibilityLabel: accessibilityLabel || `img|${(source as Source).uri}`,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (app.enableAutoId) {
|
|
37
|
-
component?.addChildren?.(test.accessibilityLabel, 'add');
|
|
38
|
-
return () => component?.addChildren?.(test.accessibilityLabel, 'remove');
|
|
39
|
-
}
|
|
40
|
-
}, []);
|
|
41
|
-
|
|
42
24
|
/**
|
|
43
25
|
* render content loading | fail | rendered
|
|
44
26
|
*/
|
|
@@ -62,7 +44,6 @@ const Image: React.FC<ImageProps> = ({
|
|
|
62
44
|
return (
|
|
63
45
|
<FastImage
|
|
64
46
|
{...rest}
|
|
65
|
-
{...test}
|
|
66
47
|
source={source}
|
|
67
48
|
style={[styles.container, style]}
|
|
68
49
|
onProgress={() => {
|
|
@@ -94,4 +75,8 @@ const Image: React.FC<ImageProps> = ({
|
|
|
94
75
|
);
|
|
95
76
|
};
|
|
96
77
|
|
|
78
|
+
Image.defaultProps = {
|
|
79
|
+
loading: true,
|
|
80
|
+
};
|
|
81
|
+
|
|
97
82
|
export {Image};
|
package/Image/types.ts
CHANGED
package/Input/Input.tsx
CHANGED
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
forwardRef,
|
|
3
|
-
ReactNode,
|
|
4
|
-
useContext,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
} from 'react';
|
|
1
|
+
import React, {forwardRef, useContext, useRef, useState} from 'react';
|
|
9
2
|
import {
|
|
10
3
|
NativeSyntheticEvent,
|
|
11
|
-
Platform,
|
|
12
4
|
TextInput,
|
|
13
5
|
TextInputFocusEventData,
|
|
14
6
|
TouchableOpacity,
|
|
15
7
|
View,
|
|
16
8
|
} from 'react-native';
|
|
17
|
-
import {ApplicationContext
|
|
18
|
-
import
|
|
19
|
-
import {Loader} from '../Loader';
|
|
20
|
-
import {Text} from '../Text';
|
|
9
|
+
import {ApplicationContext} from '../Application';
|
|
10
|
+
import styles from './styles';
|
|
21
11
|
import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
|
|
22
12
|
import {InputProps} from './index';
|
|
23
|
-
import
|
|
13
|
+
import {Icon} from '../Icon';
|
|
24
14
|
import {checkTyping} from './utils';
|
|
15
|
+
import {Loader} from '../Loader';
|
|
25
16
|
|
|
26
|
-
/**
|
|
27
|
-
* Input default component
|
|
28
|
-
*/
|
|
29
17
|
const Input = forwardRef(
|
|
30
18
|
(
|
|
31
19
|
{
|
|
@@ -39,36 +27,27 @@ const Input = forwardRef(
|
|
|
39
27
|
onFocus,
|
|
40
28
|
errorMessage,
|
|
41
29
|
icon,
|
|
42
|
-
iconColor,
|
|
43
|
-
onPressIcon,
|
|
44
|
-
trailing,
|
|
45
|
-
trailingColor,
|
|
46
|
-
onPressTrailing,
|
|
47
30
|
disabled = false,
|
|
48
31
|
floatingIconColor,
|
|
32
|
+
iconColor,
|
|
49
33
|
required = false,
|
|
50
34
|
errorSpacing,
|
|
51
35
|
loading = false,
|
|
52
36
|
leadingIcon,
|
|
53
37
|
leadingIconColor,
|
|
54
38
|
fontWeight = 'Regular',
|
|
39
|
+
onPressIcon,
|
|
55
40
|
secureTextEntry,
|
|
56
|
-
keyboardType,
|
|
57
41
|
style,
|
|
58
|
-
params,
|
|
59
|
-
hintText,
|
|
60
|
-
accessibilityLabel,
|
|
61
|
-
editable = true,
|
|
62
|
-
onPressFloatingIcon,
|
|
63
42
|
...props
|
|
64
43
|
}: InputProps,
|
|
65
|
-
ref
|
|
44
|
+
ref,
|
|
66
45
|
) => {
|
|
67
46
|
const {theme} = useContext(ApplicationContext);
|
|
68
47
|
const [focused, setFocused] = useState(false);
|
|
69
48
|
const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
|
|
70
49
|
const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
|
|
71
|
-
const inputRef =
|
|
50
|
+
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
72
51
|
|
|
73
52
|
const onClearText = () => {
|
|
74
53
|
inputRef?.current?.clear();
|
|
@@ -90,20 +69,7 @@ const Input = forwardRef(
|
|
|
90
69
|
onBlur?.(e);
|
|
91
70
|
};
|
|
92
71
|
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
clear: onClearText,
|
|
96
|
-
focus: () => inputRef.current?.focus(),
|
|
97
|
-
blur: () => inputRef.current?.blur(),
|
|
98
|
-
setText: (text: string) => _onChangeText(text),
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Render trailing icon or text
|
|
104
|
-
* @param color
|
|
105
|
-
*/
|
|
106
|
-
const renderTrailing = (color?: string) => {
|
|
72
|
+
const renderIcon = (color: string | undefined) => {
|
|
107
73
|
if (loading) {
|
|
108
74
|
return <Loader type={'spinner'} color={color} style={styles.icon} />;
|
|
109
75
|
}
|
|
@@ -122,46 +88,24 @@ const Input = forwardRef(
|
|
|
122
88
|
</TouchableOpacity>
|
|
123
89
|
);
|
|
124
90
|
}
|
|
125
|
-
if (icon
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
const trailingValue = icon || trailing;
|
|
136
|
-
if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
|
|
137
|
-
return renderIconTouchable(
|
|
138
|
-
<Icon
|
|
139
|
-
color={color}
|
|
140
|
-
source={(icon || trailing) as string}
|
|
141
|
-
size={24}
|
|
142
|
-
/>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
return renderIconTouchable(
|
|
146
|
-
<Text
|
|
147
|
-
typography="action_xs_bold"
|
|
148
|
-
color={color ?? theme.colors.primary}
|
|
149
|
-
numberOfLines={1}>
|
|
150
|
-
{trailingValue!.substring(0, 15)}
|
|
151
|
-
</Text>
|
|
91
|
+
if (icon) {
|
|
92
|
+
return (
|
|
93
|
+
<TouchableOpacity
|
|
94
|
+
onPress={onPressIcon}
|
|
95
|
+
disabled={!onPressIcon}
|
|
96
|
+
style={styles.icon}>
|
|
97
|
+
<Icon color={color} source={icon} size={24} />
|
|
98
|
+
</TouchableOpacity>
|
|
152
99
|
);
|
|
153
100
|
}
|
|
154
101
|
};
|
|
155
102
|
|
|
156
|
-
/**
|
|
157
|
-
* Render input view
|
|
158
|
-
*/
|
|
159
103
|
const renderInputView = () => {
|
|
160
104
|
const disabledColor = theme.colors.text.disable;
|
|
161
105
|
const secure = secureTextInput && secureTextEntry;
|
|
162
106
|
let textColor = theme.colors.text.default;
|
|
163
107
|
let placeholderColor = theme.colors.text.hint;
|
|
164
|
-
let iconTintColor =
|
|
108
|
+
let iconTintColor = iconColor;
|
|
165
109
|
|
|
166
110
|
if (disabled) {
|
|
167
111
|
textColor = disabledColor;
|
|
@@ -169,13 +113,6 @@ const Input = forwardRef(
|
|
|
169
113
|
iconTintColor = disabledColor;
|
|
170
114
|
}
|
|
171
115
|
|
|
172
|
-
if (secureTextEntry) {
|
|
173
|
-
keyboardType = Platform.select({
|
|
174
|
-
ios: 'ascii-capable',
|
|
175
|
-
android: 'visible-password',
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
|
|
179
116
|
return (
|
|
180
117
|
<View
|
|
181
118
|
style={[
|
|
@@ -190,7 +127,6 @@ const Input = forwardRef(
|
|
|
190
127
|
disabled={disabled}
|
|
191
128
|
required={required}
|
|
192
129
|
floatingIcon={floatingIcon}
|
|
193
|
-
onPress={onPressFloatingIcon}
|
|
194
130
|
/>
|
|
195
131
|
<View style={styles.inputView}>
|
|
196
132
|
{!!leadingIcon && (
|
|
@@ -204,8 +140,7 @@ const Input = forwardRef(
|
|
|
204
140
|
)}
|
|
205
141
|
<TextInput
|
|
206
142
|
{...props}
|
|
207
|
-
|
|
208
|
-
editable={editable && !disabled}
|
|
143
|
+
editable={!disabled}
|
|
209
144
|
secureTextEntry={secure}
|
|
210
145
|
textAlignVertical="center"
|
|
211
146
|
ref={inputRef}
|
|
@@ -225,7 +160,6 @@ const Input = forwardRef(
|
|
|
225
160
|
placeholder={placeholder}
|
|
226
161
|
selectionColor={theme.colors.primary}
|
|
227
162
|
placeholderTextColor={placeholderColor}
|
|
228
|
-
keyboardType={keyboardType}
|
|
229
163
|
/>
|
|
230
164
|
</View>
|
|
231
165
|
<View style={styles.iconView}>
|
|
@@ -240,43 +174,19 @@ const Input = forwardRef(
|
|
|
240
174
|
/>
|
|
241
175
|
</TouchableOpacity>
|
|
242
176
|
)}
|
|
243
|
-
{
|
|
177
|
+
{renderIcon(iconTintColor)}
|
|
244
178
|
</View>
|
|
245
179
|
</View>
|
|
246
180
|
);
|
|
247
181
|
};
|
|
248
182
|
|
|
249
|
-
let inputState = 'active';
|
|
250
|
-
if (value && value?.length > 0) {
|
|
251
|
-
inputState = 'filled';
|
|
252
|
-
}
|
|
253
|
-
if (errorMessage && errorMessage?.length > 0) {
|
|
254
|
-
inputState = 'error';
|
|
255
|
-
}
|
|
256
|
-
if (disabled) {
|
|
257
|
-
inputState = 'disabled';
|
|
258
|
-
}
|
|
259
|
-
|
|
260
183
|
return (
|
|
261
|
-
<
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
componentLabel: floatingValue,
|
|
266
|
-
state: inputState,
|
|
267
|
-
componentId: accessibilityLabel,
|
|
268
|
-
}}>
|
|
269
|
-
<View style={[style, styles.wrapper]}>
|
|
270
|
-
{renderInputView()}
|
|
271
|
-
<ErrorView
|
|
272
|
-
errorMessage={errorMessage}
|
|
273
|
-
errorSpacing={errorSpacing}
|
|
274
|
-
hintText={hintText}
|
|
275
|
-
/>
|
|
276
|
-
</View>
|
|
277
|
-
</ComponentContext.Provider>
|
|
184
|
+
<View style={[style, styles.wrapper]}>
|
|
185
|
+
{renderInputView()}
|
|
186
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
187
|
+
</View>
|
|
278
188
|
);
|
|
279
|
-
}
|
|
189
|
+
},
|
|
280
190
|
);
|
|
281
191
|
|
|
282
192
|
export default Input;
|