@momo-kits/foundation 0.92.2-tracking.1 → 0.92.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 +18 -17
- package/Application/NavigationContainer.tsx +7 -2
- package/Application/StackScreen.tsx +56 -65
- package/Button/index.tsx +28 -12
- package/CheckBox/index.tsx +27 -9
- package/CheckBox/types.ts +6 -4
- package/Icon/index.tsx +8 -8
- package/IconButton/index.tsx +15 -7
- package/Image/index.tsx +7 -18
- package/Image/types.ts +0 -1
- package/Input/Input.tsx +30 -7
- package/Input/InputDropDown.tsx +28 -7
- package/Input/InputMoney.tsx +26 -7
- package/Input/InputOTP.tsx +22 -7
- package/Input/InputSearch.tsx +13 -6
- package/Input/InputTextArea.tsx +20 -3
- package/Input/index.tsx +9 -1
- package/Popup/PopupNotify.tsx +1 -2
- package/Popup/PopupPromotion.tsx +5 -2
- package/Radio/index.tsx +21 -7
- package/Radio/types.ts +7 -4
- package/Switch/index.tsx +22 -14
- package/Switch/types.ts +6 -4
- package/package.json +1 -1
package/Input/Input.tsx
CHANGED
|
@@ -14,10 +14,15 @@ import {InputProps} from './index';
|
|
|
14
14
|
import {Icon} from '../Icon';
|
|
15
15
|
import {checkTyping} from './utils';
|
|
16
16
|
import {Loader} from '../Loader';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
formatComponentName,
|
|
19
|
+
getAccessibilityID,
|
|
20
|
+
cleanNameForTracking,
|
|
21
|
+
} from '../Application/utils';
|
|
18
22
|
|
|
19
23
|
const {
|
|
20
|
-
|
|
24
|
+
ScreenContext,
|
|
25
|
+
MiniAppContext,
|
|
21
26
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
22
27
|
|
|
23
28
|
const Input = forwardRef(
|
|
@@ -47,16 +52,18 @@ const Input = forwardRef(
|
|
|
47
52
|
keyboardType,
|
|
48
53
|
style,
|
|
49
54
|
params,
|
|
50
|
-
|
|
55
|
+
componentId,
|
|
51
56
|
...props
|
|
52
57
|
}: InputProps,
|
|
53
58
|
ref,
|
|
54
59
|
) => {
|
|
55
60
|
const {theme} = useContext(ApplicationContext);
|
|
61
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
56
62
|
const [focused, setFocused] = useState(false);
|
|
57
63
|
const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
|
|
58
64
|
const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
|
|
59
65
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
66
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
60
67
|
|
|
61
68
|
const onClearText = () => {
|
|
62
69
|
inputRef?.current?.clear();
|
|
@@ -115,6 +122,21 @@ const Input = forwardRef(
|
|
|
115
122
|
let textColor = theme.colors.text.default;
|
|
116
123
|
let placeholderColor = theme.colors.text.hint;
|
|
117
124
|
let iconTintColor = iconColor;
|
|
125
|
+
const accessibilityID = disabled
|
|
126
|
+
? getAccessibilityID(
|
|
127
|
+
`${appId}/${code}/${
|
|
128
|
+
screenInfo.screenName
|
|
129
|
+
}/input_${cleanNameForTracking(
|
|
130
|
+
floatingValue ?? placeholder,
|
|
131
|
+
)}_disabled`,
|
|
132
|
+
)
|
|
133
|
+
: getAccessibilityID(
|
|
134
|
+
`${appId}/${code}/${
|
|
135
|
+
screenInfo.screenName
|
|
136
|
+
}/input_${cleanNameForTracking(
|
|
137
|
+
floatingValue ?? placeholder ?? value,
|
|
138
|
+
)}`,
|
|
139
|
+
);
|
|
118
140
|
|
|
119
141
|
if (disabled) {
|
|
120
142
|
textColor = disabledColor;
|
|
@@ -156,7 +178,7 @@ const Input = forwardRef(
|
|
|
156
178
|
)}
|
|
157
179
|
<TextInput
|
|
158
180
|
{...props}
|
|
159
|
-
|
|
181
|
+
{...accessibilityID}
|
|
160
182
|
editable={props.editable && !disabled}
|
|
161
183
|
secureTextEntry={secure}
|
|
162
184
|
textAlignVertical="center"
|
|
@@ -212,19 +234,20 @@ const Input = forwardRef(
|
|
|
212
234
|
}
|
|
213
235
|
|
|
214
236
|
return (
|
|
215
|
-
<
|
|
237
|
+
<ScreenContext.Provider
|
|
216
238
|
value={{
|
|
239
|
+
...screenInfo,
|
|
217
240
|
componentName: 'Input',
|
|
218
241
|
params,
|
|
219
242
|
componentLabel: formatComponentName(floatingValue || ''),
|
|
220
243
|
state: inputState,
|
|
221
|
-
componentId
|
|
244
|
+
componentId,
|
|
222
245
|
}}>
|
|
223
246
|
<View style={[style, styles.wrapper]}>
|
|
224
247
|
{renderInputView()}
|
|
225
248
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
226
249
|
</View>
|
|
227
|
-
</
|
|
250
|
+
</ScreenContext.Provider>
|
|
228
251
|
);
|
|
229
252
|
},
|
|
230
253
|
);
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -7,10 +7,15 @@ import {InputDropDownProps} from './index';
|
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
8
|
import {Loader} from '../Loader';
|
|
9
9
|
import {Styles} from '../Consts';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
cleanNameForTracking,
|
|
12
|
+
formatComponentName,
|
|
13
|
+
getAccessibilityID,
|
|
14
|
+
} from '../Application/utils';
|
|
11
15
|
|
|
12
16
|
const {
|
|
13
|
-
|
|
17
|
+
ScreenContext,
|
|
18
|
+
MiniAppContext,
|
|
14
19
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
15
20
|
|
|
16
21
|
const InputDropDown = ({
|
|
@@ -32,11 +37,13 @@ const InputDropDown = ({
|
|
|
32
37
|
leadingIconColor,
|
|
33
38
|
style,
|
|
34
39
|
params,
|
|
35
|
-
|
|
40
|
+
componentId,
|
|
36
41
|
...props
|
|
37
42
|
}: InputDropDownProps) => {
|
|
43
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
38
44
|
const {theme} = useContext(ApplicationContext);
|
|
39
45
|
const full = !!value || !!placeholder;
|
|
46
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
40
47
|
|
|
41
48
|
const renderIcon = (color: string | undefined) => {
|
|
42
49
|
if (loading) {
|
|
@@ -52,6 +59,19 @@ const InputDropDown = ({
|
|
|
52
59
|
let textColor = theme.colors.text.default;
|
|
53
60
|
let placeholderColor = theme.colors.text.hint;
|
|
54
61
|
let iconTintColor = iconColor;
|
|
62
|
+
const accessibilityID = disabled
|
|
63
|
+
? getAccessibilityID(
|
|
64
|
+
`${appId}/${code}/${
|
|
65
|
+
screenInfo.screenName
|
|
66
|
+
}/input_${cleanNameForTracking(
|
|
67
|
+
floatingValue ?? placeholder,
|
|
68
|
+
)}_disabled`,
|
|
69
|
+
)
|
|
70
|
+
: getAccessibilityID(
|
|
71
|
+
`${appId}/${code}/${
|
|
72
|
+
screenInfo.screenName
|
|
73
|
+
}/input_${cleanNameForTracking(floatingValue ?? placeholder)}`,
|
|
74
|
+
);
|
|
55
75
|
|
|
56
76
|
if (disabled) {
|
|
57
77
|
textColor = disabledColor;
|
|
@@ -87,7 +107,7 @@ const InputDropDown = ({
|
|
|
87
107
|
{full && (
|
|
88
108
|
<TextInput
|
|
89
109
|
{...props}
|
|
90
|
-
|
|
110
|
+
{...accessibilityID}
|
|
91
111
|
onPressIn={onPress}
|
|
92
112
|
editable={false}
|
|
93
113
|
textAlignVertical="top"
|
|
@@ -112,13 +132,14 @@ const InputDropDown = ({
|
|
|
112
132
|
};
|
|
113
133
|
|
|
114
134
|
return (
|
|
115
|
-
<
|
|
135
|
+
<ScreenContext.Provider
|
|
116
136
|
value={{
|
|
137
|
+
...screenInfo,
|
|
117
138
|
componentName: 'InputOTP',
|
|
118
139
|
params,
|
|
119
140
|
state: 'enabled',
|
|
120
141
|
componentLabel: formatComponentName(floatingValue || ''),
|
|
121
|
-
componentId
|
|
142
|
+
componentId,
|
|
122
143
|
}}>
|
|
123
144
|
<TouchableOpacity
|
|
124
145
|
onPress={onPress}
|
|
@@ -126,7 +147,7 @@ const InputDropDown = ({
|
|
|
126
147
|
{renderInputView()}
|
|
127
148
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
128
149
|
</TouchableOpacity>
|
|
129
|
-
</
|
|
150
|
+
</ScreenContext.Provider>
|
|
130
151
|
);
|
|
131
152
|
};
|
|
132
153
|
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -18,10 +18,15 @@ 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 {
|
|
21
|
+
import {
|
|
22
|
+
cleanNameForTracking,
|
|
23
|
+
formatComponentName,
|
|
24
|
+
getAccessibilityID,
|
|
25
|
+
} from '../Application/utils';
|
|
22
26
|
|
|
23
27
|
const {
|
|
24
|
-
|
|
28
|
+
ScreenContext,
|
|
29
|
+
MiniAppContext,
|
|
25
30
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
26
31
|
|
|
27
32
|
const InputMoney = forwardRef(
|
|
@@ -43,14 +48,16 @@ const InputMoney = forwardRef(
|
|
|
43
48
|
style,
|
|
44
49
|
params,
|
|
45
50
|
defaultValue = '',
|
|
46
|
-
|
|
51
|
+
componentId,
|
|
47
52
|
...props
|
|
48
53
|
}: InputMoneyProps,
|
|
49
54
|
ref,
|
|
50
55
|
) => {
|
|
51
56
|
const {theme} = useContext(ApplicationContext);
|
|
57
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
52
58
|
const [focused, setFocused] = useState(false);
|
|
53
59
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
60
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
54
61
|
|
|
55
62
|
const validateText = (text: string) => {
|
|
56
63
|
const valueFormat = formatMoneyToNumber(text, 'đ');
|
|
@@ -96,6 +103,17 @@ const InputMoney = forwardRef(
|
|
|
96
103
|
let textColor = theme.colors.text.default;
|
|
97
104
|
let placeholderColor = theme.colors.text.hint;
|
|
98
105
|
let iconTintColor = iconColor;
|
|
106
|
+
const accessibilityID = disabled
|
|
107
|
+
? getAccessibilityID(
|
|
108
|
+
`${appId}/${code}/${
|
|
109
|
+
screenInfo.screenName
|
|
110
|
+
}/input_${cleanNameForTracking(floatingValue)}_disabled`,
|
|
111
|
+
)
|
|
112
|
+
: getAccessibilityID(
|
|
113
|
+
`${appId}/${code}/${
|
|
114
|
+
screenInfo.screenName
|
|
115
|
+
}/input_${cleanNameForTracking(floatingValue)}`,
|
|
116
|
+
);
|
|
99
117
|
|
|
100
118
|
if (disabled) {
|
|
101
119
|
textColor = disabledColor;
|
|
@@ -121,7 +139,7 @@ const InputMoney = forwardRef(
|
|
|
121
139
|
<View style={styles.inputView}>
|
|
122
140
|
<TextInput
|
|
123
141
|
{...props}
|
|
124
|
-
|
|
142
|
+
{...accessibilityID}
|
|
125
143
|
editable={!disabled}
|
|
126
144
|
textAlignVertical="top"
|
|
127
145
|
ref={inputRef}
|
|
@@ -173,19 +191,20 @@ const InputMoney = forwardRef(
|
|
|
173
191
|
}
|
|
174
192
|
|
|
175
193
|
return (
|
|
176
|
-
<
|
|
194
|
+
<ScreenContext.Provider
|
|
177
195
|
value={{
|
|
196
|
+
...screenInfo,
|
|
178
197
|
componentName: 'InputMoney',
|
|
179
198
|
params,
|
|
180
199
|
componentLabel: formatComponentName(floatingValue || ''),
|
|
181
200
|
state: inputState,
|
|
182
|
-
componentId
|
|
201
|
+
componentId,
|
|
183
202
|
}}>
|
|
184
203
|
<View style={[style, styles.wrapper]}>
|
|
185
204
|
{renderInputView()}
|
|
186
205
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
187
206
|
</View>
|
|
188
|
-
</
|
|
207
|
+
</ScreenContext.Provider>
|
|
189
208
|
);
|
|
190
209
|
},
|
|
191
210
|
);
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -21,10 +21,15 @@ 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 {
|
|
24
|
+
import {
|
|
25
|
+
cleanNameForTracking,
|
|
26
|
+
formatComponentName,
|
|
27
|
+
getAccessibilityID,
|
|
28
|
+
} from '../Application/utils';
|
|
25
29
|
|
|
26
30
|
const {
|
|
27
|
-
|
|
31
|
+
ScreenContext,
|
|
32
|
+
MiniAppContext,
|
|
28
33
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
29
34
|
|
|
30
35
|
const OTPCaret: FC<CaretProps> = ({index, length}) => {
|
|
@@ -85,16 +90,19 @@ const InputOTP = forwardRef(
|
|
|
85
90
|
dataType = 'number',
|
|
86
91
|
params,
|
|
87
92
|
style,
|
|
88
|
-
|
|
93
|
+
componentId,
|
|
89
94
|
...props
|
|
90
95
|
}: InputOTPProps,
|
|
91
96
|
ref,
|
|
92
97
|
) => {
|
|
93
98
|
const MAX_LENGTH = 10;
|
|
99
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
100
|
+
|
|
94
101
|
const [value, setValue] = useState('');
|
|
95
102
|
const [focused, setFocused] = useState(false);
|
|
96
103
|
const inputRef = useRef<TextInput>(null);
|
|
97
104
|
const {theme} = useContext(ApplicationContext);
|
|
105
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
98
106
|
|
|
99
107
|
useImperativeHandle(ref, () => ({
|
|
100
108
|
onChangeText: (text: string) => {
|
|
@@ -187,6 +195,12 @@ const InputOTP = forwardRef(
|
|
|
187
195
|
);
|
|
188
196
|
};
|
|
189
197
|
|
|
198
|
+
const accessibilityID = getAccessibilityID(
|
|
199
|
+
`${appId}/${code}/${screenInfo.screenName}/input_${cleanNameForTracking(
|
|
200
|
+
floatingValue,
|
|
201
|
+
)}`,
|
|
202
|
+
);
|
|
203
|
+
|
|
190
204
|
const renderInputView = () => {
|
|
191
205
|
return (
|
|
192
206
|
<View
|
|
@@ -212,7 +226,7 @@ const InputOTP = forwardRef(
|
|
|
212
226
|
<View style={styles.inputView}>
|
|
213
227
|
<TextInput
|
|
214
228
|
{...props}
|
|
215
|
-
|
|
229
|
+
{...accessibilityID}
|
|
216
230
|
ref={inputRef}
|
|
217
231
|
value={value}
|
|
218
232
|
onChangeText={_onChangeText}
|
|
@@ -229,13 +243,14 @@ const InputOTP = forwardRef(
|
|
|
229
243
|
};
|
|
230
244
|
|
|
231
245
|
return (
|
|
232
|
-
<
|
|
246
|
+
<ScreenContext.Provider
|
|
233
247
|
value={{
|
|
248
|
+
...screenInfo,
|
|
234
249
|
componentName: 'InputOTP',
|
|
235
250
|
params,
|
|
236
251
|
componentLabel: formatComponentName(floatingValue || ''),
|
|
237
252
|
state: 'enabled',
|
|
238
|
-
componentId
|
|
253
|
+
componentId,
|
|
239
254
|
}}>
|
|
240
255
|
<TouchableOpacity
|
|
241
256
|
activeOpacity={1}
|
|
@@ -244,7 +259,7 @@ const InputOTP = forwardRef(
|
|
|
244
259
|
{renderInputView()}
|
|
245
260
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
246
261
|
</TouchableOpacity>
|
|
247
|
-
</
|
|
262
|
+
</ScreenContext.Provider>
|
|
248
263
|
);
|
|
249
264
|
},
|
|
250
265
|
);
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -12,9 +12,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';
|
|
15
16
|
|
|
16
17
|
const {
|
|
17
|
-
|
|
18
|
+
ScreenContext,
|
|
19
|
+
MiniAppContext,
|
|
18
20
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
19
21
|
|
|
20
22
|
const InputSearch = forwardRef(
|
|
@@ -33,16 +35,18 @@ const InputSearch = forwardRef(
|
|
|
33
35
|
defaultValue,
|
|
34
36
|
onPressButtonText,
|
|
35
37
|
params,
|
|
38
|
+
componentId,
|
|
36
39
|
hasColorBG = false,
|
|
37
|
-
accessibilityLabel,
|
|
38
40
|
...props
|
|
39
41
|
}: InputSearchProps,
|
|
40
42
|
ref,
|
|
41
43
|
) => {
|
|
42
44
|
const {theme} = useContext(ApplicationContext);
|
|
45
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
43
46
|
const [focused, setFocused] = useState(false);
|
|
44
47
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
45
48
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
49
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
46
50
|
|
|
47
51
|
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
48
52
|
setFocused(true);
|
|
@@ -68,7 +72,9 @@ const InputSearch = forwardRef(
|
|
|
68
72
|
return (
|
|
69
73
|
<TextInput
|
|
70
74
|
{...props}
|
|
71
|
-
|
|
75
|
+
{...getAccessibilityID(
|
|
76
|
+
`${appId}/${code}/${screenInfo.screenName}/input_search`,
|
|
77
|
+
)}
|
|
72
78
|
textAlignVertical="center"
|
|
73
79
|
ref={inputRef}
|
|
74
80
|
style={[
|
|
@@ -139,12 +145,13 @@ const InputSearch = forwardRef(
|
|
|
139
145
|
: theme.colors.background.surface;
|
|
140
146
|
|
|
141
147
|
return (
|
|
142
|
-
<
|
|
148
|
+
<ScreenContext.Provider
|
|
143
149
|
value={{
|
|
150
|
+
...screenInfo,
|
|
144
151
|
componentName: 'InputSearch',
|
|
145
152
|
params,
|
|
146
153
|
state: inputState,
|
|
147
|
-
componentId
|
|
154
|
+
componentId,
|
|
148
155
|
}}>
|
|
149
156
|
<View style={[style, styles.searchInputContainer]}>
|
|
150
157
|
<View
|
|
@@ -172,7 +179,7 @@ const InputSearch = forwardRef(
|
|
|
172
179
|
</TouchableOpacity>
|
|
173
180
|
)}
|
|
174
181
|
</View>
|
|
175
|
-
</
|
|
182
|
+
</ScreenContext.Provider>
|
|
176
183
|
);
|
|
177
184
|
},
|
|
178
185
|
);
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -18,9 +18,11 @@ import {
|
|
|
18
18
|
import {InputTextAreaProps} from './index';
|
|
19
19
|
import {Icon} from '../Icon';
|
|
20
20
|
import {ApplicationContext} from '../Application';
|
|
21
|
+
import {cleanNameForTracking, getAccessibilityID} from '../Application/utils';
|
|
21
22
|
|
|
22
23
|
const {
|
|
23
|
-
|
|
24
|
+
ScreenContext,
|
|
25
|
+
MiniAppContext,
|
|
24
26
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
25
27
|
|
|
26
28
|
const InputTextArea = forwardRef(
|
|
@@ -42,12 +44,13 @@ const InputTextArea = forwardRef(
|
|
|
42
44
|
required,
|
|
43
45
|
errorSpacing,
|
|
44
46
|
style,
|
|
45
|
-
accessibilityLabel,
|
|
46
47
|
...props
|
|
47
48
|
}: InputTextAreaProps,
|
|
48
49
|
ref,
|
|
49
50
|
) => {
|
|
50
51
|
const {theme} = useContext(ApplicationContext);
|
|
52
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
53
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
51
54
|
const [focused, setFocused] = useState(false);
|
|
52
55
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
53
56
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
@@ -93,6 +96,20 @@ const InputTextArea = forwardRef(
|
|
|
93
96
|
placeholderColor = disabledColor;
|
|
94
97
|
}
|
|
95
98
|
|
|
99
|
+
const accessibilityID = disabled
|
|
100
|
+
? getAccessibilityID(
|
|
101
|
+
`${appId}/${code}/${
|
|
102
|
+
screenInfo.screenName
|
|
103
|
+
}/input_${cleanNameForTracking(
|
|
104
|
+
floatingValue ?? placeholder,
|
|
105
|
+
)}_disabled`,
|
|
106
|
+
)
|
|
107
|
+
: getAccessibilityID(
|
|
108
|
+
`${appId}/${code}/${
|
|
109
|
+
screenInfo.screenName
|
|
110
|
+
}/input_${cleanNameForTracking(floatingValue ?? placeholder)}`,
|
|
111
|
+
);
|
|
112
|
+
|
|
96
113
|
return (
|
|
97
114
|
<View
|
|
98
115
|
style={[
|
|
@@ -114,7 +131,7 @@ const InputTextArea = forwardRef(
|
|
|
114
131
|
<View style={styles.textAreaView}>
|
|
115
132
|
<TextInput
|
|
116
133
|
{...props}
|
|
117
|
-
|
|
134
|
+
{...accessibilityID}
|
|
118
135
|
ref={inputRef}
|
|
119
136
|
editable={!disabled}
|
|
120
137
|
textAlignVertical="top"
|
package/Input/index.tsx
CHANGED
|
@@ -82,6 +82,7 @@ export interface InputProps extends TextInputProps {
|
|
|
82
82
|
onPressIcon?: () => void;
|
|
83
83
|
|
|
84
84
|
params?: any;
|
|
85
|
+
componentId?: string;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
type InputPropsWithoutSizeAndIcon = Omit<
|
|
@@ -129,6 +130,8 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
129
130
|
hasColorBG?: boolean;
|
|
130
131
|
|
|
131
132
|
params?: any;
|
|
133
|
+
|
|
134
|
+
componentId?: string;
|
|
132
135
|
}
|
|
133
136
|
|
|
134
137
|
export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
|
@@ -166,7 +169,7 @@ export type CaretProps = {
|
|
|
166
169
|
length?: number;
|
|
167
170
|
};
|
|
168
171
|
|
|
169
|
-
export interface InputDropDownProps
|
|
172
|
+
export interface InputDropDownProps {
|
|
170
173
|
/**
|
|
171
174
|
* Optional. Defines the size of the InputDropDown component.
|
|
172
175
|
* 'small' - A smaller, less prominent input.
|
|
@@ -261,6 +264,11 @@ export interface InputDropDownProps extends InputProps {
|
|
|
261
264
|
[key: string]: any;
|
|
262
265
|
};
|
|
263
266
|
|
|
267
|
+
/**
|
|
268
|
+
* component id for element tracking.
|
|
269
|
+
*/
|
|
270
|
+
componentId?: string;
|
|
271
|
+
|
|
264
272
|
/**
|
|
265
273
|
* Optional. Represents the style of the InputDropDown component.
|
|
266
274
|
*/
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -47,8 +47,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
47
47
|
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
48
48
|
}
|
|
49
49
|
const tracking = {
|
|
50
|
-
|
|
51
|
-
code: context.code,
|
|
50
|
+
...context,
|
|
52
51
|
screen_name,
|
|
53
52
|
component_type: 'popup',
|
|
54
53
|
component_name: id,
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -31,8 +31,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
31
31
|
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
32
32
|
}
|
|
33
33
|
const tracking = {
|
|
34
|
-
|
|
35
|
-
code: context.code,
|
|
34
|
+
...context,
|
|
36
35
|
screen_name,
|
|
37
36
|
component_type: 'popup',
|
|
38
37
|
component_name: id,
|
|
@@ -121,4 +120,8 @@ const styles = StyleSheet.create({
|
|
|
121
120
|
},
|
|
122
121
|
});
|
|
123
122
|
|
|
123
|
+
PopupPromotion.defaultProps = {
|
|
124
|
+
image: 'https://google.com',
|
|
125
|
+
};
|
|
126
|
+
|
|
124
127
|
export default PopupPromotion;
|
package/Radio/index.tsx
CHANGED
|
@@ -6,10 +6,15 @@ import {Text} from '../Text';
|
|
|
6
6
|
import styles from './styles';
|
|
7
7
|
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
cleanNameForTracking,
|
|
11
|
+
formatNameLength,
|
|
12
|
+
getAccessibilityID,
|
|
13
|
+
} from '../Application/utils';
|
|
10
14
|
|
|
11
15
|
const {
|
|
12
|
-
|
|
16
|
+
ScreenContext,
|
|
17
|
+
MiniAppContext,
|
|
13
18
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
14
19
|
|
|
15
20
|
const Radio: FC<RadioProps> = ({
|
|
@@ -20,9 +25,11 @@ const Radio: FC<RadioProps> = ({
|
|
|
20
25
|
label,
|
|
21
26
|
style,
|
|
22
27
|
params,
|
|
23
|
-
|
|
28
|
+
componentId,
|
|
24
29
|
}) => {
|
|
30
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
25
31
|
const {theme} = useContext(ApplicationContext);
|
|
32
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
26
33
|
const selected = value === groupValue;
|
|
27
34
|
let disabledStyle = {};
|
|
28
35
|
let checkBoxStyle = {
|
|
@@ -44,19 +51,26 @@ const Radio: FC<RadioProps> = ({
|
|
|
44
51
|
};
|
|
45
52
|
}
|
|
46
53
|
|
|
54
|
+
const accessibilityID = getAccessibilityID?.(
|
|
55
|
+
`${appId}/${code}/${screenInfo.screenName}/rdo_${cleanNameForTracking(
|
|
56
|
+
label,
|
|
57
|
+
)}_${selected}`,
|
|
58
|
+
);
|
|
59
|
+
|
|
47
60
|
return (
|
|
48
|
-
<
|
|
61
|
+
<ScreenContext.Provider
|
|
49
62
|
value={{
|
|
63
|
+
...screenInfo,
|
|
50
64
|
componentName: 'Button',
|
|
51
65
|
params,
|
|
52
66
|
state: disabled ? 'disabled' : 'enabled',
|
|
53
|
-
componentId
|
|
67
|
+
componentId,
|
|
54
68
|
componentLabel: formatNameLength(label || ''),
|
|
55
69
|
componentValue: value,
|
|
56
70
|
action: 'click',
|
|
57
71
|
}}>
|
|
58
72
|
<TouchableOpacity
|
|
59
|
-
|
|
73
|
+
{...accessibilityID}
|
|
60
74
|
onPress={onChange}
|
|
61
75
|
disabled={disabled}
|
|
62
76
|
style={[
|
|
@@ -76,7 +90,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
76
90
|
/>
|
|
77
91
|
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
78
92
|
</TouchableOpacity>
|
|
79
|
-
</
|
|
93
|
+
</ScreenContext.Provider>
|
|
80
94
|
);
|
|
81
95
|
};
|
|
82
96
|
|
package/Radio/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export type RadioProps = {
|
|
4
4
|
/**
|
|
5
5
|
* `value`: Represents the value associated with the Radio component.
|
|
6
6
|
* It is used to determine whether the Radio component is selected or not in comparison with the `groupValue`.
|
|
@@ -36,5 +36,8 @@ export interface RadioProps extends TouchableOpacityProps {
|
|
|
36
36
|
*/
|
|
37
37
|
style?: ViewStyle;
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
|
|
40
|
+
params?: any
|
|
41
|
+
|
|
42
|
+
componentId?: string
|
|
43
|
+
};
|