@momo-kits/foundation 0.89.4-tracking.17 → 0.89.4-tracking.19
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 +15 -7
- package/Application/StackScreen.tsx +11 -7
- package/Application/types.ts +1 -0
- package/Application/utils.tsx +16 -2
- package/Button/index.tsx +5 -3
- package/CheckBox/index.tsx +5 -2
- package/Image/index.tsx +3 -0
- package/Input/Input.tsx +6 -3
- package/Input/InputDropDown.tsx +7 -2
- package/Input/InputMoney.tsx +8 -3
- package/Input/InputOTP.tsx +7 -2
- package/Input/InputSearch.tsx +5 -1
- package/Input/InputTextArea.tsx +12 -2
- package/Popup/PopupNotify.tsx +12 -0
- package/Popup/PopupPromotion.tsx +8 -2
- package/Radio/index.tsx +5 -2
- package/Switch/index.tsx +5 -0
- package/index.ts +2 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import {NavigationContainer} from '@react-navigation/native';
|
|
|
8
8
|
import {Icon} from '../Icon';
|
|
9
9
|
import {Text} from '../Text';
|
|
10
10
|
import {ApplicationContext} from './index';
|
|
11
|
-
import {getStackOptions} from './utils';
|
|
11
|
+
import {getAccessibilityID, getStackOptions} from './utils';
|
|
12
12
|
import StackScreen from './StackScreen';
|
|
13
13
|
|
|
14
14
|
const Tab = createBottomTabNavigator();
|
|
@@ -58,8 +58,11 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
58
58
|
});
|
|
59
59
|
}, []);
|
|
60
60
|
|
|
61
|
+
const accessibilityID = getAccessibilityID("tbr_main_bottom")
|
|
62
|
+
|
|
61
63
|
return (
|
|
62
64
|
<Tab.Navigator
|
|
65
|
+
{...accessibilityID}
|
|
63
66
|
initialRouteName={initialRouteName}
|
|
64
67
|
backBehavior={'firstRoute'}
|
|
65
68
|
tabBarOptions={{
|
|
@@ -72,8 +75,10 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
72
75
|
},
|
|
73
76
|
}}>
|
|
74
77
|
{tabs.map(item => {
|
|
78
|
+
const itemAccessibilityID = getAccessibilityID(`btn_tabbar_${item.name}`)
|
|
75
79
|
return (
|
|
76
80
|
<Tab.Screen
|
|
81
|
+
{...itemAccessibilityID}
|
|
77
82
|
key={item.name}
|
|
78
83
|
name={item.name}
|
|
79
84
|
component={TabScreen}
|
|
@@ -29,6 +29,7 @@ import {scaleSize, Text} from '../Text';
|
|
|
29
29
|
import {Icon} from '../Icon';
|
|
30
30
|
import {PopupNotify} from '../Popup';
|
|
31
31
|
import {Badge, BadgeDot} from '../Badge';
|
|
32
|
+
import {getAccessibilityID} from "./utils";
|
|
32
33
|
|
|
33
34
|
const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
34
35
|
icon,
|
|
@@ -37,6 +38,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
37
38
|
useBorder = true,
|
|
38
39
|
badgeType,
|
|
39
40
|
badgeValue,
|
|
41
|
+
accessibilityID = ''
|
|
40
42
|
}) => {
|
|
41
43
|
const {theme} = useContext(ApplicationContext);
|
|
42
44
|
let buttonStyle: ViewStyle = {backgroundColor: '#00000066'};
|
|
@@ -63,8 +65,9 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
63
65
|
}
|
|
64
66
|
}, [badgeType, badgeValue]);
|
|
65
67
|
|
|
68
|
+
const ID = getAccessibilityID(accessibilityID)
|
|
66
69
|
return (
|
|
67
|
-
<View style={{width: scaleSize(28)}}>
|
|
70
|
+
<View {...ID} style={{width: scaleSize(28)}}>
|
|
68
71
|
<TouchableOpacity
|
|
69
72
|
style={[styles.navigationButton, buttonStyle]}
|
|
70
73
|
onPress={onPress}>
|
|
@@ -128,7 +131,8 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
128
131
|
icon_name: 'back',
|
|
129
132
|
};
|
|
130
133
|
navigator?.maxApi?.showToastDebug?.({
|
|
131
|
-
|
|
134
|
+
appId: context.appId,
|
|
135
|
+
message: 'service_icon_clicked',
|
|
132
136
|
params,
|
|
133
137
|
});
|
|
134
138
|
navigator?.maxApi?.trackEvent?.('service_icon_clicked', params);
|
|
@@ -165,10 +169,10 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
165
169
|
}
|
|
166
170
|
return true;
|
|
167
171
|
};
|
|
168
|
-
|
|
169
172
|
return (
|
|
170
|
-
<View
|
|
173
|
+
<View style={styles.headerLeft}>
|
|
171
174
|
<NavigationButton
|
|
175
|
+
accessibilityID = "btn_navigation_back"
|
|
172
176
|
icon="ic_back"
|
|
173
177
|
tintColor={tintColor}
|
|
174
178
|
onPress={goBackSafe}
|
|
@@ -368,6 +372,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
368
372
|
if (pinTool)
|
|
369
373
|
return (
|
|
370
374
|
<NavigationButton
|
|
375
|
+
accessibilityID = "btn_navigation_pin"
|
|
371
376
|
icon={pinTool.icon as string}
|
|
372
377
|
tintColor={tintColor}
|
|
373
378
|
badgeValue={badgeValue}
|
|
@@ -385,7 +390,6 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
385
390
|
/>
|
|
386
391
|
);
|
|
387
392
|
};
|
|
388
|
-
|
|
389
393
|
if (toolConfig) {
|
|
390
394
|
return (
|
|
391
395
|
<View style={styles.headerRightButton}>
|
|
@@ -398,11 +402,15 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
398
402
|
borderWidth: backgroundColor ? 0.5 : 0,
|
|
399
403
|
},
|
|
400
404
|
]}>
|
|
401
|
-
<TouchableOpacity
|
|
405
|
+
<TouchableOpacity
|
|
406
|
+
{...getAccessibilityID("btn_navigation_more")}
|
|
407
|
+
onPress={onMore}>
|
|
402
408
|
<Icon color={tintColor} source="navigation_more_horiz" size={20} />
|
|
403
409
|
</TouchableOpacity>
|
|
404
410
|
<View style={[styles.divider, {backgroundColor: tintColor}]} />
|
|
405
|
-
<TouchableOpacity
|
|
411
|
+
<TouchableOpacity
|
|
412
|
+
{...getAccessibilityID("btn_navigation_close")}
|
|
413
|
+
onPress={onClose}>
|
|
406
414
|
<Icon
|
|
407
415
|
color={tintColor}
|
|
408
416
|
source="16_navigation_close_circle"
|
|
@@ -34,16 +34,17 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
34
34
|
* set options for screen
|
|
35
35
|
*/
|
|
36
36
|
useLayoutEffect(() => {
|
|
37
|
-
if (options) {
|
|
38
|
-
navigation.setOptions(options);
|
|
39
|
-
}
|
|
40
37
|
InteractionManager.runAfterInteractions(() => {
|
|
41
38
|
navigator?.maxApi?.showToastDebug?.({
|
|
42
|
-
|
|
39
|
+
appId: context.appId,
|
|
40
|
+
message: `${Component.name} screen_interaction_time ${
|
|
43
41
|
Date.now() - startTime.current
|
|
44
42
|
}`,
|
|
45
43
|
});
|
|
46
44
|
});
|
|
45
|
+
if (options) {
|
|
46
|
+
navigation.setOptions(options);
|
|
47
|
+
}
|
|
47
48
|
}, [options]);
|
|
48
49
|
|
|
49
50
|
/**
|
|
@@ -78,7 +79,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
78
79
|
};
|
|
79
80
|
navigator?.maxApi?.trackEvent?.('service_frame_displayed', params);
|
|
80
81
|
navigator?.maxApi?.showToastDebug?.({
|
|
81
|
-
|
|
82
|
+
appId: context.appId,
|
|
83
|
+
message: `${Component.name} service_frame_displayed`,
|
|
82
84
|
params,
|
|
83
85
|
});
|
|
84
86
|
|
|
@@ -90,7 +92,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
90
92
|
};
|
|
91
93
|
navigator?.maxApi?.trackEvent?.('service_icon_clicked', params);
|
|
92
94
|
navigator?.maxApi?.showToastDebug?.({
|
|
93
|
-
|
|
95
|
+
appId: context.appId,
|
|
96
|
+
message: `${Component.name} service_icon_clicked`,
|
|
94
97
|
params,
|
|
95
98
|
});
|
|
96
99
|
});
|
|
@@ -111,7 +114,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
111
114
|
timeout.current = setTimeout(() => {
|
|
112
115
|
timeLoad.current = endTime.current - startTime.current;
|
|
113
116
|
navigator?.maxApi?.showToastDebug?.({
|
|
114
|
-
|
|
117
|
+
appId: context.appId,
|
|
118
|
+
message: `${Component.name} screen_load_time ${timeLoad.current}`,
|
|
115
119
|
});
|
|
116
120
|
}, 1000);
|
|
117
121
|
},
|
package/Application/types.ts
CHANGED
package/Application/utils.tsx
CHANGED
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
} from './Components';
|
|
13
13
|
import {NavigationOptions, Theme} from './types';
|
|
14
14
|
import {Colors} from '../Consts';
|
|
15
|
-
|
|
15
|
+
import {Platform} from "react-native";
|
|
16
|
+
const isIOS = Platform.OS === 'ios'
|
|
16
17
|
/**
|
|
17
18
|
* default options for stack screen
|
|
18
19
|
*/
|
|
@@ -146,6 +147,19 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
|
146
147
|
};
|
|
147
148
|
};
|
|
148
149
|
|
|
150
|
+
const getAccessibilityID = (key = "") => {
|
|
151
|
+
if (isIOS) {
|
|
152
|
+
return {
|
|
153
|
+
accessible: true,
|
|
154
|
+
testID: key
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
return {
|
|
158
|
+
accessibilityLabel: key
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
149
163
|
const formatComponentName= (word: string) =>{
|
|
150
164
|
const accentsMap = {
|
|
151
165
|
'a': 'á|à|ả|ã|ạ|â|ấ|ầ|ẩ|ẫ|ậ|ă|ắ|ằ|ẳ|ẵ|ặ',
|
|
@@ -181,4 +195,4 @@ const formatNameLength = (name: string) =>{
|
|
|
181
195
|
}
|
|
182
196
|
return formattedName
|
|
183
197
|
}
|
|
184
|
-
export {getStackOptions, getDialogOptions, getModalOptions, getOptions, formatComponentName, formatNameLength};
|
|
198
|
+
export {getStackOptions, getDialogOptions, getModalOptions, getOptions, formatComponentName, formatNameLength, getAccessibilityID};
|
package/Button/index.tsx
CHANGED
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import LinearGradient from 'react-native-linear-gradient';
|
|
10
|
-
import {ApplicationContext} from '../Application';
|
|
10
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
11
11
|
import {Text} from '../Text';
|
|
12
12
|
import {Typography} from '../Text/types';
|
|
13
13
|
import {Colors, Spacing} from '../Consts';
|
|
14
14
|
import styles from './styles';
|
|
15
15
|
import {Icon} from '../Icon';
|
|
16
16
|
import {Loader} from '../Loader';
|
|
17
|
-
import {formatComponentName} from '../Application/utils';
|
|
17
|
+
import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
18
18
|
|
|
19
19
|
const {
|
|
20
20
|
ScreenContext,
|
|
@@ -96,6 +96,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
96
96
|
...rest
|
|
97
97
|
}) => {
|
|
98
98
|
const {theme, config} = useContext(ApplicationContext);
|
|
99
|
+
const {appId, code} = useContext(MiniAppContext)
|
|
99
100
|
const {gradient, color} = config?.navigationBar?.buttonColors ?? {};
|
|
100
101
|
let gradientPros;
|
|
101
102
|
if (gradient?.length > 0 && type == 'primary') {
|
|
@@ -302,7 +303,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
302
303
|
};
|
|
303
304
|
|
|
304
305
|
const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
|
|
305
|
-
|
|
306
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|btn_${title}`)
|
|
306
307
|
return (
|
|
307
308
|
<ScreenContext.Provider
|
|
308
309
|
value={{
|
|
@@ -320,6 +321,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
320
321
|
}}>
|
|
321
322
|
<TouchableOpacity
|
|
322
323
|
{...rest}
|
|
324
|
+
{...accessibilityID}
|
|
323
325
|
activeOpacity={activeOpacity}
|
|
324
326
|
onPress={onPressButton}
|
|
325
327
|
style={buttonStyle}>
|
package/CheckBox/index.tsx
CHANGED
|
@@ -2,10 +2,10 @@ 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} from '../Application';
|
|
5
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
6
6
|
import {Text} from '../Text';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
|
-
import {formatNameLength} from '../Application/utils';
|
|
8
|
+
import {formatNameLength, getAccessibilityID} from '../Application/utils';
|
|
9
9
|
|
|
10
10
|
const {
|
|
11
11
|
ScreenContext,
|
|
@@ -21,6 +21,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
21
21
|
params,
|
|
22
22
|
componentId,
|
|
23
23
|
}) => {
|
|
24
|
+
const {appId} = useContext(MiniAppContext)
|
|
24
25
|
const {theme} = useContext(ApplicationContext);
|
|
25
26
|
const screenInfo = useContext<any>(ScreenContext);
|
|
26
27
|
const haveValue = value || indeterminate;
|
|
@@ -41,6 +42,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
41
42
|
backgroundColor = theme.colors.background.tonal;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
45
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|cbx_${label}_${value}`)
|
|
44
46
|
|
|
45
47
|
return (
|
|
46
48
|
<ScreenContext.Provider
|
|
@@ -55,6 +57,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
55
57
|
componentValue: indeterminate ? 'indetermine' : value,
|
|
56
58
|
}}>
|
|
57
59
|
<TouchableOpacity
|
|
60
|
+
{...accessibilityID}
|
|
58
61
|
activeOpacity={0.8}
|
|
59
62
|
onPress={() => onChange?.(!value)}
|
|
60
63
|
disabled={disabled}
|
package/Image/index.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import {Skeleton} from '../Skeleton';
|
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
8
|
import {Styles} from '../Consts';
|
|
9
9
|
import {ImageProps} from './types';
|
|
10
|
+
import {getAccessibilityID} from "../Application/utils";
|
|
10
11
|
|
|
11
12
|
type Status = 'success' | 'loading' | 'error';
|
|
12
13
|
|
|
@@ -41,9 +42,11 @@ const Image: React.FC<ImageProps> = ({
|
|
|
41
42
|
return children;
|
|
42
43
|
};
|
|
43
44
|
|
|
45
|
+
const accessibilityID = getAccessibilityID(`img|${source}`)
|
|
44
46
|
return (
|
|
45
47
|
<FastImage
|
|
46
48
|
{...rest}
|
|
49
|
+
{...accessibilityID}
|
|
47
50
|
source={source}
|
|
48
51
|
style={[styles.container, style]}
|
|
49
52
|
onProgress={() => {
|
package/Input/Input.tsx
CHANGED
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import {ApplicationContext} from '../Application';
|
|
9
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
10
10
|
import styles from './styles';
|
|
11
11
|
import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
|
|
12
12
|
import {InputProps} from './index';
|
|
13
13
|
import {Icon} from '../Icon';
|
|
14
14
|
import {checkTyping} from './utils';
|
|
15
15
|
import {Loader} from '../Loader';
|
|
16
|
-
import {formatComponentName} from '../Application/utils';
|
|
16
|
+
import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
17
17
|
|
|
18
18
|
const {
|
|
19
19
|
ScreenContext,
|
|
@@ -51,6 +51,7 @@ const Input = forwardRef(
|
|
|
51
51
|
ref,
|
|
52
52
|
) => {
|
|
53
53
|
const {theme} = useContext(ApplicationContext);
|
|
54
|
+
const {appId} = useContext(MiniAppContext)
|
|
54
55
|
const [focused, setFocused] = useState(false);
|
|
55
56
|
const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
|
|
56
57
|
const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
|
|
@@ -201,6 +202,8 @@ const Input = forwardRef(
|
|
|
201
202
|
inputState = 'disabled';
|
|
202
203
|
}
|
|
203
204
|
|
|
205
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
206
|
+
|
|
204
207
|
return (
|
|
205
208
|
<ScreenContext.Provider
|
|
206
209
|
value={{
|
|
@@ -211,7 +214,7 @@ const Input = forwardRef(
|
|
|
211
214
|
state: inputState,
|
|
212
215
|
componentId,
|
|
213
216
|
}}>
|
|
214
|
-
<View style={[style, styles.wrapper]}>
|
|
217
|
+
<View {...accessibilityID} style={[style, styles.wrapper]}>
|
|
215
218
|
{renderInputView()}
|
|
216
219
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
217
220
|
</View>
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import {TextInput, TouchableOpacity, View} from 'react-native';
|
|
3
|
-
import {ApplicationContext} from '../Application';
|
|
3
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
|
|
6
6
|
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';
|
|
10
|
+
import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
11
11
|
|
|
12
12
|
const {
|
|
13
13
|
ScreenContext,
|
|
@@ -35,6 +35,7 @@ const InputDropDown = ({
|
|
|
35
35
|
componentId,
|
|
36
36
|
...props
|
|
37
37
|
}: InputDropDownProps) => {
|
|
38
|
+
const {appId} = useContext(MiniAppContext)
|
|
38
39
|
const {theme} = useContext(ApplicationContext);
|
|
39
40
|
const full = !!value || !!placeholder;
|
|
40
41
|
const screenInfo = useContext<any>(ScreenContext);
|
|
@@ -111,6 +112,9 @@ const InputDropDown = ({
|
|
|
111
112
|
);
|
|
112
113
|
};
|
|
113
114
|
|
|
115
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
116
|
+
|
|
117
|
+
|
|
114
118
|
return (
|
|
115
119
|
<ScreenContext.Provider
|
|
116
120
|
value={{
|
|
@@ -122,6 +126,7 @@ const InputDropDown = ({
|
|
|
122
126
|
componentId,
|
|
123
127
|
}}>
|
|
124
128
|
<TouchableOpacity
|
|
129
|
+
{...accessibilityID}
|
|
125
130
|
onPress={onPress}
|
|
126
131
|
style={[style, full && styles.wrapper]}>
|
|
127
132
|
{renderInputView()}
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
TouchableOpacity,
|
|
13
13
|
View,
|
|
14
14
|
} from 'react-native';
|
|
15
|
-
import {ApplicationContext} from '../Application';
|
|
15
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
16
16
|
import styles from './styles';
|
|
17
17
|
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';
|
|
21
|
+
import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
22
22
|
|
|
23
23
|
const {
|
|
24
24
|
ScreenContext,
|
|
@@ -49,6 +49,7 @@ const InputMoney = forwardRef(
|
|
|
49
49
|
ref,
|
|
50
50
|
) => {
|
|
51
51
|
const {theme} = useContext(ApplicationContext);
|
|
52
|
+
const {appId} = useContext(MiniAppContext)
|
|
52
53
|
const [focused, setFocused] = useState(false);
|
|
53
54
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
54
55
|
const screenInfo = useContext<any>(ScreenContext);
|
|
@@ -172,6 +173,8 @@ const InputMoney = forwardRef(
|
|
|
172
173
|
inputState = 'disabled';
|
|
173
174
|
}
|
|
174
175
|
|
|
176
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
177
|
+
|
|
175
178
|
return (
|
|
176
179
|
<ScreenContext.Provider
|
|
177
180
|
value={{
|
|
@@ -182,7 +185,9 @@ const InputMoney = forwardRef(
|
|
|
182
185
|
state: inputState,
|
|
183
186
|
componentId,
|
|
184
187
|
}}>
|
|
185
|
-
<View
|
|
188
|
+
<View
|
|
189
|
+
{...accessibilityID}
|
|
190
|
+
style={[style, styles.wrapper]}>
|
|
186
191
|
{renderInputView()}
|
|
187
192
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
188
193
|
</View>
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -19,9 +19,9 @@ 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} from '../Application/utils';
|
|
24
|
+
import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
25
25
|
|
|
26
26
|
const {
|
|
27
27
|
ScreenContext,
|
|
@@ -29,6 +29,7 @@ const {
|
|
|
29
29
|
|
|
30
30
|
const OTPCaret: FC<CaretProps> = ({index, length}) => {
|
|
31
31
|
const DURATION = 300;
|
|
32
|
+
const {appId} = useContext(MiniAppContext)
|
|
32
33
|
const {theme} = useContext(ApplicationContext);
|
|
33
34
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
34
35
|
|
|
@@ -91,6 +92,8 @@ const InputOTP = forwardRef(
|
|
|
91
92
|
ref,
|
|
92
93
|
) => {
|
|
93
94
|
const MAX_LENGTH = 10;
|
|
95
|
+
const {appId} = useContext(MiniAppContext)
|
|
96
|
+
|
|
94
97
|
const [value, setValue] = useState('');
|
|
95
98
|
const [focused, setFocused] = useState(false);
|
|
96
99
|
const inputRef = useRef<TextInput>(null);
|
|
@@ -227,6 +230,7 @@ const InputOTP = forwardRef(
|
|
|
227
230
|
</View>
|
|
228
231
|
);
|
|
229
232
|
};
|
|
233
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
230
234
|
|
|
231
235
|
return (
|
|
232
236
|
<ScreenContext.Provider
|
|
@@ -239,6 +243,7 @@ const InputOTP = forwardRef(
|
|
|
239
243
|
componentId,
|
|
240
244
|
}}>
|
|
241
245
|
<TouchableOpacity
|
|
246
|
+
{...accessibilityID}
|
|
242
247
|
activeOpacity={1}
|
|
243
248
|
onPress={onFocusInput}
|
|
244
249
|
style={[style, styles.otpWrapper]}>
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -7,11 +7,12 @@ 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";
|
|
15
16
|
|
|
16
17
|
const {
|
|
17
18
|
ScreenContext,
|
|
@@ -40,6 +41,7 @@ const InputSearch = forwardRef(
|
|
|
40
41
|
ref,
|
|
41
42
|
) => {
|
|
42
43
|
const {theme} = useContext(ApplicationContext);
|
|
44
|
+
const {appId} = useContext(MiniAppContext)
|
|
43
45
|
const [focused, setFocused] = useState(false);
|
|
44
46
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
45
47
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
@@ -137,9 +139,11 @@ const InputSearch = forwardRef(
|
|
|
137
139
|
const backgroundColor = hasColorBG
|
|
138
140
|
? theme.colors.background.default
|
|
139
141
|
: theme.colors.background.surface;
|
|
142
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_search`)
|
|
140
143
|
|
|
141
144
|
return (
|
|
142
145
|
<ScreenContext.Provider
|
|
146
|
+
{...accessibilityID}
|
|
143
147
|
value={{
|
|
144
148
|
...screenInfo,
|
|
145
149
|
componentName: 'InputSearch',
|
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>();
|
|
@@ -146,9 +153,12 @@ const InputTextArea = forwardRef(
|
|
|
146
153
|
</View>
|
|
147
154
|
);
|
|
148
155
|
};
|
|
156
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
149
157
|
|
|
150
158
|
return (
|
|
151
|
-
<View
|
|
159
|
+
<View
|
|
160
|
+
{...accessibilityID}
|
|
161
|
+
style={[style, styles.wrapper]}>
|
|
152
162
|
{renderInputView()}
|
|
153
163
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
154
164
|
</View>
|
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
|
+
{...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
|
+
{...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,9 +4,9 @@ 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} from '../Application/utils';
|
|
9
|
+
import {formatNameLength, getAccessibilityID} from '../Application/utils';
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
12
|
ScreenContext,
|
|
@@ -22,6 +22,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
22
22
|
params,
|
|
23
23
|
componentId,
|
|
24
24
|
}) => {
|
|
25
|
+
const {appId} = useContext(MiniAppContext)
|
|
25
26
|
const {theme} = useContext(ApplicationContext);
|
|
26
27
|
const screenInfo = useContext<any>(ScreenContext);
|
|
27
28
|
const selected = value === groupValue;
|
|
@@ -44,6 +45,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
44
45
|
: theme.colors.text.disable,
|
|
45
46
|
};
|
|
46
47
|
}
|
|
48
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|rdo_${label}_${value}`)
|
|
47
49
|
|
|
48
50
|
return (
|
|
49
51
|
<ScreenContext.Provider
|
|
@@ -58,6 +60,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
58
60
|
action: 'click',
|
|
59
61
|
}}>
|
|
60
62
|
<TouchableOpacity
|
|
63
|
+
{...accessibilityID}
|
|
61
64
|
onPress={onChange}
|
|
62
65
|
disabled={disabled}
|
|
63
66
|
style={[
|
package/Switch/index.tsx
CHANGED
|
@@ -3,12 +3,15 @@ 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";
|
|
6
8
|
|
|
7
9
|
const {
|
|
8
10
|
ScreenContext,
|
|
9
11
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
10
12
|
|
|
11
13
|
const Switch: FC<SwitchProps> = props => {
|
|
14
|
+
const {appId} = useContext(MiniAppContext)
|
|
12
15
|
const {value, onChange, disabled, style, params, componentId} = props;
|
|
13
16
|
const screenInfo = useContext<any>(ScreenContext);
|
|
14
17
|
|
|
@@ -19,6 +22,7 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
19
22
|
if (disabled) {
|
|
20
23
|
backgroundColor = value ? Colors.green_09 : Colors.black_05;
|
|
21
24
|
}
|
|
25
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|swt_${value}`)
|
|
22
26
|
|
|
23
27
|
return (
|
|
24
28
|
<ScreenContext.Provider
|
|
@@ -32,6 +36,7 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
32
36
|
action: 'click',
|
|
33
37
|
}}>
|
|
34
38
|
<TouchableOpacity
|
|
39
|
+
{...accessibilityID}
|
|
35
40
|
disabled={disabled}
|
|
36
41
|
onPress={() => onChange?.(!value)}
|
|
37
42
|
style={[
|
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
|