@momo-kits/foundation 0.92.1-tracking.17 → 0.92.1-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/Components.tsx +7 -3
- package/Application/NavigationContainer.tsx +12 -2
- package/Application/StackScreen.tsx +4 -3
- package/Button/index.tsx +10 -5
- package/CheckBox/index.tsx +7 -4
- package/Input/Input.tsx +8 -4
- package/Input/InputDropDown.tsx +8 -5
- package/Input/InputMoney.tsx +9 -6
- package/Input/InputOTP.tsx +6 -4
- package/Input/InputSearch.tsx +7 -4
- package/Input/InputTextArea.tsx +12 -8
- package/Popup/PopupNotify.tsx +14 -10
- package/Popup/PopupPromotion.tsx +10 -8
- package/Radio/index.tsx +7 -4
- package/Switch/index.tsx +7 -5
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
View,
|
|
16
16
|
ViewStyle,
|
|
17
17
|
} from 'react-native';
|
|
18
|
-
import {ApplicationContext
|
|
18
|
+
import {ApplicationContext} from './index';
|
|
19
19
|
import {Colors, Radius, Spacing, Styles} from '../Consts';
|
|
20
20
|
import {Image} from '../Image';
|
|
21
21
|
import {
|
|
@@ -31,6 +31,10 @@ import {PopupNotify} from '../Popup';
|
|
|
31
31
|
import {Badge, BadgeDot} from '../Badge';
|
|
32
32
|
import {getAccessibilityID} from './utils';
|
|
33
33
|
|
|
34
|
+
const {
|
|
35
|
+
MiniAppContext,
|
|
36
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
37
|
+
|
|
34
38
|
const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
35
39
|
icon,
|
|
36
40
|
tintColor,
|
|
@@ -108,7 +112,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
108
112
|
onPressLeftHeader,
|
|
109
113
|
useBorder,
|
|
110
114
|
}) => {
|
|
111
|
-
const context = useContext(MiniAppContext);
|
|
115
|
+
const context = useContext<any>(MiniAppContext);
|
|
112
116
|
const {navigator} = useContext(ApplicationContext);
|
|
113
117
|
|
|
114
118
|
useEffect(() => {
|
|
@@ -300,7 +304,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
300
304
|
preventClose,
|
|
301
305
|
}) => {
|
|
302
306
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
303
|
-
const miniContext = useContext(MiniAppContext);
|
|
307
|
+
const miniContext = useContext<any>(MiniAppContext);
|
|
304
308
|
const [toolConfig, setToolConfig] = useState<any>();
|
|
305
309
|
const {onAction} = toolConfig ?? {};
|
|
306
310
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
NavigationContainer as ReactNavigationContainer,
|
|
5
5
|
NavigationContainerRef,
|
|
6
6
|
} from '@react-navigation/native';
|
|
7
|
+
import {BottomSheetModalProvider} from '@gorhom/bottom-sheet';
|
|
7
8
|
import {createStackNavigator} from '@react-navigation/stack';
|
|
8
9
|
import {DeviceEventEmitter} from 'react-native';
|
|
9
10
|
import StackScreen from './StackScreen';
|
|
@@ -11,9 +12,18 @@ import ModalScreen from './ModalScreen';
|
|
|
11
12
|
import Navigator from './Navigator';
|
|
12
13
|
import {getDialogOptions, getModalOptions, getStackOptions} from './utils';
|
|
13
14
|
import {LocalizationObject, NavigationContainerProps} from './types';
|
|
14
|
-
import {ApplicationContext
|
|
15
|
+
import {ApplicationContext} from './index';
|
|
15
16
|
import kitLocalization from '../Assets/language.json';
|
|
16
17
|
|
|
18
|
+
const {
|
|
19
|
+
MiniAppContext,
|
|
20
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* link for deprecated
|
|
24
|
+
*/
|
|
25
|
+
const deprecated = BottomSheetModalProvider;
|
|
26
|
+
|
|
17
27
|
const Stack = createStackNavigator();
|
|
18
28
|
|
|
19
29
|
const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
@@ -23,7 +33,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
23
33
|
maxApi,
|
|
24
34
|
localization,
|
|
25
35
|
}) => {
|
|
26
|
-
const context = useContext(MiniAppContext);
|
|
36
|
+
const context = useContext<any>(MiniAppContext);
|
|
27
37
|
const navigationRef = useRef<NavigationContainerRef>(null);
|
|
28
38
|
const isReady = useRef(false);
|
|
29
39
|
const navigator = useRef(new Navigator(navigationRef, isReady));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React, {useContext, useEffect, useLayoutEffect, useRef} from 'react';
|
|
2
2
|
import {ScreenParams} from './types';
|
|
3
3
|
import Navigation from './Navigation';
|
|
4
|
-
import {ApplicationContext
|
|
4
|
+
import {ApplicationContext} from './index';
|
|
5
5
|
import {GridSystem} from '../Layout';
|
|
6
6
|
import {useHeaderHeight} from '@react-navigation/stack';
|
|
7
7
|
import {Alert, InteractionManager} from 'react-native';
|
|
8
8
|
|
|
9
9
|
const {
|
|
10
10
|
ScreenContext,
|
|
11
|
+
MiniAppContext,
|
|
11
12
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
12
13
|
|
|
13
14
|
const StackScreen: React.FC<ScreenParams> = props => {
|
|
@@ -17,7 +18,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
17
18
|
const timeLoad = useRef(0);
|
|
18
19
|
const timeout = useRef<any>();
|
|
19
20
|
|
|
20
|
-
const context = useContext(MiniAppContext);
|
|
21
|
+
const context = useContext<any>(MiniAppContext);
|
|
21
22
|
|
|
22
23
|
const {screen: Component, options}: ScreenParams = props.route.params;
|
|
23
24
|
const navigation = new Navigation(props.navigation, theme);
|
|
@@ -119,7 +120,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
119
120
|
message: `${Component.name} screen_load_time ${timeLoad.current}`,
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
|
-
},
|
|
123
|
+
}, 2000);
|
|
123
124
|
},
|
|
124
125
|
}}>
|
|
125
126
|
<Component
|
package/Button/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import LinearGradient from 'react-native-linear-gradient';
|
|
10
|
-
import {ApplicationContext
|
|
10
|
+
import {ApplicationContext} from '../Application';
|
|
11
11
|
import {Text} from '../Text';
|
|
12
12
|
import {Typography} from '../Text/types';
|
|
13
13
|
import {Colors, Spacing} from '../Consts';
|
|
@@ -18,6 +18,7 @@ import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
|
18
18
|
|
|
19
19
|
const {
|
|
20
20
|
ScreenContext,
|
|
21
|
+
MiniAppContext,
|
|
21
22
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
22
23
|
|
|
23
24
|
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
@@ -79,7 +80,7 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
79
80
|
|
|
80
81
|
componentId?: string;
|
|
81
82
|
|
|
82
|
-
accessibilityID?: object
|
|
83
|
+
accessibilityID?: object;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
const Button: FC<ButtonProps> = ({
|
|
@@ -95,11 +96,11 @@ const Button: FC<ButtonProps> = ({
|
|
|
95
96
|
params,
|
|
96
97
|
componentId,
|
|
97
98
|
accessibilityLabel,
|
|
98
|
-
|
|
99
|
+
accessibilityID,
|
|
99
100
|
...rest
|
|
100
101
|
}) => {
|
|
101
102
|
const {theme, config} = useContext(ApplicationContext);
|
|
102
|
-
const {appId, code} = useContext(MiniAppContext)
|
|
103
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
103
104
|
const {gradient, color} = config?.navigationBar?.buttonColors ?? {};
|
|
104
105
|
let gradientPros;
|
|
105
106
|
if (gradient?.length > 0 && type == 'primary') {
|
|
@@ -306,7 +307,11 @@ const Button: FC<ButtonProps> = ({
|
|
|
306
307
|
};
|
|
307
308
|
|
|
308
309
|
const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
|
|
309
|
-
const selfAccessibilityID = accessibilityID
|
|
310
|
+
const selfAccessibilityID = accessibilityID
|
|
311
|
+
? accessibilityID
|
|
312
|
+
: getAccessibilityID?.(
|
|
313
|
+
`${appId}/${code}/${screenInfo.screenName}/btn_${title}`,
|
|
314
|
+
);
|
|
310
315
|
return (
|
|
311
316
|
<ScreenContext.Provider
|
|
312
317
|
value={{
|
package/CheckBox/index.tsx
CHANGED
|
@@ -2,13 +2,14 @@ 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
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
6
|
import {Text} from '../Text';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
8
|
import {formatNameLength, getAccessibilityID} from '../Application/utils';
|
|
9
9
|
|
|
10
10
|
const {
|
|
11
11
|
ScreenContext,
|
|
12
|
+
MiniAppContext,
|
|
12
13
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
13
14
|
|
|
14
15
|
const CheckBox: FC<CheckBoxProps> = ({
|
|
@@ -21,7 +22,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
21
22
|
params,
|
|
22
23
|
componentId,
|
|
23
24
|
}) => {
|
|
24
|
-
|
|
25
|
+
const {appId} = useContext<any>(MiniAppContext);
|
|
25
26
|
const {theme} = useContext(ApplicationContext);
|
|
26
27
|
const screenInfo = useContext<any>(ScreenContext);
|
|
27
28
|
const haveValue = value || indeterminate;
|
|
@@ -42,7 +43,9 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
42
43
|
backgroundColor = theme.colors.background.tonal;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
const accessibilityID = getAccessibilityID?.(
|
|
47
|
+
`${appId}/${screenInfo.screenName}/cbx_${label}_${value}`,
|
|
48
|
+
);
|
|
46
49
|
|
|
47
50
|
return (
|
|
48
51
|
<ScreenContext.Provider
|
|
@@ -57,7 +60,7 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
57
60
|
componentValue: indeterminate ? 'indetermine' : value,
|
|
58
61
|
}}>
|
|
59
62
|
<TouchableOpacity
|
|
60
|
-
|
|
63
|
+
{...accessibilityID}
|
|
61
64
|
activeOpacity={0.8}
|
|
62
65
|
onPress={() => onChange?.(!value)}
|
|
63
66
|
disabled={disabled}
|
package/Input/Input.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import {ApplicationContext
|
|
9
|
+
import {ApplicationContext} from '../Application';
|
|
10
10
|
import styles from './styles';
|
|
11
11
|
import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
|
|
12
12
|
import {InputProps} from './index';
|
|
@@ -17,6 +17,7 @@ import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
|
17
17
|
|
|
18
18
|
const {
|
|
19
19
|
ScreenContext,
|
|
20
|
+
MiniAppContext,
|
|
20
21
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
21
22
|
|
|
22
23
|
const Input = forwardRef(
|
|
@@ -51,7 +52,7 @@ const Input = forwardRef(
|
|
|
51
52
|
ref,
|
|
52
53
|
) => {
|
|
53
54
|
const {theme} = useContext(ApplicationContext);
|
|
54
|
-
const {appId} = useContext(MiniAppContext)
|
|
55
|
+
const {appId} = useContext<any>(MiniAppContext);
|
|
55
56
|
const [focused, setFocused] = useState(false);
|
|
56
57
|
const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
|
|
57
58
|
const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
|
|
@@ -121,7 +122,11 @@ const Input = forwardRef(
|
|
|
121
122
|
placeholderColor = disabledColor;
|
|
122
123
|
iconTintColor = disabledColor;
|
|
123
124
|
}
|
|
124
|
-
|
|
125
|
+
const accessibilityID = getAccessibilityID?.(
|
|
126
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
127
|
+
disabled && '_disabled'
|
|
128
|
+
}`,
|
|
129
|
+
);
|
|
125
130
|
|
|
126
131
|
return (
|
|
127
132
|
<View
|
|
@@ -204,7 +209,6 @@ const Input = forwardRef(
|
|
|
204
209
|
inputState = 'disabled';
|
|
205
210
|
}
|
|
206
211
|
|
|
207
|
-
|
|
208
212
|
return (
|
|
209
213
|
<ScreenContext.Provider
|
|
210
214
|
value={{
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import {TextInput, TouchableOpacity, View} from 'react-native';
|
|
3
|
-
import {ApplicationContext
|
|
3
|
+
import {ApplicationContext} from '../Application';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
|
|
6
6
|
import {InputDropDownProps} from './index';
|
|
@@ -11,6 +11,7 @@ import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
|
11
11
|
|
|
12
12
|
const {
|
|
13
13
|
ScreenContext,
|
|
14
|
+
MiniAppContext,
|
|
14
15
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
15
16
|
|
|
16
17
|
const InputDropDown = ({
|
|
@@ -35,7 +36,7 @@ const InputDropDown = ({
|
|
|
35
36
|
componentId,
|
|
36
37
|
...props
|
|
37
38
|
}: InputDropDownProps) => {
|
|
38
|
-
|
|
39
|
+
const {appId} = useContext<any>(MiniAppContext);
|
|
39
40
|
const {theme} = useContext(ApplicationContext);
|
|
40
41
|
const full = !!value || !!placeholder;
|
|
41
42
|
const screenInfo = useContext<any>(ScreenContext);
|
|
@@ -60,7 +61,11 @@ const InputDropDown = ({
|
|
|
60
61
|
placeholderColor = disabledColor;
|
|
61
62
|
iconTintColor = disabledColor;
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
const accessibilityID = getAccessibilityID?.(
|
|
65
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
66
|
+
disabled && '_disabled'
|
|
67
|
+
}`,
|
|
68
|
+
);
|
|
64
69
|
|
|
65
70
|
return (
|
|
66
71
|
<View
|
|
@@ -114,8 +119,6 @@ const InputDropDown = ({
|
|
|
114
119
|
);
|
|
115
120
|
};
|
|
116
121
|
|
|
117
|
-
|
|
118
|
-
|
|
119
122
|
return (
|
|
120
123
|
<ScreenContext.Provider
|
|
121
124
|
value={{
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
TouchableOpacity,
|
|
13
13
|
View,
|
|
14
14
|
} from 'react-native';
|
|
15
|
-
import {ApplicationContext
|
|
15
|
+
import {ApplicationContext} from '../Application';
|
|
16
16
|
import styles from './styles';
|
|
17
17
|
import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
|
|
18
18
|
import {InputMoneyProps} from './index';
|
|
@@ -22,6 +22,7 @@ import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
|
22
22
|
|
|
23
23
|
const {
|
|
24
24
|
ScreenContext,
|
|
25
|
+
MiniAppContext,
|
|
25
26
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
26
27
|
|
|
27
28
|
const InputMoney = forwardRef(
|
|
@@ -49,7 +50,7 @@ const InputMoney = forwardRef(
|
|
|
49
50
|
ref,
|
|
50
51
|
) => {
|
|
51
52
|
const {theme} = useContext(ApplicationContext);
|
|
52
|
-
const {appId} = useContext(MiniAppContext)
|
|
53
|
+
const {appId} = useContext<any>(MiniAppContext);
|
|
53
54
|
const [focused, setFocused] = useState(false);
|
|
54
55
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
55
56
|
const screenInfo = useContext<any>(ScreenContext);
|
|
@@ -104,7 +105,11 @@ const InputMoney = forwardRef(
|
|
|
104
105
|
placeholderColor = disabledColor;
|
|
105
106
|
iconTintColor = disabledColor;
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
+
const accessibilityID = getAccessibilityID?.(
|
|
109
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
110
|
+
disabled && '_disabled'
|
|
111
|
+
}`,
|
|
112
|
+
);
|
|
108
113
|
|
|
109
114
|
return (
|
|
110
115
|
<View
|
|
@@ -175,7 +180,6 @@ const InputMoney = forwardRef(
|
|
|
175
180
|
inputState = 'disabled';
|
|
176
181
|
}
|
|
177
182
|
|
|
178
|
-
|
|
179
183
|
return (
|
|
180
184
|
<ScreenContext.Provider
|
|
181
185
|
value={{
|
|
@@ -186,8 +190,7 @@ const InputMoney = forwardRef(
|
|
|
186
190
|
state: inputState,
|
|
187
191
|
componentId,
|
|
188
192
|
}}>
|
|
189
|
-
<View
|
|
190
|
-
style={[style, styles.wrapper]}>
|
|
193
|
+
<View style={[style, styles.wrapper]}>
|
|
191
194
|
{renderInputView()}
|
|
192
195
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
193
196
|
</View>
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -19,17 +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
|
|
22
|
+
import {ApplicationContext} from '../Application';
|
|
23
23
|
import {Spacing} from '../Consts';
|
|
24
24
|
import {formatComponentName, getAccessibilityID} from '../Application/utils';
|
|
25
25
|
|
|
26
26
|
const {
|
|
27
27
|
ScreenContext,
|
|
28
|
+
MiniAppContext,
|
|
28
29
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
29
30
|
|
|
30
31
|
const OTPCaret: FC<CaretProps> = ({index, length}) => {
|
|
31
32
|
const DURATION = 300;
|
|
32
|
-
const {appId} = useContext(MiniAppContext)
|
|
33
33
|
const {theme} = useContext(ApplicationContext);
|
|
34
34
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
35
35
|
|
|
@@ -92,7 +92,7 @@ const InputOTP = forwardRef(
|
|
|
92
92
|
ref,
|
|
93
93
|
) => {
|
|
94
94
|
const MAX_LENGTH = 10;
|
|
95
|
-
|
|
95
|
+
const {appId} = useContext<any>(MiniAppContext);
|
|
96
96
|
|
|
97
97
|
const [value, setValue] = useState('');
|
|
98
98
|
const [focused, setFocused] = useState(false);
|
|
@@ -191,7 +191,9 @@ const InputOTP = forwardRef(
|
|
|
191
191
|
);
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
const accessibilityID = getAccessibilityID?.(
|
|
195
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}`,
|
|
196
|
+
);
|
|
195
197
|
const renderInputView = () => {
|
|
196
198
|
return (
|
|
197
199
|
<View
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -7,15 +7,16 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import {InputSearchProps} from './index';
|
|
10
|
-
import {ApplicationContext
|
|
10
|
+
import {ApplicationContext} 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
|
|
15
|
+
import {getAccessibilityID} from '../Application/utils';
|
|
16
16
|
|
|
17
17
|
const {
|
|
18
18
|
ScreenContext,
|
|
19
|
+
MiniAppContext,
|
|
19
20
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
20
21
|
|
|
21
22
|
const InputSearch = forwardRef(
|
|
@@ -41,7 +42,7 @@ const InputSearch = forwardRef(
|
|
|
41
42
|
ref,
|
|
42
43
|
) => {
|
|
43
44
|
const {theme} = useContext(ApplicationContext);
|
|
44
|
-
const {appId} = useContext(MiniAppContext)
|
|
45
|
+
const {appId} = useContext<any>(MiniAppContext);
|
|
45
46
|
const [focused, setFocused] = useState(false);
|
|
46
47
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
47
48
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
@@ -66,7 +67,9 @@ const InputSearch = forwardRef(
|
|
|
66
67
|
checkTyping(text, haveValue, setHaveValue);
|
|
67
68
|
onChangeText?.(text);
|
|
68
69
|
};
|
|
69
|
-
|
|
70
|
+
const accessibilityID = getAccessibilityID?.(
|
|
71
|
+
`${appId}/${screenInfo.screenName}/input_search`,
|
|
72
|
+
);
|
|
70
73
|
|
|
71
74
|
const renderInputView = () => {
|
|
72
75
|
return (
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -17,11 +17,12 @@ import {
|
|
|
17
17
|
} from './common';
|
|
18
18
|
import {InputTextAreaProps} from './index';
|
|
19
19
|
import {Icon} from '../Icon';
|
|
20
|
-
import {ApplicationContext
|
|
21
|
-
import {getAccessibilityID} from
|
|
20
|
+
import {ApplicationContext} from '../Application';
|
|
21
|
+
import {getAccessibilityID} from '../Application/utils';
|
|
22
22
|
|
|
23
23
|
const {
|
|
24
|
-
|
|
24
|
+
ScreenContext,
|
|
25
|
+
MiniAppContext,
|
|
25
26
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
26
27
|
|
|
27
28
|
const InputTextArea = forwardRef(
|
|
@@ -48,8 +49,8 @@ const InputTextArea = forwardRef(
|
|
|
48
49
|
ref,
|
|
49
50
|
) => {
|
|
50
51
|
const {theme} = useContext(ApplicationContext);
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
53
|
+
const {appId} = useContext<any>(MiniAppContext);
|
|
53
54
|
const [focused, setFocused] = useState(false);
|
|
54
55
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
55
56
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
@@ -94,7 +95,11 @@ const InputTextArea = forwardRef(
|
|
|
94
95
|
textColor = disabledColor;
|
|
95
96
|
placeholderColor = disabledColor;
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
+
const accessibilityID = getAccessibilityID?.(
|
|
99
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
100
|
+
disabled && '_disabled'
|
|
101
|
+
}`,
|
|
102
|
+
);
|
|
98
103
|
|
|
99
104
|
return (
|
|
100
105
|
<View
|
|
@@ -157,8 +162,7 @@ const InputTextArea = forwardRef(
|
|
|
157
162
|
};
|
|
158
163
|
|
|
159
164
|
return (
|
|
160
|
-
<View
|
|
161
|
-
style={[style, styles.wrapper]}>
|
|
165
|
+
<View style={[style, styles.wrapper]}>
|
|
162
166
|
{renderInputView()}
|
|
163
167
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
164
168
|
</View>
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -4,10 +4,14 @@ import {PopupNotifyProps} from './types';
|
|
|
4
4
|
import {Radius, Spacing, Styles} from '../Consts';
|
|
5
5
|
import {Image} from '../Image';
|
|
6
6
|
import {Text} from '../Text';
|
|
7
|
-
import {ApplicationContext
|
|
7
|
+
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Button} from '../Button';
|
|
9
9
|
import {Icon} from '../Icon';
|
|
10
|
-
import {getAccessibilityID} from
|
|
10
|
+
import {getAccessibilityID} from '../Application/utils';
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
MiniAppContext,
|
|
14
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
11
15
|
|
|
12
16
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
13
17
|
id,
|
|
@@ -20,7 +24,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
20
24
|
buttonDirection = 'row',
|
|
21
25
|
onIconClose,
|
|
22
26
|
}) => {
|
|
23
|
-
const context = useContext(MiniAppContext);
|
|
27
|
+
const context = useContext<any>(MiniAppContext);
|
|
24
28
|
const {theme, navigator, translate} = useContext(ApplicationContext);
|
|
25
29
|
const [scrollContent, setScrollContent] = useState(false);
|
|
26
30
|
const closeAction = useRef('touch_outside');
|
|
@@ -109,8 +113,8 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
109
113
|
);
|
|
110
114
|
};
|
|
111
115
|
const renderColumn = () => {
|
|
112
|
-
const accessibilityPrimaryID = getAccessibilityID?.('btn_popup_allow')
|
|
113
|
-
const accessibilitySecondID = getAccessibilityID?.('btn_popup_cancel')
|
|
116
|
+
const accessibilityPrimaryID = getAccessibilityID?.('btn_popup_allow');
|
|
117
|
+
const accessibilitySecondID = getAccessibilityID?.('btn_popup_cancel');
|
|
114
118
|
|
|
115
119
|
return (
|
|
116
120
|
<View style={Styles.columnCenter}>
|
|
@@ -127,7 +131,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
127
131
|
<>
|
|
128
132
|
<View style={styles.buttonSpace} />
|
|
129
133
|
<Button
|
|
130
|
-
|
|
134
|
+
accessibilityID={accessibilitySecondID}
|
|
131
135
|
title={secondary?.title}
|
|
132
136
|
type="text"
|
|
133
137
|
size="medium"
|
|
@@ -161,11 +165,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
161
165
|
* build close action
|
|
162
166
|
*/
|
|
163
167
|
const buildCloseIcon = () => {
|
|
164
|
-
const accessibilityCloseID = getAccessibilityID?.('ic_popup_close')
|
|
168
|
+
const accessibilityCloseID = getAccessibilityID?.('ic_popup_close');
|
|
165
169
|
|
|
166
170
|
return (
|
|
167
171
|
<TouchableOpacity
|
|
168
|
-
|
|
172
|
+
{...accessibilityCloseID}
|
|
169
173
|
style={styles.iconCloseContainer}
|
|
170
174
|
onPress={() => {
|
|
171
175
|
closeAction.current = 'icon_close';
|
|
@@ -189,11 +193,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
189
193
|
);
|
|
190
194
|
};
|
|
191
195
|
|
|
192
|
-
const accessibilityID = getAccessibilityID?.(`pu_${context.code}_notify`)
|
|
196
|
+
const accessibilityID = getAccessibilityID?.(`pu_${context.code}_notify`);
|
|
193
197
|
|
|
194
198
|
return (
|
|
195
199
|
<View
|
|
196
|
-
|
|
200
|
+
{...accessibilityID}
|
|
197
201
|
style={[
|
|
198
202
|
styles.container,
|
|
199
203
|
{backgroundColor: theme.colors.background.surface},
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import React, {useContext, useEffect, useRef} from 'react';
|
|
2
2
|
import {StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {PopupPromotionProps} from './types';
|
|
4
|
-
import {ApplicationContext
|
|
4
|
+
import {ApplicationContext} 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
|
|
8
|
+
import {getAccessibilityID} from '../Application/utils';
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
MiniAppContext,
|
|
12
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
9
13
|
|
|
10
14
|
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
11
15
|
id,
|
|
12
16
|
image,
|
|
13
17
|
onIconClose,
|
|
14
18
|
}) => {
|
|
15
|
-
const context = useContext(MiniAppContext);
|
|
19
|
+
const context = useContext<any>(MiniAppContext);
|
|
16
20
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
17
21
|
const closeAction = useRef('touch_outside');
|
|
18
22
|
|
|
@@ -49,7 +53,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
49
53
|
* build close action
|
|
50
54
|
*/
|
|
51
55
|
const buildCloseIcon = () => {
|
|
52
|
-
const accessibilityCloseID = getAccessibilityID?.('ic_popup_close')
|
|
56
|
+
const accessibilityCloseID = getAccessibilityID?.('ic_popup_close');
|
|
53
57
|
|
|
54
58
|
return (
|
|
55
59
|
<View {...accessibilityCloseID} style={styles.iconCloseContainer}>
|
|
@@ -78,12 +82,10 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
78
82
|
</View>
|
|
79
83
|
);
|
|
80
84
|
};
|
|
81
|
-
const accessibilityID = getAccessibilityID?.(`pu_${context.code}_promotion`)
|
|
85
|
+
const accessibilityID = getAccessibilityID?.(`pu_${context.code}_promotion`);
|
|
82
86
|
|
|
83
87
|
return (
|
|
84
|
-
<View
|
|
85
|
-
{...accessibilityID}
|
|
86
|
-
>
|
|
88
|
+
<View {...accessibilityID}>
|
|
87
89
|
<Image
|
|
88
90
|
source={{
|
|
89
91
|
uri: image,
|
package/Radio/index.tsx
CHANGED
|
@@ -4,12 +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
|
|
7
|
+
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
9
|
import {formatNameLength, getAccessibilityID} from '../Application/utils';
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
12
|
ScreenContext,
|
|
13
|
+
MiniAppContext,
|
|
13
14
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
14
15
|
|
|
15
16
|
const Radio: FC<RadioProps> = ({
|
|
@@ -22,7 +23,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
22
23
|
params,
|
|
23
24
|
componentId,
|
|
24
25
|
}) => {
|
|
25
|
-
|
|
26
|
+
const {appId} = useContext<any>(MiniAppContext);
|
|
26
27
|
const {theme} = useContext(ApplicationContext);
|
|
27
28
|
const screenInfo = useContext<any>(ScreenContext);
|
|
28
29
|
const selected = value === groupValue;
|
|
@@ -45,7 +46,9 @@ const Radio: FC<RadioProps> = ({
|
|
|
45
46
|
: theme.colors.text.disable,
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
const accessibilityID = getAccessibilityID?.(
|
|
50
|
+
`${appId}/${screenInfo.screenName}/rdo_${label}_${value}`,
|
|
51
|
+
);
|
|
49
52
|
|
|
50
53
|
return (
|
|
51
54
|
<ScreenContext.Provider
|
|
@@ -60,7 +63,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
60
63
|
action: 'click',
|
|
61
64
|
}}>
|
|
62
65
|
<TouchableOpacity
|
|
63
|
-
|
|
66
|
+
{...accessibilityID}
|
|
64
67
|
onPress={onChange}
|
|
65
68
|
disabled={disabled}
|
|
66
69
|
style={[
|
package/Switch/index.tsx
CHANGED
|
@@ -3,15 +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
|
|
7
|
-
import {MiniAppContext} from "../Application";
|
|
6
|
+
import {getAccessibilityID} from '../Application/utils';
|
|
8
7
|
|
|
9
8
|
const {
|
|
10
9
|
ScreenContext,
|
|
10
|
+
MiniAppContext,
|
|
11
11
|
} = require('react-native/Libraries/Components/ScreenContext');
|
|
12
12
|
|
|
13
13
|
const Switch: FC<SwitchProps> = props => {
|
|
14
|
-
|
|
14
|
+
const {appId} = useContext<any>(MiniAppContext);
|
|
15
15
|
const {value, onChange, disabled, style, params, componentId} = props;
|
|
16
16
|
const screenInfo = useContext<any>(ScreenContext);
|
|
17
17
|
|
|
@@ -22,7 +22,9 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
22
22
|
if (disabled) {
|
|
23
23
|
backgroundColor = value ? Colors.green_09 : Colors.black_05;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
const accessibilityID = getAccessibilityID?.(
|
|
26
|
+
`${appId}/${screenInfo.screenName}/swt_${value}`,
|
|
27
|
+
);
|
|
26
28
|
|
|
27
29
|
return (
|
|
28
30
|
<ScreenContext.Provider
|
|
@@ -36,7 +38,7 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
36
38
|
action: 'click',
|
|
37
39
|
}}>
|
|
38
40
|
<TouchableOpacity
|
|
39
|
-
|
|
41
|
+
{...accessibilityID}
|
|
40
42
|
disabled={disabled}
|
|
41
43
|
onPress={() => onChange?.(!value)}
|
|
42
44
|
style={[
|