@momo-kits/foundation 0.89.3-beta.1 → 0.89.3-beta.4
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/StackScreen.tsx +2 -13
- package/Assets/icon.json +78 -0
- package/Assets/icon_bank.json +506 -0
- package/Button/index.tsx +15 -35
- package/CheckBox/index.tsx +0 -18
- package/CheckBox/types.ts +0 -4
- package/Icon/index.tsx +2 -1
- package/IconButton/index.tsx +8 -28
- package/Input/Input.tsx +6 -35
- package/Input/InputMoney.tsx +6 -35
- package/Input/InputOTP.tsx +8 -24
- package/Input/InputSearch.tsx +27 -56
- package/Input/index.tsx +0 -7
- package/Radio/index.tsx +1 -16
- package/Radio/types.ts +0 -5
- package/Switch/index.tsx +2 -21
- package/Switch/types.ts +0 -4
- package/code-scanner.js +30 -2
- package/package.json +1 -1
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';
|
|
@@ -15,10 +16,6 @@ import styles from './styles';
|
|
|
15
16
|
import {Icon} from '../Icon';
|
|
16
17
|
import {Loader} from '../Loader';
|
|
17
18
|
|
|
18
|
-
const {
|
|
19
|
-
ScreenContext,
|
|
20
|
-
} = require('react-native/Libraries/Components/ScreenContext');
|
|
21
|
-
|
|
22
19
|
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
23
20
|
|
|
24
21
|
export interface ButtonProps extends TouchableOpacityProps {
|
|
@@ -73,10 +70,6 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
73
70
|
* A callback function that is called when the button is pressed.
|
|
74
71
|
*/
|
|
75
72
|
onPress: () => void;
|
|
76
|
-
|
|
77
|
-
params?: any;
|
|
78
|
-
|
|
79
|
-
componentId?: string;
|
|
80
73
|
}
|
|
81
74
|
|
|
82
75
|
const Button: FC<ButtonProps> = ({
|
|
@@ -89,8 +82,6 @@ const Button: FC<ButtonProps> = ({
|
|
|
89
82
|
loading = false,
|
|
90
83
|
title = 'Button',
|
|
91
84
|
onPress,
|
|
92
|
-
params,
|
|
93
|
-
componentId,
|
|
94
85
|
...rest
|
|
95
86
|
}) => {
|
|
96
87
|
const {theme, config} = useContext(ApplicationContext);
|
|
@@ -103,8 +94,6 @@ const Button: FC<ButtonProps> = ({
|
|
|
103
94
|
end: {x: 0, y: 0.5},
|
|
104
95
|
};
|
|
105
96
|
}
|
|
106
|
-
|
|
107
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
108
97
|
const getSizeStyle = () => {
|
|
109
98
|
const styleSheet: {[key: string]: any} = styles;
|
|
110
99
|
return styleSheet[size ?? 'small'];
|
|
@@ -302,29 +291,20 @@ const Button: FC<ButtonProps> = ({
|
|
|
302
291
|
const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
|
|
303
292
|
|
|
304
293
|
return (
|
|
305
|
-
<
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
{...
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
{renderLeading()}
|
|
320
|
-
{renderTitle()}
|
|
321
|
-
{renderTrailing()}
|
|
322
|
-
{gradientPros && (
|
|
323
|
-
<AnimationLinear {...gradientPros} style={styles.gradientView} />
|
|
324
|
-
)}
|
|
325
|
-
{gradientPros && <View style={styles.strokeView} />}
|
|
326
|
-
</TouchableOpacity>
|
|
327
|
-
</ScreenContext.Provider>
|
|
294
|
+
<TouchableOpacity
|
|
295
|
+
{...rest}
|
|
296
|
+
accessibilityLabel={`Button/${title}`}
|
|
297
|
+
activeOpacity={activeOpacity}
|
|
298
|
+
onPress={onPressButton}
|
|
299
|
+
style={buttonStyle}>
|
|
300
|
+
{renderLeading()}
|
|
301
|
+
{renderTitle()}
|
|
302
|
+
{renderTrailing()}
|
|
303
|
+
{gradientPros && (
|
|
304
|
+
<AnimationLinear {...gradientPros} style={styles.gradientView} />
|
|
305
|
+
)}
|
|
306
|
+
{gradientPros && <View style={styles.strokeView} />}
|
|
307
|
+
</TouchableOpacity>
|
|
328
308
|
);
|
|
329
309
|
};
|
|
330
310
|
|
package/CheckBox/index.tsx
CHANGED
|
@@ -6,10 +6,6 @@ import {ApplicationContext} from '../Application';
|
|
|
6
6
|
import {Text} from '../Text';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
8
|
|
|
9
|
-
const {
|
|
10
|
-
ScreenContext,
|
|
11
|
-
} = require('react-native/Libraries/Components/ScreenContext');
|
|
12
|
-
|
|
13
9
|
const CheckBox: FC<CheckBoxProps> = ({
|
|
14
10
|
value,
|
|
15
11
|
disabled,
|
|
@@ -17,11 +13,8 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
17
13
|
style,
|
|
18
14
|
label,
|
|
19
15
|
indeterminate,
|
|
20
|
-
params, componentId,
|
|
21
|
-
|
|
22
16
|
}) => {
|
|
23
17
|
const {theme} = useContext(ApplicationContext);
|
|
24
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
25
18
|
const haveValue = value || indeterminate;
|
|
26
19
|
const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
|
|
27
20
|
let borderColor = theme.colors.text.default;
|
|
@@ -42,16 +35,6 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
42
35
|
}
|
|
43
36
|
|
|
44
37
|
return (
|
|
45
|
-
<ScreenContext.Provider
|
|
46
|
-
value={{
|
|
47
|
-
...screenInfo,
|
|
48
|
-
componentName: 'Button',
|
|
49
|
-
params,
|
|
50
|
-
state: disabled ? 'disabled' : 'filled',
|
|
51
|
-
componentId,
|
|
52
|
-
componentValue: indeterminate ? "indetermine" : value,
|
|
53
|
-
action: 'click',
|
|
54
|
-
}}>
|
|
55
38
|
<TouchableOpacity
|
|
56
39
|
accessibilityLabel={`CheckBox/${label}/${value}`}
|
|
57
40
|
activeOpacity={0.8}
|
|
@@ -73,7 +56,6 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
73
56
|
</View>
|
|
74
57
|
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
75
58
|
</TouchableOpacity>
|
|
76
|
-
</ScreenContext.Provider>
|
|
77
59
|
);
|
|
78
60
|
};
|
|
79
61
|
|
package/CheckBox/types.ts
CHANGED
package/Icon/index.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import IconSources from '../Assets/icon.json';
|
|
3
|
+
import IconBankSources from '../Assets/icon_bank.json';
|
|
3
4
|
import {IconProps} from './types';
|
|
4
5
|
import {ApplicationContext} from '../Application';
|
|
5
6
|
import {Image} from '../Image';
|
|
@@ -37,4 +38,4 @@ Icon.defaultProps = {
|
|
|
37
38
|
size: 24,
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
export {Icon, IconSources};
|
|
41
|
+
export {Icon, IconSources, IconBankSources};
|
package/IconButton/index.tsx
CHANGED
|
@@ -10,10 +10,6 @@ import {Colors} from '../Consts';
|
|
|
10
10
|
import {Icon} from '../Icon';
|
|
11
11
|
import styles from './styles';
|
|
12
12
|
|
|
13
|
-
const {
|
|
14
|
-
ScreenContext,
|
|
15
|
-
} = require('react-native/Libraries/Components/ScreenContext');
|
|
16
|
-
|
|
17
13
|
export interface IconButtonProps extends TouchableOpacityProps {
|
|
18
14
|
/**
|
|
19
15
|
* Represents the name or key of the icon to be displayed on the IconButton.
|
|
@@ -30,10 +26,6 @@ export interface IconButtonProps extends TouchableOpacityProps {
|
|
|
30
26
|
* Optional. Defines the size of the IconButton.
|
|
31
27
|
*/
|
|
32
28
|
size?: 'large' | 'small';
|
|
33
|
-
|
|
34
|
-
params?: any;
|
|
35
|
-
|
|
36
|
-
componentId?: string;
|
|
37
29
|
}
|
|
38
30
|
|
|
39
31
|
const IconButton: React.FC<IconButtonProps> = ({
|
|
@@ -41,12 +33,9 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
41
33
|
icon,
|
|
42
34
|
size,
|
|
43
35
|
onPress,
|
|
44
|
-
params,
|
|
45
|
-
componentId,
|
|
46
36
|
...rest
|
|
47
37
|
}) => {
|
|
48
38
|
const {theme} = useContext(ApplicationContext);
|
|
49
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
50
39
|
|
|
51
40
|
/**
|
|
52
41
|
* get size icon button
|
|
@@ -132,23 +121,14 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
132
121
|
const iconSize = size === 'small' ? 16 : 24;
|
|
133
122
|
|
|
134
123
|
return (
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}}>
|
|
144
|
-
<TouchableOpacity
|
|
145
|
-
{...rest}
|
|
146
|
-
activeOpacity={activeOpacity}
|
|
147
|
-
onPress={onPressButton}
|
|
148
|
-
style={buttonStyle}>
|
|
149
|
-
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
150
|
-
</TouchableOpacity>
|
|
151
|
-
</ScreenContext.Provider>
|
|
124
|
+
<TouchableOpacity
|
|
125
|
+
{...rest}
|
|
126
|
+
accessibilityLabel={`IconButton/${icon}`}
|
|
127
|
+
activeOpacity={activeOpacity}
|
|
128
|
+
onPress={onPressButton}
|
|
129
|
+
style={buttonStyle}>
|
|
130
|
+
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
131
|
+
</TouchableOpacity>
|
|
152
132
|
);
|
|
153
133
|
};
|
|
154
134
|
|
package/Input/Input.tsx
CHANGED
|
@@ -14,10 +14,6 @@ import {Icon} from '../Icon';
|
|
|
14
14
|
import {checkTyping} from './utils';
|
|
15
15
|
import {Loader} from '../Loader';
|
|
16
16
|
|
|
17
|
-
const {
|
|
18
|
-
ScreenContext,
|
|
19
|
-
} = require('react-native/Libraries/Components/ScreenContext');
|
|
20
|
-
|
|
21
17
|
const Input = forwardRef(
|
|
22
18
|
(
|
|
23
19
|
{
|
|
@@ -42,8 +38,6 @@ const Input = forwardRef(
|
|
|
42
38
|
fontWeight = 'Regular',
|
|
43
39
|
onPressIcon,
|
|
44
40
|
style,
|
|
45
|
-
params,
|
|
46
|
-
componentId,
|
|
47
41
|
...props
|
|
48
42
|
}: InputProps,
|
|
49
43
|
ref,
|
|
@@ -53,7 +47,6 @@ const Input = forwardRef(
|
|
|
53
47
|
const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
|
|
54
48
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
55
49
|
const accessibilityLabel = `Input/${floatingValue ?? placeholder}`;
|
|
56
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
57
50
|
|
|
58
51
|
const onClearText = () => {
|
|
59
52
|
inputRef?.current?.clear();
|
|
@@ -166,35 +159,13 @@ const Input = forwardRef(
|
|
|
166
159
|
);
|
|
167
160
|
};
|
|
168
161
|
|
|
169
|
-
let inputState = "active"
|
|
170
|
-
|
|
171
|
-
if (value && value?.length > 0 ) {
|
|
172
|
-
inputState = 'filled'
|
|
173
|
-
}
|
|
174
|
-
if (errorMessage && errorMessage?.length > 0) {
|
|
175
|
-
inputState = 'error'
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (disabled) {
|
|
179
|
-
inputState = 'disabled'
|
|
180
|
-
}
|
|
181
|
-
|
|
182
162
|
return (
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
componentId,
|
|
190
|
-
}}>
|
|
191
|
-
<View
|
|
192
|
-
style={[style, styles.wrapper]}
|
|
193
|
-
accessibilityLabel={accessibilityLabel}>
|
|
194
|
-
{renderInputView()}
|
|
195
|
-
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
196
|
-
</View>
|
|
197
|
-
</ScreenContext.Provider>
|
|
163
|
+
<View
|
|
164
|
+
style={[style, styles.wrapper]}
|
|
165
|
+
accessibilityLabel={accessibilityLabel}>
|
|
166
|
+
{renderInputView()}
|
|
167
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
168
|
+
</View>
|
|
198
169
|
);
|
|
199
170
|
},
|
|
200
171
|
);
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -19,10 +19,6 @@ import {InputMoneyProps} from './index';
|
|
|
19
19
|
import {Icon} from '../Icon';
|
|
20
20
|
import {formatMoneyToNumber, formatNumberToMoney} from './utils';
|
|
21
21
|
|
|
22
|
-
const {
|
|
23
|
-
ScreenContext,
|
|
24
|
-
} = require('react-native/Libraries/Components/ScreenContext');
|
|
25
|
-
|
|
26
22
|
const InputMoney = forwardRef(
|
|
27
23
|
(
|
|
28
24
|
{
|
|
@@ -40,9 +36,7 @@ const InputMoney = forwardRef(
|
|
|
40
36
|
required = false,
|
|
41
37
|
errorSpacing,
|
|
42
38
|
style,
|
|
43
|
-
params,
|
|
44
39
|
defaultValue = '',
|
|
45
|
-
componentId,
|
|
46
40
|
...props
|
|
47
41
|
}: InputMoneyProps,
|
|
48
42
|
ref,
|
|
@@ -51,7 +45,6 @@ const InputMoney = forwardRef(
|
|
|
51
45
|
const [focused, setFocused] = useState(false);
|
|
52
46
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
53
47
|
const accessibilityLabel = `InputMoney/${floatingValue}`;
|
|
54
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
55
48
|
|
|
56
49
|
const validateText = (text: string) => {
|
|
57
50
|
const valueFormat = formatMoneyToNumber(text, 'đ');
|
|
@@ -104,7 +97,6 @@ const InputMoney = forwardRef(
|
|
|
104
97
|
iconTintColor = disabledColor;
|
|
105
98
|
}
|
|
106
99
|
|
|
107
|
-
|
|
108
100
|
return (
|
|
109
101
|
<View
|
|
110
102
|
style={[
|
|
@@ -161,34 +153,13 @@ const InputMoney = forwardRef(
|
|
|
161
153
|
);
|
|
162
154
|
};
|
|
163
155
|
|
|
164
|
-
let inputState = "active"
|
|
165
|
-
|
|
166
|
-
if (value && value?.length > 0 ) {
|
|
167
|
-
inputState = 'filled'
|
|
168
|
-
}
|
|
169
|
-
if (errorMessage && errorMessage?.length > 0) {
|
|
170
|
-
inputState = 'error'
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (disabled) {
|
|
174
|
-
inputState = 'disabled'
|
|
175
|
-
}
|
|
176
156
|
return (
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
componentId,
|
|
184
|
-
}}>
|
|
185
|
-
<View
|
|
186
|
-
style={[style, styles.wrapper]}
|
|
187
|
-
accessibilityLabel={accessibilityLabel}>
|
|
188
|
-
{renderInputView()}
|
|
189
|
-
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
190
|
-
</View>
|
|
191
|
-
</ScreenContext.Provider>
|
|
157
|
+
<View
|
|
158
|
+
style={[style, styles.wrapper]}
|
|
159
|
+
accessibilityLabel={accessibilityLabel}>
|
|
160
|
+
{renderInputView()}
|
|
161
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
162
|
+
</View>
|
|
192
163
|
);
|
|
193
164
|
},
|
|
194
165
|
);
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -22,10 +22,6 @@ import {ErrorView, getBorderColor} from './common';
|
|
|
22
22
|
import {ApplicationContext} from '../Application';
|
|
23
23
|
import {Spacing} from '../Consts';
|
|
24
24
|
|
|
25
|
-
const {
|
|
26
|
-
ScreenContext,
|
|
27
|
-
} = require('react-native/Libraries/Components/ScreenContext');
|
|
28
|
-
|
|
29
25
|
const OTPCaret: FC<CaretProps> = ({index, length}) => {
|
|
30
26
|
const DURATION = 300;
|
|
31
27
|
const {theme} = useContext(ApplicationContext);
|
|
@@ -82,9 +78,7 @@ const InputOTP = forwardRef(
|
|
|
82
78
|
onFocus,
|
|
83
79
|
onBlur,
|
|
84
80
|
dataType = 'number',
|
|
85
|
-
params,
|
|
86
81
|
style,
|
|
87
|
-
componentId,
|
|
88
82
|
...props
|
|
89
83
|
}: InputOTPProps,
|
|
90
84
|
ref,
|
|
@@ -95,7 +89,6 @@ const InputOTP = forwardRef(
|
|
|
95
89
|
const inputRef = useRef<TextInput>(null);
|
|
96
90
|
const {theme} = useContext(ApplicationContext);
|
|
97
91
|
const accessibilityLabel = `InputOTP/${floatingValue ?? placeholder}`;
|
|
98
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
99
92
|
|
|
100
93
|
useImperativeHandle(ref, () => ({
|
|
101
94
|
onChangeText: (text: string) => {
|
|
@@ -230,23 +223,14 @@ const InputOTP = forwardRef(
|
|
|
230
223
|
};
|
|
231
224
|
|
|
232
225
|
return (
|
|
233
|
-
<
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
<TouchableOpacity
|
|
242
|
-
activeOpacity={1}
|
|
243
|
-
onPress={onFocusInput}
|
|
244
|
-
style={[style, styles.otpWrapper]}
|
|
245
|
-
accessibilityLabel={accessibilityLabel}>
|
|
246
|
-
{renderInputView()}
|
|
247
|
-
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
248
|
-
</TouchableOpacity>
|
|
249
|
-
</ScreenContext.Provider>
|
|
226
|
+
<TouchableOpacity
|
|
227
|
+
activeOpacity={1}
|
|
228
|
+
onPress={onFocusInput}
|
|
229
|
+
style={[style, styles.otpWrapper]}
|
|
230
|
+
accessibilityLabel={accessibilityLabel}>
|
|
231
|
+
{renderInputView()}
|
|
232
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
233
|
+
</TouchableOpacity>
|
|
250
234
|
);
|
|
251
235
|
},
|
|
252
236
|
);
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -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
|
{
|
|
@@ -33,8 +29,6 @@ const InputSearch = forwardRef(
|
|
|
33
29
|
style,
|
|
34
30
|
defaultValue,
|
|
35
31
|
onPressButtonText,
|
|
36
|
-
params,
|
|
37
|
-
componentId,
|
|
38
32
|
...props
|
|
39
33
|
}: InputSearchProps,
|
|
40
34
|
ref,
|
|
@@ -44,7 +38,6 @@ const InputSearch = forwardRef(
|
|
|
44
38
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
45
39
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
46
40
|
const accessibilityLabel = `InputMoney/${placeholder}`;
|
|
47
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
48
41
|
|
|
49
42
|
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
50
43
|
setFocused(true);
|
|
@@ -125,58 +118,36 @@ const InputSearch = forwardRef(
|
|
|
125
118
|
</View>
|
|
126
119
|
);
|
|
127
120
|
};
|
|
128
|
-
|
|
129
|
-
let inputState = "empty"
|
|
130
|
-
|
|
131
|
-
if (focused) {
|
|
132
|
-
inputState = 'focus'
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (value && value?.length > 0 ) {
|
|
136
|
-
inputState = 'filled'
|
|
137
|
-
}
|
|
138
|
-
|
|
139
121
|
return (
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
componentName: 'InputSearch',
|
|
144
|
-
params,
|
|
145
|
-
state: inputState,
|
|
146
|
-
componentId,
|
|
147
|
-
}}>
|
|
122
|
+
<View
|
|
123
|
+
style={[style, styles.searchInputContainer]}
|
|
124
|
+
accessibilityLabel={accessibilityLabel}>
|
|
148
125
|
<View
|
|
149
|
-
style={[
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
/>
|
|
166
|
-
{renderInputView()}
|
|
167
|
-
{renderIconView()}
|
|
168
|
-
</View>
|
|
169
|
-
{showButtonText && (
|
|
170
|
-
<TouchableOpacity onPress={onPressButtonText}>
|
|
171
|
-
<Text
|
|
172
|
-
typography={'action_default_bold'}
|
|
173
|
-
style={styles.textButton}>
|
|
174
|
-
{buttonText}
|
|
175
|
-
</Text>
|
|
176
|
-
</TouchableOpacity>
|
|
177
|
-
)}
|
|
126
|
+
style={[
|
|
127
|
+
styles.searchInputWrapper,
|
|
128
|
+
{
|
|
129
|
+
backgroundColor: theme.colors.background.surface,
|
|
130
|
+
borderColor: theme.colors.background.surface,
|
|
131
|
+
},
|
|
132
|
+
showBorder && {borderColor: theme.colors.border.default},
|
|
133
|
+
focused && {borderColor: theme.colors.primary},
|
|
134
|
+
]}>
|
|
135
|
+
<Icon
|
|
136
|
+
source={'navigation_search'}
|
|
137
|
+
size={24}
|
|
138
|
+
color={theme.colors.text.hint}
|
|
139
|
+
/>
|
|
140
|
+
{renderInputView()}
|
|
141
|
+
{renderIconView()}
|
|
178
142
|
</View>
|
|
179
|
-
|
|
143
|
+
{showButtonText && (
|
|
144
|
+
<TouchableOpacity onPress={onPressButtonText}>
|
|
145
|
+
<Text typography={'action_default_bold'} style={styles.textButton}>
|
|
146
|
+
{buttonText}
|
|
147
|
+
</Text>
|
|
148
|
+
</TouchableOpacity>
|
|
149
|
+
)}
|
|
150
|
+
</View>
|
|
180
151
|
);
|
|
181
152
|
},
|
|
182
153
|
);
|
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<
|
|
@@ -129,10 +126,6 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
129
126
|
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
130
127
|
*/
|
|
131
128
|
icon?: string;
|
|
132
|
-
|
|
133
|
-
params?: any;
|
|
134
|
-
|
|
135
|
-
componentId?: string;
|
|
136
129
|
}
|
|
137
130
|
|
|
138
131
|
export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
package/Radio/index.tsx
CHANGED
|
@@ -6,9 +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
|
-
const {
|
|
10
|
-
ScreenContext,
|
|
11
|
-
} = require('react-native/Libraries/Components/ScreenContext');
|
|
12
9
|
|
|
13
10
|
const Radio: FC<RadioProps> = ({
|
|
14
11
|
value,
|
|
@@ -16,10 +13,9 @@ const Radio: FC<RadioProps> = ({
|
|
|
16
13
|
disabled,
|
|
17
14
|
onChange,
|
|
18
15
|
label,
|
|
19
|
-
style,
|
|
16
|
+
style,
|
|
20
17
|
}) => {
|
|
21
18
|
const {theme} = useContext(ApplicationContext);
|
|
22
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
23
19
|
const selected = value === groupValue;
|
|
24
20
|
let disabledStyle = {};
|
|
25
21
|
let checkBoxStyle = {
|
|
@@ -42,16 +38,6 @@ const Radio: FC<RadioProps> = ({
|
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
return (
|
|
45
|
-
<ScreenContext.Provider
|
|
46
|
-
value={{
|
|
47
|
-
...screenInfo,
|
|
48
|
-
componentName: 'Button',
|
|
49
|
-
params,
|
|
50
|
-
state: disabled ? 'disabled' : 'enabled',
|
|
51
|
-
componentId,
|
|
52
|
-
componentValue: value,
|
|
53
|
-
action: 'click',
|
|
54
|
-
}}>
|
|
55
41
|
<TouchableOpacity
|
|
56
42
|
accessibilityLabel={`Radio/${label}/${value}`}
|
|
57
43
|
onPress={onChange}
|
|
@@ -73,7 +59,6 @@ const Radio: FC<RadioProps> = ({
|
|
|
73
59
|
/>
|
|
74
60
|
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
75
61
|
</TouchableOpacity>
|
|
76
|
-
</ScreenContext.Provider>
|
|
77
62
|
);
|
|
78
63
|
};
|
|
79
64
|
|
package/Radio/types.ts
CHANGED
package/Switch/index.tsx
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import React, {FC
|
|
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
|
|
13
|
-
params, componentId,
|
|
14
|
-
} = props;
|
|
15
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
16
|
-
|
|
8
|
+
const {value, onChange, disabled, style} = props;
|
|
17
9
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
18
10
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
19
11
|
|
|
@@ -23,16 +15,6 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
23
15
|
}
|
|
24
16
|
|
|
25
17
|
return (
|
|
26
|
-
<ScreenContext.Provider
|
|
27
|
-
value={{
|
|
28
|
-
...screenInfo,
|
|
29
|
-
componentName: 'Button',
|
|
30
|
-
params,
|
|
31
|
-
state: disabled ? 'disabled' : 'enabled',
|
|
32
|
-
componentId,
|
|
33
|
-
componentValue: value,
|
|
34
|
-
action: 'click',
|
|
35
|
-
}}>
|
|
36
18
|
<TouchableOpacity
|
|
37
19
|
accessibilityLabel={'Switch'}
|
|
38
20
|
disabled={disabled}
|
|
@@ -46,7 +28,6 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
46
28
|
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
47
29
|
</View>
|
|
48
30
|
</TouchableOpacity>
|
|
49
|
-
</ScreenContext.Provider>
|
|
50
31
|
);
|
|
51
32
|
};
|
|
52
33
|
|