@momo-kits/foundation 0.89.6 → 0.92.1-tracking.12
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.tsx +6 -1
- package/Application/Components.tsx +17 -6
- package/Application/ModalScreen.tsx +131 -107
- package/Application/NavigationContainer.tsx +51 -47
- package/Application/StackScreen.tsx +65 -7
- package/Application/types.ts +5 -3
- package/Application/utils.tsx +59 -2
- package/Button/index.tsx +49 -16
- package/CheckBox/index.tsx +44 -21
- package/CheckBox/types.ts +4 -0
- package/IconButton/index.tsx +30 -7
- package/Image/index.tsx +3 -0
- package/Input/Input.tsx +40 -5
- package/Input/InputDropDown.tsx +30 -5
- package/Input/InputMoney.tsx +41 -5
- package/Input/InputOTP.tsx +31 -8
- package/Input/InputSearch.tsx +60 -26
- package/Input/InputTextArea.tsx +12 -2
- package/Input/index.tsx +27 -2
- package/Popup/PopupNotify.tsx +12 -0
- package/Popup/PopupPromotion.tsx +8 -2
- package/Radio/index.tsx +43 -20
- package/Radio/types.ts +5 -0
- package/Switch/index.tsx +36 -14
- package/Switch/types.ts +4 -0
- package/Text/index.tsx +1 -0
- package/Text/styles.ts +2 -2
- package/index.ts +2 -1
- package/package.json +2 -2
package/Input/InputOTP.tsx
CHANGED
|
@@ -19,11 +19,17 @@ import {CaretProps, InputOTPProps} from './index';
|
|
|
19
19
|
import {scaleSize, Text} from '../Text';
|
|
20
20
|
import styles from './styles';
|
|
21
21
|
import {ErrorView, getBorderColor} from './common';
|
|
22
|
-
import {ApplicationContext} from '../Application';
|
|
22
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
23
23
|
import {Spacing} from '../Consts';
|
|
24
|
+
import {formatComponentName, getAccessibilityID} 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;
|
|
32
|
+
const {appId} = useContext(MiniAppContext)
|
|
27
33
|
const {theme} = useContext(ApplicationContext);
|
|
28
34
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
29
35
|
|
|
@@ -78,16 +84,21 @@ const InputOTP = forwardRef(
|
|
|
78
84
|
onFocus,
|
|
79
85
|
onBlur,
|
|
80
86
|
dataType = 'number',
|
|
87
|
+
params,
|
|
81
88
|
style,
|
|
89
|
+
componentId,
|
|
82
90
|
...props
|
|
83
91
|
}: InputOTPProps,
|
|
84
92
|
ref,
|
|
85
93
|
) => {
|
|
86
94
|
const MAX_LENGTH = 10;
|
|
95
|
+
const {appId} = useContext(MiniAppContext)
|
|
96
|
+
|
|
87
97
|
const [value, setValue] = useState('');
|
|
88
98
|
const [focused, setFocused] = useState(false);
|
|
89
99
|
const inputRef = useRef<TextInput>(null);
|
|
90
100
|
const {theme} = useContext(ApplicationContext);
|
|
101
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
91
102
|
|
|
92
103
|
useImperativeHandle(ref, () => ({
|
|
93
104
|
onChangeText: (text: string) => {
|
|
@@ -180,6 +191,7 @@ const InputOTP = forwardRef(
|
|
|
180
191
|
);
|
|
181
192
|
};
|
|
182
193
|
|
|
194
|
+
const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}`)
|
|
183
195
|
const renderInputView = () => {
|
|
184
196
|
return (
|
|
185
197
|
<View
|
|
@@ -205,6 +217,7 @@ const InputOTP = forwardRef(
|
|
|
205
217
|
<View style={styles.inputView}>
|
|
206
218
|
<TextInput
|
|
207
219
|
{...props}
|
|
220
|
+
{...accessibilityID}
|
|
208
221
|
ref={inputRef}
|
|
209
222
|
value={value}
|
|
210
223
|
onChangeText={_onChangeText}
|
|
@@ -221,13 +234,23 @@ const InputOTP = forwardRef(
|
|
|
221
234
|
};
|
|
222
235
|
|
|
223
236
|
return (
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
237
|
+
<ScreenContext.Provider
|
|
238
|
+
value={{
|
|
239
|
+
...screenInfo,
|
|
240
|
+
componentName: 'InputOTP',
|
|
241
|
+
params,
|
|
242
|
+
componentLabel: formatComponentName(floatingValue || ''),
|
|
243
|
+
state: 'enabled',
|
|
244
|
+
componentId,
|
|
245
|
+
}}>
|
|
246
|
+
<TouchableOpacity
|
|
247
|
+
activeOpacity={1}
|
|
248
|
+
onPress={onFocusInput}
|
|
249
|
+
style={[style, styles.otpWrapper]}>
|
|
250
|
+
{renderInputView()}
|
|
251
|
+
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
252
|
+
</TouchableOpacity>
|
|
253
|
+
</ScreenContext.Provider>
|
|
231
254
|
);
|
|
232
255
|
},
|
|
233
256
|
);
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -7,11 +7,16 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import {InputSearchProps} from './index';
|
|
10
|
-
import {ApplicationContext} from '../Application';
|
|
10
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
11
11
|
import styles from './styles';
|
|
12
12
|
import {Icon} from '../Icon';
|
|
13
13
|
import {Text} from '../Text';
|
|
14
14
|
import {checkTyping} from './utils';
|
|
15
|
+
import {getAccessibilityID} from "../Application/utils";
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
ScreenContext,
|
|
19
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
15
20
|
|
|
16
21
|
const InputSearch = forwardRef(
|
|
17
22
|
(
|
|
@@ -28,15 +33,19 @@ const InputSearch = forwardRef(
|
|
|
28
33
|
style,
|
|
29
34
|
defaultValue,
|
|
30
35
|
onPressButtonText,
|
|
31
|
-
|
|
36
|
+
hasColorBG = true,
|
|
37
|
+
params,
|
|
38
|
+
componentId,
|
|
32
39
|
...props
|
|
33
40
|
}: InputSearchProps,
|
|
34
41
|
ref,
|
|
35
42
|
) => {
|
|
36
43
|
const {theme} = useContext(ApplicationContext);
|
|
44
|
+
const {appId} = useContext(MiniAppContext)
|
|
37
45
|
const [focused, setFocused] = useState(false);
|
|
38
46
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
39
47
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
48
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
40
49
|
|
|
41
50
|
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
42
51
|
setFocused(true);
|
|
@@ -57,11 +66,13 @@ const InputSearch = forwardRef(
|
|
|
57
66
|
checkTyping(text, haveValue, setHaveValue);
|
|
58
67
|
onChangeText?.(text);
|
|
59
68
|
};
|
|
69
|
+
const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_search`)
|
|
60
70
|
|
|
61
71
|
const renderInputView = () => {
|
|
62
72
|
return (
|
|
63
73
|
<TextInput
|
|
64
74
|
{...props}
|
|
75
|
+
{...accessibilityID}
|
|
65
76
|
textAlignVertical="center"
|
|
66
77
|
ref={inputRef}
|
|
67
78
|
style={[
|
|
@@ -117,33 +128,56 @@ const InputSearch = forwardRef(
|
|
|
117
128
|
);
|
|
118
129
|
};
|
|
119
130
|
|
|
120
|
-
|
|
131
|
+
let inputState = 'empty';
|
|
132
|
+
|
|
133
|
+
if (focused) {
|
|
134
|
+
inputState = 'focus';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (value && value?.length > 0) {
|
|
138
|
+
inputState = 'filled';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const backgroundColor = hasColorBG
|
|
142
|
+
? theme.colors.background.default
|
|
143
|
+
: theme.colors.background.surface;
|
|
121
144
|
|
|
122
145
|
return (
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
146
|
+
<ScreenContext.Provider
|
|
147
|
+
value={{
|
|
148
|
+
...screenInfo,
|
|
149
|
+
componentName: 'InputSearch',
|
|
150
|
+
params,
|
|
151
|
+
state: inputState,
|
|
152
|
+
componentId,
|
|
153
|
+
}}>
|
|
154
|
+
<View style={[style, styles.searchInputContainer]}>
|
|
155
|
+
<View
|
|
156
|
+
style={[
|
|
157
|
+
styles.searchInputWrapper,
|
|
158
|
+
{
|
|
159
|
+
backgroundColor,
|
|
160
|
+
},
|
|
161
|
+
]}>
|
|
162
|
+
<Icon
|
|
163
|
+
source={'navigation_search'}
|
|
164
|
+
size={24}
|
|
165
|
+
color={theme.colors.text.hint}
|
|
166
|
+
/>
|
|
167
|
+
{renderInputView()}
|
|
168
|
+
{renderIconView()}
|
|
169
|
+
</View>
|
|
170
|
+
{showButtonText && (
|
|
171
|
+
<TouchableOpacity onPress={onPressButtonText}>
|
|
172
|
+
<Text
|
|
173
|
+
typography={'action_default_bold'}
|
|
174
|
+
style={styles.textButton}>
|
|
175
|
+
{buttonText}
|
|
176
|
+
</Text>
|
|
177
|
+
</TouchableOpacity>
|
|
178
|
+
)}
|
|
138
179
|
</View>
|
|
139
|
-
|
|
140
|
-
<TouchableOpacity onPress={onPressButtonText}>
|
|
141
|
-
<Text typography={'action_default_bold'} style={styles.textButton}>
|
|
142
|
-
{buttonText}
|
|
143
|
-
</Text>
|
|
144
|
-
</TouchableOpacity>
|
|
145
|
-
)}
|
|
146
|
-
</View>
|
|
180
|
+
</ScreenContext.Provider>
|
|
147
181
|
);
|
|
148
182
|
},
|
|
149
183
|
);
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -17,7 +17,12 @@ import {
|
|
|
17
17
|
} from './common';
|
|
18
18
|
import {InputTextAreaProps} from './index';
|
|
19
19
|
import {Icon} from '../Icon';
|
|
20
|
-
import {ApplicationContext} from '../Application';
|
|
20
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
21
|
+
import {getAccessibilityID} from "../Application/utils";
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
ScreenContext,
|
|
25
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
21
26
|
|
|
22
27
|
const InputTextArea = forwardRef(
|
|
23
28
|
(
|
|
@@ -43,6 +48,8 @@ const InputTextArea = forwardRef(
|
|
|
43
48
|
ref,
|
|
44
49
|
) => {
|
|
45
50
|
const {theme} = useContext(ApplicationContext);
|
|
51
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
52
|
+
const {appId} = useContext(MiniAppContext)
|
|
46
53
|
const [focused, setFocused] = useState(false);
|
|
47
54
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
48
55
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
@@ -87,6 +94,7 @@ const InputTextArea = forwardRef(
|
|
|
87
94
|
textColor = disabledColor;
|
|
88
95
|
placeholderColor = disabledColor;
|
|
89
96
|
}
|
|
97
|
+
const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}${disabled && "_disabled" }`)
|
|
90
98
|
|
|
91
99
|
return (
|
|
92
100
|
<View
|
|
@@ -109,6 +117,7 @@ const InputTextArea = forwardRef(
|
|
|
109
117
|
<View style={styles.textAreaView}>
|
|
110
118
|
<TextInput
|
|
111
119
|
{...props}
|
|
120
|
+
{...accessibilityID}
|
|
112
121
|
ref={inputRef}
|
|
113
122
|
editable={!disabled}
|
|
114
123
|
textAlignVertical="top"
|
|
@@ -148,7 +157,8 @@ const InputTextArea = forwardRef(
|
|
|
148
157
|
};
|
|
149
158
|
|
|
150
159
|
return (
|
|
151
|
-
<View
|
|
160
|
+
<View
|
|
161
|
+
style={[style, styles.wrapper]}>
|
|
152
162
|
{renderInputView()}
|
|
153
163
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
154
164
|
</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<
|
|
@@ -121,7 +124,14 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
121
124
|
*/
|
|
122
125
|
icon?: string;
|
|
123
126
|
|
|
124
|
-
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
*/
|
|
130
|
+
hasColorBG?: boolean;
|
|
131
|
+
|
|
132
|
+
params?: any;
|
|
133
|
+
|
|
134
|
+
componentId?: string;
|
|
125
135
|
}
|
|
126
136
|
|
|
127
137
|
export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
|
@@ -245,7 +255,22 @@ export interface InputDropDownProps {
|
|
|
245
255
|
*/
|
|
246
256
|
leadingIconColor?: string;
|
|
247
257
|
|
|
248
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Optional. params for element tracking.
|
|
260
|
+
*/
|
|
261
|
+
params?: {
|
|
262
|
+
[key: string]: any;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* component id for element tracking.
|
|
267
|
+
*/
|
|
268
|
+
componentId?: string;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Optional. Represents the style of the InputDropDown component.
|
|
272
|
+
*/
|
|
273
|
+
style?: ViewStyle | ViewStyle[];
|
|
249
274
|
}
|
|
250
275
|
|
|
251
276
|
export {Input, InputTextArea, InputSearch, InputMoney, InputOTP, InputDropDown};
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import {Text} from '../Text';
|
|
|
7
7
|
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
8
8
|
import {Button} from '../Button';
|
|
9
9
|
import {Icon} from '../Icon';
|
|
10
|
+
import {getAccessibilityID} from "../Application/utils";
|
|
10
11
|
|
|
11
12
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
12
13
|
id,
|
|
@@ -108,9 +109,13 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
108
109
|
);
|
|
109
110
|
};
|
|
110
111
|
const renderColumn = () => {
|
|
112
|
+
const accessibilityPrimaryID = getAccessibilityID?.('btn_popup_allow')
|
|
113
|
+
const accessibilitySecondID = getAccessibilityID?.('btn_popup_cancel')
|
|
114
|
+
|
|
111
115
|
return (
|
|
112
116
|
<View style={Styles.columnCenter}>
|
|
113
117
|
<Button
|
|
118
|
+
accessibilityID={accessibilityPrimaryID}
|
|
114
119
|
title={primary.title}
|
|
115
120
|
size="medium"
|
|
116
121
|
onPress={() => {
|
|
@@ -122,6 +127,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
122
127
|
<>
|
|
123
128
|
<View style={styles.buttonSpace} />
|
|
124
129
|
<Button
|
|
130
|
+
accessibilityID={accessibilitySecondID}
|
|
125
131
|
title={secondary?.title}
|
|
126
132
|
type="text"
|
|
127
133
|
size="medium"
|
|
@@ -155,8 +161,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
155
161
|
* build close action
|
|
156
162
|
*/
|
|
157
163
|
const buildCloseIcon = () => {
|
|
164
|
+
const accessibilityCloseID = getAccessibilityID?.('ic_popup_close')
|
|
165
|
+
|
|
158
166
|
return (
|
|
159
167
|
<TouchableOpacity
|
|
168
|
+
{...accessibilityCloseID}
|
|
160
169
|
style={styles.iconCloseContainer}
|
|
161
170
|
onPress={() => {
|
|
162
171
|
closeAction.current = 'icon_close';
|
|
@@ -180,8 +189,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
180
189
|
);
|
|
181
190
|
};
|
|
182
191
|
|
|
192
|
+
const accessibilityID = getAccessibilityID?.(`pu_${context.code}_notify`)
|
|
193
|
+
|
|
183
194
|
return (
|
|
184
195
|
<View
|
|
196
|
+
{...accessibilityID}
|
|
185
197
|
style={[
|
|
186
198
|
styles.container,
|
|
187
199
|
{backgroundColor: theme.colors.background.surface},
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import {ApplicationContext, MiniAppContext} from '../Application';
|
|
|
5
5
|
import {Image} from '../Image';
|
|
6
6
|
import {Radius, Spacing} from '../Consts';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
|
+
import {getAccessibilityID} from "../Application/utils";
|
|
8
9
|
|
|
9
10
|
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
10
11
|
id,
|
|
@@ -48,8 +49,10 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
48
49
|
* build close action
|
|
49
50
|
*/
|
|
50
51
|
const buildCloseIcon = () => {
|
|
52
|
+
const accessibilityCloseID = getAccessibilityID?.('ic_popup_close')
|
|
53
|
+
|
|
51
54
|
return (
|
|
52
|
-
<View style={styles.iconCloseContainer}>
|
|
55
|
+
<View {...accessibilityCloseID} style={styles.iconCloseContainer}>
|
|
53
56
|
<TouchableOpacity
|
|
54
57
|
onPress={() => {
|
|
55
58
|
closeAction.current = 'icon_close';
|
|
@@ -75,9 +78,12 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
75
78
|
</View>
|
|
76
79
|
);
|
|
77
80
|
};
|
|
81
|
+
const accessibilityID = getAccessibilityID?.(`pu_${context.code}_promotion`)
|
|
78
82
|
|
|
79
83
|
return (
|
|
80
|
-
<View
|
|
84
|
+
<View
|
|
85
|
+
{...accessibilityID}
|
|
86
|
+
>
|
|
81
87
|
<Image
|
|
82
88
|
source={{
|
|
83
89
|
uri: image,
|
package/Radio/index.tsx
CHANGED
|
@@ -4,8 +4,13 @@ import {TouchableOpacity, View} from 'react-native';
|
|
|
4
4
|
import {RadioProps} from './types';
|
|
5
5
|
import {Text} from '../Text';
|
|
6
6
|
import styles from './styles';
|
|
7
|
-
import {ApplicationContext} from '../Application';
|
|
7
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
|
+
import {formatNameLength, getAccessibilityID} from '../Application/utils';
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
ScreenContext,
|
|
13
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
9
14
|
|
|
10
15
|
const Radio: FC<RadioProps> = ({
|
|
11
16
|
value,
|
|
@@ -14,8 +19,12 @@ const Radio: FC<RadioProps> = ({
|
|
|
14
19
|
onChange,
|
|
15
20
|
label,
|
|
16
21
|
style,
|
|
22
|
+
params,
|
|
23
|
+
componentId,
|
|
17
24
|
}) => {
|
|
25
|
+
const {appId} = useContext(MiniAppContext)
|
|
18
26
|
const {theme} = useContext(ApplicationContext);
|
|
27
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
19
28
|
const selected = value === groupValue;
|
|
20
29
|
let disabledStyle = {};
|
|
21
30
|
let checkBoxStyle = {
|
|
@@ -36,28 +45,42 @@ const Radio: FC<RadioProps> = ({
|
|
|
36
45
|
: theme.colors.text.disable,
|
|
37
46
|
};
|
|
38
47
|
}
|
|
48
|
+
const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/rdo_${label}_${value}`)
|
|
39
49
|
|
|
40
50
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
<ScreenContext.Provider
|
|
52
|
+
value={{
|
|
53
|
+
...screenInfo,
|
|
54
|
+
componentName: 'Button',
|
|
55
|
+
params,
|
|
56
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
57
|
+
componentId,
|
|
58
|
+
componentLabel: formatNameLength(label || ''),
|
|
59
|
+
componentValue: value,
|
|
60
|
+
action: 'click',
|
|
61
|
+
}}>
|
|
62
|
+
<TouchableOpacity
|
|
63
|
+
{...accessibilityID}
|
|
64
|
+
onPress={onChange}
|
|
65
|
+
disabled={disabled}
|
|
52
66
|
style={[
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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>
|
|
61
84
|
);
|
|
62
85
|
};
|
|
63
86
|
|
package/Radio/types.ts
CHANGED
package/Switch/index.tsx
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
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
|
+
import {getAccessibilityID} from "../Application/utils";
|
|
7
|
+
import {MiniAppContext} from "../Application";
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ScreenContext,
|
|
11
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
6
12
|
|
|
7
13
|
const Switch: FC<SwitchProps> = props => {
|
|
8
|
-
|
|
14
|
+
const {appId} = useContext(MiniAppContext)
|
|
15
|
+
const {value, onChange, disabled, style, params, componentId} = props;
|
|
16
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
17
|
+
|
|
9
18
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
10
19
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
11
20
|
|
|
@@ -13,20 +22,33 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
13
22
|
if (disabled) {
|
|
14
23
|
backgroundColor = value ? Colors.green_09 : Colors.black_05;
|
|
15
24
|
}
|
|
25
|
+
const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/swt_${value}`)
|
|
16
26
|
|
|
17
27
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
<ScreenContext.Provider
|
|
29
|
+
value={{
|
|
30
|
+
...screenInfo,
|
|
31
|
+
componentName: 'Button',
|
|
32
|
+
params,
|
|
33
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
34
|
+
componentId,
|
|
35
|
+
componentValue: value,
|
|
36
|
+
action: 'click',
|
|
37
|
+
}}>
|
|
38
|
+
<TouchableOpacity
|
|
39
|
+
{...accessibilityID}
|
|
40
|
+
disabled={disabled}
|
|
41
|
+
onPress={() => onChange?.(!value)}
|
|
42
|
+
style={[
|
|
43
|
+
style,
|
|
44
|
+
styles.container,
|
|
45
|
+
{backgroundColor, alignItems: circleAlign},
|
|
46
|
+
]}>
|
|
47
|
+
<View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
|
|
48
|
+
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
49
|
+
</View>
|
|
50
|
+
</TouchableOpacity>
|
|
51
|
+
</ScreenContext.Provider>
|
|
30
52
|
);
|
|
31
53
|
};
|
|
32
54
|
|
package/Switch/types.ts
CHANGED
package/Text/index.tsx
CHANGED
package/Text/styles.ts
CHANGED
|
@@ -22,8 +22,8 @@ export default {
|
|
|
22
22
|
fontWeight: '400',
|
|
23
23
|
textDecorationLine: 'line-through',
|
|
24
24
|
},
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
description_s_regular: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
|
|
26
|
+
description_s_regularstrikethrought: {
|
|
27
27
|
fontSize: 10,
|
|
28
28
|
lineHeight: 14,
|
|
29
29
|
fontWeight: '400',
|
package/index.ts
CHANGED
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
useSafeAreaInsets,
|
|
5
5
|
} from 'react-native-safe-area-context';
|
|
6
6
|
import LinearGradient from 'react-native-linear-gradient';
|
|
7
|
+
import {getAccessibilityID} from "./Application/utils";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* native export
|
|
10
11
|
*/
|
|
11
|
-
export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient};
|
|
12
|
+
export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient, getAccessibilityID};
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* foundation component
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.92.1-tracking.12",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"@momo-kits/foundation"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@gorhom/bottom-sheet": "git+https://gitlab.com/momo-platform/bottom-sheet.git#main",
|
|
13
14
|
"react-native-safe-area-context": "3.1.4",
|
|
14
15
|
"react-native-linear-gradient": "2.8.3",
|
|
15
16
|
"react-native-gesture-handler": "1.10.3",
|
|
16
|
-
"react-native-modalize": "2.1.1",
|
|
17
17
|
"react-native-fast-image": "8.1.5",
|
|
18
18
|
"@react-navigation/bottom-tabs": "git+https://gitlab.com/momo-platform/react-navigation-bottom-tabs.git#main",
|
|
19
19
|
"@react-navigation/core": "5.16.1",
|