@momo-kits/foundation 0.89.3 → 0.89.4-rc.2
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/Components.tsx +3 -13
- package/Application/ModalScreen.tsx +4 -16
- package/Application/Navigator.ts +12 -0
- package/Application/StackScreen.tsx +13 -2
- package/Application/types.ts +0 -2
- package/Application/utils.tsx +36 -1
- package/Button/index.tsx +40 -15
- package/CheckBox/index.tsx +44 -21
- package/CheckBox/types.ts +4 -0
- package/IconButton/index.tsx +33 -8
- package/Input/Input.tsx +64 -10
- package/Input/InputDropDown.tsx +28 -9
- package/Input/InputMoney.tsx +38 -8
- package/Input/InputOTP.tsx +28 -10
- package/Input/InputSearch.tsx +55 -30
- package/Input/InputTextArea.tsx +1 -5
- package/Input/index.tsx +11 -0
- package/Input/styles.ts +1 -2
- package/Layout/Card.tsx +0 -1
- package/Layout/Item.tsx +0 -1
- package/Layout/Screen.tsx +1 -3
- package/Layout/Section.tsx +0 -1
- package/Pagination/PaginationScroll.tsx +0 -1
- package/Popup/PopupNotify.tsx +0 -1
- package/Popup/PopupPromotion.tsx +1 -1
- package/Radio/index.tsx +41 -19
- package/Radio/types.ts +5 -0
- package/Skeleton/index.tsx +1 -1
- package/Switch/index.tsx +31 -15
- package/Switch/types.ts +4 -0
- package/Tag/index.tsx +1 -3
- package/Text/index.tsx +0 -1
- package/package.json +1 -1
package/Input/InputDropDown.tsx
CHANGED
|
@@ -7,6 +7,11 @@ 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');
|
|
10
15
|
|
|
11
16
|
const InputDropDown = ({
|
|
12
17
|
value,
|
|
@@ -26,11 +31,13 @@ const InputDropDown = ({
|
|
|
26
31
|
leadingIcon,
|
|
27
32
|
leadingIconColor,
|
|
28
33
|
style,
|
|
34
|
+
params,
|
|
35
|
+
componentId,
|
|
29
36
|
...props
|
|
30
37
|
}: InputDropDownProps) => {
|
|
31
38
|
const {theme} = useContext(ApplicationContext);
|
|
32
39
|
const full = !!value || !!placeholder;
|
|
33
|
-
const
|
|
40
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
34
41
|
|
|
35
42
|
const renderIcon = (color: string | undefined) => {
|
|
36
43
|
if (loading) {
|
|
@@ -82,7 +89,6 @@ const InputDropDown = ({
|
|
|
82
89
|
<TextInput
|
|
83
90
|
{...props}
|
|
84
91
|
onPressIn={onPress}
|
|
85
|
-
accessibilityLabel={accessibilityLabel}
|
|
86
92
|
editable={false}
|
|
87
93
|
textAlignVertical="top"
|
|
88
94
|
style={[
|
|
@@ -105,14 +111,27 @@ const InputDropDown = ({
|
|
|
105
111
|
);
|
|
106
112
|
};
|
|
107
113
|
|
|
114
|
+
const button_name = formatComponentName(floatingValue || '');
|
|
115
|
+
|
|
108
116
|
return (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
<ScreenContext.Provider
|
|
118
|
+
value={{
|
|
119
|
+
...screenInfo,
|
|
120
|
+
componentName: 'InputOTP',
|
|
121
|
+
params: {
|
|
122
|
+
...params,
|
|
123
|
+
button_name,
|
|
124
|
+
},
|
|
125
|
+
state: 'enabled',
|
|
126
|
+
componentId,
|
|
127
|
+
}}>
|
|
128
|
+
<TouchableOpacity
|
|
129
|
+
onPress={onPress}
|
|
130
|
+
style={[style, full && styles.wrapper]}>
|
|
131
|
+
{renderInputView()}
|
|
132
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
133
|
+
</TouchableOpacity>
|
|
134
|
+
</ScreenContext.Provider>
|
|
116
135
|
);
|
|
117
136
|
};
|
|
118
137
|
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -18,6 +18,11 @@ 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');
|
|
21
26
|
|
|
22
27
|
const InputMoney = forwardRef(
|
|
23
28
|
(
|
|
@@ -36,7 +41,9 @@ const InputMoney = forwardRef(
|
|
|
36
41
|
required = false,
|
|
37
42
|
errorSpacing,
|
|
38
43
|
style,
|
|
44
|
+
params,
|
|
39
45
|
defaultValue = '',
|
|
46
|
+
componentId,
|
|
40
47
|
...props
|
|
41
48
|
}: InputMoneyProps,
|
|
42
49
|
ref,
|
|
@@ -44,7 +51,7 @@ const InputMoney = forwardRef(
|
|
|
44
51
|
const {theme} = useContext(ApplicationContext);
|
|
45
52
|
const [focused, setFocused] = useState(false);
|
|
46
53
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
47
|
-
const
|
|
54
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
48
55
|
|
|
49
56
|
const validateText = (text: string) => {
|
|
50
57
|
const valueFormat = formatMoneyToNumber(text, 'đ');
|
|
@@ -115,7 +122,6 @@ const InputMoney = forwardRef(
|
|
|
115
122
|
<View style={styles.inputView}>
|
|
116
123
|
<TextInput
|
|
117
124
|
{...props}
|
|
118
|
-
accessibilityLabel={accessibilityLabel}
|
|
119
125
|
editable={!disabled}
|
|
120
126
|
textAlignVertical="top"
|
|
121
127
|
ref={inputRef}
|
|
@@ -153,13 +159,37 @@ const InputMoney = forwardRef(
|
|
|
153
159
|
);
|
|
154
160
|
};
|
|
155
161
|
|
|
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
|
+
const component_name = formatComponentName(floatingValue || '');
|
|
175
|
+
|
|
156
176
|
return (
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
177
|
+
<ScreenContext.Provider
|
|
178
|
+
value={{
|
|
179
|
+
...screenInfo,
|
|
180
|
+
componentName: 'InputMoney',
|
|
181
|
+
params: {
|
|
182
|
+
...params,
|
|
183
|
+
component_name,
|
|
184
|
+
},
|
|
185
|
+
state: inputState,
|
|
186
|
+
componentId,
|
|
187
|
+
}}>
|
|
188
|
+
<View style={[style, styles.wrapper]}>
|
|
189
|
+
{renderInputView()}
|
|
190
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
191
|
+
</View>
|
|
192
|
+
</ScreenContext.Provider>
|
|
163
193
|
);
|
|
164
194
|
},
|
|
165
195
|
);
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -21,6 +21,11 @@ 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');
|
|
24
29
|
|
|
25
30
|
const OTPCaret: FC<CaretProps> = ({index, length}) => {
|
|
26
31
|
const DURATION = 300;
|
|
@@ -78,7 +83,9 @@ const InputOTP = forwardRef(
|
|
|
78
83
|
onFocus,
|
|
79
84
|
onBlur,
|
|
80
85
|
dataType = 'number',
|
|
86
|
+
params,
|
|
81
87
|
style,
|
|
88
|
+
componentId,
|
|
82
89
|
...props
|
|
83
90
|
}: InputOTPProps,
|
|
84
91
|
ref,
|
|
@@ -88,7 +95,7 @@ const InputOTP = forwardRef(
|
|
|
88
95
|
const [focused, setFocused] = useState(false);
|
|
89
96
|
const inputRef = useRef<TextInput>(null);
|
|
90
97
|
const {theme} = useContext(ApplicationContext);
|
|
91
|
-
const
|
|
98
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
92
99
|
|
|
93
100
|
useImperativeHandle(ref, () => ({
|
|
94
101
|
onChangeText: (text: string) => {
|
|
@@ -206,7 +213,6 @@ const InputOTP = forwardRef(
|
|
|
206
213
|
<View style={styles.inputView}>
|
|
207
214
|
<TextInput
|
|
208
215
|
{...props}
|
|
209
|
-
accessibilityLabel={accessibilityLabel}
|
|
210
216
|
ref={inputRef}
|
|
211
217
|
value={value}
|
|
212
218
|
onChangeText={_onChangeText}
|
|
@@ -221,16 +227,28 @@ const InputOTP = forwardRef(
|
|
|
221
227
|
</View>
|
|
222
228
|
);
|
|
223
229
|
};
|
|
230
|
+
const component_name = formatComponentName(floatingValue || '');
|
|
224
231
|
|
|
225
232
|
return (
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
233
|
+
<ScreenContext.Provider
|
|
234
|
+
value={{
|
|
235
|
+
...screenInfo,
|
|
236
|
+
componentName: 'InputOTP',
|
|
237
|
+
params: {
|
|
238
|
+
...params,
|
|
239
|
+
component_name,
|
|
240
|
+
},
|
|
241
|
+
state: 'enabled',
|
|
242
|
+
componentId,
|
|
243
|
+
}}>
|
|
244
|
+
<TouchableOpacity
|
|
245
|
+
activeOpacity={1}
|
|
246
|
+
onPress={onFocusInput}
|
|
247
|
+
style={[style, styles.otpWrapper]}>
|
|
248
|
+
{renderInputView()}
|
|
249
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
250
|
+
</TouchableOpacity>
|
|
251
|
+
</ScreenContext.Provider>
|
|
234
252
|
);
|
|
235
253
|
},
|
|
236
254
|
);
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -13,6 +13,10 @@ 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
|
+
|
|
16
20
|
const InputSearch = forwardRef(
|
|
17
21
|
(
|
|
18
22
|
{
|
|
@@ -29,6 +33,8 @@ const InputSearch = forwardRef(
|
|
|
29
33
|
style,
|
|
30
34
|
defaultValue,
|
|
31
35
|
onPressButtonText,
|
|
36
|
+
params,
|
|
37
|
+
componentId,
|
|
32
38
|
...props
|
|
33
39
|
}: InputSearchProps,
|
|
34
40
|
ref,
|
|
@@ -37,7 +43,7 @@ const InputSearch = forwardRef(
|
|
|
37
43
|
const [focused, setFocused] = useState(false);
|
|
38
44
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
39
45
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
40
|
-
const
|
|
46
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
41
47
|
|
|
42
48
|
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
43
49
|
setFocused(true);
|
|
@@ -63,7 +69,6 @@ const InputSearch = forwardRef(
|
|
|
63
69
|
return (
|
|
64
70
|
<TextInput
|
|
65
71
|
{...props}
|
|
66
|
-
accessibilityLabel={accessibilityLabel}
|
|
67
72
|
textAlignVertical="center"
|
|
68
73
|
ref={inputRef}
|
|
69
74
|
style={[
|
|
@@ -118,36 +123,56 @@ const InputSearch = forwardRef(
|
|
|
118
123
|
</View>
|
|
119
124
|
);
|
|
120
125
|
};
|
|
126
|
+
|
|
127
|
+
let inputState = 'empty';
|
|
128
|
+
|
|
129
|
+
if (focused) {
|
|
130
|
+
inputState = 'focus';
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (value && value?.length > 0) {
|
|
134
|
+
inputState = 'filled';
|
|
135
|
+
}
|
|
136
|
+
|
|
121
137
|
return (
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
<ScreenContext.Provider
|
|
139
|
+
value={{
|
|
140
|
+
...screenInfo,
|
|
141
|
+
componentName: 'InputSearch',
|
|
142
|
+
params,
|
|
143
|
+
state: inputState,
|
|
144
|
+
componentId,
|
|
145
|
+
}}>
|
|
146
|
+
<View style={[style, styles.searchInputContainer]}>
|
|
147
|
+
<View
|
|
148
|
+
style={[
|
|
149
|
+
styles.searchInputWrapper,
|
|
150
|
+
{
|
|
151
|
+
backgroundColor: theme.colors.background.surface,
|
|
152
|
+
borderColor: theme.colors.background.surface,
|
|
153
|
+
},
|
|
154
|
+
showBorder && {borderColor: theme.colors.border.default},
|
|
155
|
+
focused && {borderColor: theme.colors.primary},
|
|
156
|
+
]}>
|
|
157
|
+
<Icon
|
|
158
|
+
source={'navigation_search'}
|
|
159
|
+
size={24}
|
|
160
|
+
color={theme.colors.text.hint}
|
|
161
|
+
/>
|
|
162
|
+
{renderInputView()}
|
|
163
|
+
{renderIconView()}
|
|
164
|
+
</View>
|
|
165
|
+
{showButtonText && (
|
|
166
|
+
<TouchableOpacity onPress={onPressButtonText}>
|
|
167
|
+
<Text
|
|
168
|
+
typography={'action_default_bold'}
|
|
169
|
+
style={styles.textButton}>
|
|
170
|
+
{buttonText}
|
|
171
|
+
</Text>
|
|
172
|
+
</TouchableOpacity>
|
|
173
|
+
)}
|
|
142
174
|
</View>
|
|
143
|
-
|
|
144
|
-
<TouchableOpacity onPress={onPressButtonText}>
|
|
145
|
-
<Text typography={'action_default_bold'} style={styles.textButton}>
|
|
146
|
-
{buttonText}
|
|
147
|
-
</Text>
|
|
148
|
-
</TouchableOpacity>
|
|
149
|
-
)}
|
|
150
|
-
</View>
|
|
175
|
+
</ScreenContext.Provider>
|
|
151
176
|
);
|
|
152
177
|
},
|
|
153
178
|
);
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -46,7 +46,6 @@ const InputTextArea = forwardRef(
|
|
|
46
46
|
const [focused, setFocused] = useState(false);
|
|
47
47
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
48
48
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
49
|
-
const accessibilityLabel = `InputTextArea/${floatingValue ?? placeholder}`;
|
|
50
49
|
|
|
51
50
|
const onClearText = () => {
|
|
52
51
|
inputRef?.current?.clear();
|
|
@@ -110,7 +109,6 @@ const InputTextArea = forwardRef(
|
|
|
110
109
|
<View style={styles.textAreaView}>
|
|
111
110
|
<TextInput
|
|
112
111
|
{...props}
|
|
113
|
-
accessibilityLabel={accessibilityLabel}
|
|
114
112
|
ref={inputRef}
|
|
115
113
|
editable={!disabled}
|
|
116
114
|
textAlignVertical="top"
|
|
@@ -150,9 +148,7 @@ const InputTextArea = forwardRef(
|
|
|
150
148
|
};
|
|
151
149
|
|
|
152
150
|
return (
|
|
153
|
-
<View
|
|
154
|
-
style={[style, styles.wrapper]}
|
|
155
|
-
accessibilityLabel={accessibilityLabel}>
|
|
151
|
+
<View style={[style, styles.wrapper]}>
|
|
156
152
|
{renderInputView()}
|
|
157
153
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
158
154
|
</View>
|
package/Input/index.tsx
CHANGED
|
@@ -80,6 +80,9 @@ export interface InputProps extends TextInputProps {
|
|
|
80
80
|
fontWeight?: 'Regular' | 'Bold';
|
|
81
81
|
|
|
82
82
|
onPressIcon?: () => void;
|
|
83
|
+
|
|
84
|
+
params?: any;
|
|
85
|
+
componentId?: string;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
type InputPropsWithoutSizeAndIcon = Omit<
|
|
@@ -126,6 +129,10 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
126
129
|
* Optional. Represents the name or key of the icon to be displayed in the Input component.
|
|
127
130
|
*/
|
|
128
131
|
icon?: string;
|
|
132
|
+
|
|
133
|
+
params?: any;
|
|
134
|
+
|
|
135
|
+
componentId?: string;
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
|
@@ -250,6 +257,10 @@ export interface InputDropDownProps {
|
|
|
250
257
|
leadingIconColor?: string;
|
|
251
258
|
|
|
252
259
|
style: ViewStyle | ViewStyle[];
|
|
260
|
+
|
|
261
|
+
params?: any
|
|
262
|
+
componentId?: string;
|
|
263
|
+
|
|
253
264
|
}
|
|
254
265
|
|
|
255
266
|
export {Input, InputTextArea, InputSearch, InputMoney, InputOTP, InputDropDown};
|
package/Input/styles.ts
CHANGED
package/Layout/Card.tsx
CHANGED
package/Layout/Item.tsx
CHANGED
package/Layout/Screen.tsx
CHANGED
|
@@ -301,9 +301,7 @@ const Screen = forwardRef(
|
|
|
301
301
|
};
|
|
302
302
|
|
|
303
303
|
return (
|
|
304
|
-
<View
|
|
305
|
-
style={[Styles.flex, {backgroundColor}]}
|
|
306
|
-
accessibilityLabel={`ScreenContainer`}>
|
|
304
|
+
<View style={[Styles.flex, {backgroundColor}]}>
|
|
307
305
|
{!!headerBackground && (
|
|
308
306
|
<>
|
|
309
307
|
<Image
|
package/Layout/Section.tsx
CHANGED
package/Popup/PopupNotify.tsx
CHANGED
package/Popup/PopupPromotion.tsx
CHANGED
package/Radio/index.tsx
CHANGED
|
@@ -6,6 +6,10 @@ 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
|
+
const {
|
|
11
|
+
ScreenContext,
|
|
12
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
9
13
|
|
|
10
14
|
const Radio: FC<RadioProps> = ({
|
|
11
15
|
value,
|
|
@@ -14,8 +18,11 @@ const Radio: FC<RadioProps> = ({
|
|
|
14
18
|
onChange,
|
|
15
19
|
label,
|
|
16
20
|
style,
|
|
21
|
+
params,
|
|
22
|
+
componentId,
|
|
17
23
|
}) => {
|
|
18
24
|
const {theme} = useContext(ApplicationContext);
|
|
25
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
19
26
|
const selected = value === groupValue;
|
|
20
27
|
let disabledStyle = {};
|
|
21
28
|
let checkBoxStyle = {
|
|
@@ -37,28 +44,43 @@ const Radio: FC<RadioProps> = ({
|
|
|
37
44
|
};
|
|
38
45
|
}
|
|
39
46
|
|
|
47
|
+
const component_name = formatNameLength(label || '');
|
|
48
|
+
|
|
40
49
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
flexDirection: 'row',
|
|
49
|
-
alignItems: 'center',
|
|
50
|
+
<ScreenContext.Provider
|
|
51
|
+
value={{
|
|
52
|
+
...screenInfo,
|
|
53
|
+
componentName: 'Button',
|
|
54
|
+
params: {
|
|
55
|
+
...params,
|
|
56
|
+
component_name,
|
|
50
57
|
},
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
59
|
+
componentId,
|
|
60
|
+
componentValue: value,
|
|
61
|
+
action: 'click',
|
|
62
|
+
}}>
|
|
63
|
+
<TouchableOpacity
|
|
64
|
+
onPress={onChange}
|
|
65
|
+
disabled={disabled}
|
|
53
66
|
style={[
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
style,
|
|
68
|
+
{
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
},
|
|
72
|
+
]}>
|
|
73
|
+
<View
|
|
74
|
+
style={[
|
|
75
|
+
styles.radio,
|
|
76
|
+
checkBoxStyle,
|
|
77
|
+
disabledStyle,
|
|
78
|
+
{marginRight: label ? Spacing.XS : 0},
|
|
79
|
+
]}
|
|
80
|
+
/>
|
|
81
|
+
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
82
|
+
</TouchableOpacity>
|
|
83
|
+
</ScreenContext.Provider>
|
|
62
84
|
);
|
|
63
85
|
};
|
|
64
86
|
|
package/Radio/types.ts
CHANGED
package/Skeleton/index.tsx
CHANGED
|
@@ -41,7 +41,7 @@ const Skeleton: React.FC<SkeletonTypes> = ({style}) => {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
return (
|
|
44
|
-
<View style={[styles.container, style]}
|
|
44
|
+
<View style={[styles.container, style]}>
|
|
45
45
|
<View
|
|
46
46
|
onLayout={e => onLayout(e.nativeEvent.layout.width)}
|
|
47
47
|
style={[Styles.flex, {backgroundColor: PRIMARY_COLOR}]}>
|
package/Switch/index.tsx
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import React, {FC} from 'react';
|
|
1
|
+
import React, {FC, useContext} 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
|
+
|
|
7
11
|
const Switch: FC<SwitchProps> = props => {
|
|
8
|
-
const {value, onChange, disabled, style} = props;
|
|
12
|
+
const {value, onChange, disabled, style, params, componentId} = props;
|
|
13
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
14
|
+
|
|
9
15
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
10
16
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
11
17
|
|
|
@@ -15,19 +21,29 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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>
|
|
31
47
|
);
|
|
32
48
|
};
|
|
33
49
|
|
package/Switch/types.ts
CHANGED
package/Tag/index.tsx
CHANGED
|
@@ -60,9 +60,7 @@ const Tag: FC<TagProps> = ({
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
|
-
<View
|
|
64
|
-
style={[style, sizeStyle, {backgroundColor: tagColor}]}
|
|
65
|
-
accessibilityLabel={`Tag/${label}`}>
|
|
63
|
+
<View style={[style, sizeStyle, {backgroundColor: tagColor}]}>
|
|
66
64
|
{!!icon && (
|
|
67
65
|
<Icon
|
|
68
66
|
style={styles.icon}
|