@momo-kits/foundation 0.92.1-tracking.2 → 0.92.1-tracking.20
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 +2 -2
- package/Application/Components.tsx +37 -29
- package/Application/ModalScreen.tsx +107 -131
- package/Application/NavigationContainer.tsx +59 -53
- package/Application/StackScreen.tsx +19 -14
- package/Application/index.ts +0 -4
- package/Application/types.ts +6 -7
- package/Application/utils.tsx +3 -10
- package/Button/index.tsx +12 -4
- package/CheckBox/index.tsx +7 -4
- package/Image/index.tsx +1 -1
- package/Input/Input.tsx +10 -5
- package/Input/InputDropDown.tsx +9 -6
- package/Input/InputMoney.tsx +10 -7
- package/Input/InputOTP.tsx +7 -5
- package/Input/InputSearch.tsx +8 -5
- package/Input/InputTextArea.tsx +13 -9
- package/Input/styles.ts +3 -3
- package/Popup/PopupNotify.tsx +15 -11
- package/Popup/PopupPromotion.tsx +10 -8
- package/Radio/index.tsx +7 -4
- package/Switch/index.tsx +7 -5
- package/Text/index.tsx +3 -5
- package/Text/styles.ts +7 -7
- package/package.json +2 -1
- package/verify.js +9 -6
|
@@ -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,25 +18,23 @@ 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
|
-
const {screen: Component, options
|
|
23
|
+
const {screen: Component, options}: ScreenParams = props.route.params;
|
|
23
24
|
const navigation = new Navigation(props.navigation, theme);
|
|
24
25
|
const heightHeader = useHeaderHeight();
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
+
const params = {
|
|
27
28
|
...props.route.params,
|
|
28
|
-
params,
|
|
29
29
|
navigation,
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
delete
|
|
32
|
+
delete params.screen;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* set options for screen
|
|
36
36
|
*/
|
|
37
37
|
useLayoutEffect(() => {
|
|
38
|
-
startTime.current = Date.now();
|
|
39
38
|
InteractionManager.runAfterInteractions(() => {
|
|
40
39
|
navigator?.maxApi?.showToastDebug?.({
|
|
41
40
|
appId: context.appId,
|
|
@@ -114,15 +113,21 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
114
113
|
endTime.current = Date.now();
|
|
115
114
|
clearTimeout(timeout.current);
|
|
116
115
|
timeout.current = setTimeout(() => {
|
|
117
|
-
timeLoad.current
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
if (timeLoad.current === 0) {
|
|
117
|
+
timeLoad.current = endTime.current - startTime.current;
|
|
118
|
+
navigator?.maxApi?.showToastDebug?.({
|
|
119
|
+
appId: context.appId,
|
|
120
|
+
message: `${Component.name} screen_load_time ${timeLoad.current}`,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}, 2000);
|
|
123
124
|
},
|
|
124
125
|
}}>
|
|
125
|
-
<Component
|
|
126
|
+
<Component
|
|
127
|
+
heightHeader={heightHeader}
|
|
128
|
+
{...params}
|
|
129
|
+
onScreenLoad={() => {}}
|
|
130
|
+
/>
|
|
126
131
|
{showGrid && <GridSystem />}
|
|
127
132
|
</ScreenContext.Provider>
|
|
128
133
|
);
|
package/Application/index.ts
CHANGED
|
@@ -4,10 +4,8 @@ import {
|
|
|
4
4
|
HeaderAnimated,
|
|
5
5
|
HeaderBackground,
|
|
6
6
|
HeaderCustom,
|
|
7
|
-
HeaderLeft,
|
|
8
7
|
HeaderRightAction,
|
|
9
8
|
HeaderTitle,
|
|
10
|
-
HeaderToolkitAction,
|
|
11
9
|
NavigationButton,
|
|
12
10
|
} from './Components';
|
|
13
11
|
import BottomTab from './BottomTab';
|
|
@@ -32,10 +30,8 @@ export {
|
|
|
32
30
|
BottomTab,
|
|
33
31
|
NavigationButton,
|
|
34
32
|
HeaderTitle,
|
|
35
|
-
HeaderLeft,
|
|
36
33
|
HeaderBackground,
|
|
37
34
|
HeaderRightAction,
|
|
38
|
-
HeaderToolkitAction,
|
|
39
35
|
HeaderCustom,
|
|
40
36
|
HeaderAnimated,
|
|
41
37
|
};
|
package/Application/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Animated} from 'react-native';
|
|
1
|
+
import {Animated, FlatListProps, ViewProps} from 'react-native';
|
|
2
2
|
import {StackNavigationOptions} from '@react-navigation/stack';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import Navigator from './Navigator';
|
|
@@ -94,7 +94,6 @@ export type NavigationContainerProps = {
|
|
|
94
94
|
options?: NavigationOptions;
|
|
95
95
|
theme: Theme;
|
|
96
96
|
maxApi: any;
|
|
97
|
-
params: Record<string, any>;
|
|
98
97
|
localization?: LocalizationObject;
|
|
99
98
|
};
|
|
100
99
|
|
|
@@ -119,8 +118,8 @@ export interface ModalParams extends ScreenParams {
|
|
|
119
118
|
export interface BottomSheetParams extends ScreenParams {
|
|
120
119
|
[key: string]: any;
|
|
121
120
|
onDismiss?: () => void;
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
footerComponent?: React.ReactNode;
|
|
122
|
+
flatListProps: FlatListProps<any>;
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
export type NavigationButtonProps = {
|
|
@@ -154,6 +153,7 @@ export interface NavigationOptions extends StackNavigationOptions {
|
|
|
154
153
|
toolkitParams?: {
|
|
155
154
|
pinnedTool?: PinnedToolType;
|
|
156
155
|
runtimeTools?: RuntimeToolType[];
|
|
156
|
+
preventClose?: PopupNotifyProps;
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -185,11 +185,10 @@ export type HeaderToolkitProps = {
|
|
|
185
185
|
configs: any[];
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
export
|
|
188
|
+
export interface HeaderAnimatedProps extends ViewProps {
|
|
189
189
|
animatedValue: Animated.Value;
|
|
190
190
|
image: string;
|
|
191
|
-
|
|
192
|
-
};
|
|
191
|
+
}
|
|
193
192
|
|
|
194
193
|
export type BottomTabItemProps = {
|
|
195
194
|
name: string;
|
package/Application/utils.tsx
CHANGED
|
@@ -131,14 +131,7 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
|
131
131
|
options = {
|
|
132
132
|
...options,
|
|
133
133
|
headerRight: (props: any) => {
|
|
134
|
-
return
|
|
135
|
-
<HeaderToolkitAction
|
|
136
|
-
preventBack={params.preventBack}
|
|
137
|
-
pinnedTool={params.toolkitParams?.pinnedTool}
|
|
138
|
-
runtimeTools={params.toolkitParams?.runtimeTools}
|
|
139
|
-
{...props}
|
|
140
|
-
/>
|
|
141
|
-
);
|
|
134
|
+
return <HeaderToolkitAction {...params.toolkitParams} {...props} />;
|
|
142
135
|
},
|
|
143
136
|
};
|
|
144
137
|
}
|
|
@@ -162,7 +155,7 @@ const getAccessibilityID = (key = '') => {
|
|
|
162
155
|
}
|
|
163
156
|
};
|
|
164
157
|
|
|
165
|
-
const formatComponentName = (word
|
|
158
|
+
const formatComponentName = (word = '') => {
|
|
166
159
|
const accentsMap = {
|
|
167
160
|
a: 'á|à|ả|ã|ạ|â|ấ|ầ|ẩ|ẫ|ậ|ă|ắ|ằ|ẳ|ẵ|ặ',
|
|
168
161
|
A: 'Á|À|Ả|Ã|Ạ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ă|Ắ|Ằ|Ẳ|Ẵ|Ặ',
|
|
@@ -190,7 +183,7 @@ const formatComponentName = (word: string) => {
|
|
|
190
183
|
return word;
|
|
191
184
|
};
|
|
192
185
|
|
|
193
|
-
const formatNameLength = (name
|
|
186
|
+
const formatNameLength = (name = '') => {
|
|
194
187
|
let formattedName = name;
|
|
195
188
|
if (formattedName.length > 100) {
|
|
196
189
|
formattedName = formattedName.substring(0, 100);
|
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);
|
|
@@ -78,6 +79,8 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
78
79
|
params?: any;
|
|
79
80
|
|
|
80
81
|
componentId?: string;
|
|
82
|
+
|
|
83
|
+
accessibilityID?: object;
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
const Button: FC<ButtonProps> = ({
|
|
@@ -93,10 +96,11 @@ const Button: FC<ButtonProps> = ({
|
|
|
93
96
|
params,
|
|
94
97
|
componentId,
|
|
95
98
|
accessibilityLabel,
|
|
99
|
+
accessibilityID,
|
|
96
100
|
...rest
|
|
97
101
|
}) => {
|
|
98
102
|
const {theme, config} = useContext(ApplicationContext);
|
|
99
|
-
const {appId, code} = useContext(MiniAppContext)
|
|
103
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
100
104
|
const {gradient, color} = config?.navigationBar?.buttonColors ?? {};
|
|
101
105
|
let gradientPros;
|
|
102
106
|
if (gradient?.length > 0 && type == 'primary') {
|
|
@@ -303,7 +307,11 @@ const Button: FC<ButtonProps> = ({
|
|
|
303
307
|
};
|
|
304
308
|
|
|
305
309
|
const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
|
|
306
|
-
const
|
|
310
|
+
const selfAccessibilityID = accessibilityID
|
|
311
|
+
? accessibilityID
|
|
312
|
+
: getAccessibilityID?.(
|
|
313
|
+
`${appId}/${code}/${screenInfo.screenName}/btn_${title}`,
|
|
314
|
+
);
|
|
307
315
|
return (
|
|
308
316
|
<ScreenContext.Provider
|
|
309
317
|
value={{
|
|
@@ -321,7 +329,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
321
329
|
}}>
|
|
322
330
|
<TouchableOpacity
|
|
323
331
|
{...rest}
|
|
324
|
-
{...
|
|
332
|
+
{...selfAccessibilityID}
|
|
325
333
|
activeOpacity={activeOpacity}
|
|
326
334
|
onPress={onPressButton}
|
|
327
335
|
style={buttonStyle}>
|
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/Image/index.tsx
CHANGED
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,6 +122,11 @@ const Input = forwardRef(
|
|
|
121
122
|
placeholderColor = disabledColor;
|
|
122
123
|
iconTintColor = disabledColor;
|
|
123
124
|
}
|
|
125
|
+
const accessibilityID = getAccessibilityID?.(
|
|
126
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
127
|
+
disabled && '_disabled'
|
|
128
|
+
}`,
|
|
129
|
+
);
|
|
124
130
|
|
|
125
131
|
return (
|
|
126
132
|
<View
|
|
@@ -149,6 +155,7 @@ const Input = forwardRef(
|
|
|
149
155
|
)}
|
|
150
156
|
<TextInput
|
|
151
157
|
{...props}
|
|
158
|
+
{...accessibilityID}
|
|
152
159
|
editable={!disabled}
|
|
153
160
|
secureTextEntry={secure}
|
|
154
161
|
textAlignVertical="center"
|
|
@@ -202,8 +209,6 @@ const Input = forwardRef(
|
|
|
202
209
|
inputState = 'disabled';
|
|
203
210
|
}
|
|
204
211
|
|
|
205
|
-
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
206
|
-
|
|
207
212
|
return (
|
|
208
213
|
<ScreenContext.Provider
|
|
209
214
|
value={{
|
|
@@ -214,7 +219,7 @@ const Input = forwardRef(
|
|
|
214
219
|
state: inputState,
|
|
215
220
|
componentId,
|
|
216
221
|
}}>
|
|
217
|
-
<View
|
|
222
|
+
<View style={[style, styles.wrapper]}>
|
|
218
223
|
{renderInputView()}
|
|
219
224
|
<ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
|
|
220
225
|
</View>
|
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,6 +61,11 @@ const InputDropDown = ({
|
|
|
60
61
|
placeholderColor = disabledColor;
|
|
61
62
|
iconTintColor = disabledColor;
|
|
62
63
|
}
|
|
64
|
+
const accessibilityID = getAccessibilityID?.(
|
|
65
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
66
|
+
disabled && '_disabled'
|
|
67
|
+
}`,
|
|
68
|
+
);
|
|
63
69
|
|
|
64
70
|
return (
|
|
65
71
|
<View
|
|
@@ -89,6 +95,7 @@ const InputDropDown = ({
|
|
|
89
95
|
{full && (
|
|
90
96
|
<TextInput
|
|
91
97
|
{...props}
|
|
98
|
+
{...accessibilityID}
|
|
92
99
|
onPressIn={onPress}
|
|
93
100
|
editable={false}
|
|
94
101
|
textAlignVertical="top"
|
|
@@ -112,9 +119,6 @@ const InputDropDown = ({
|
|
|
112
119
|
);
|
|
113
120
|
};
|
|
114
121
|
|
|
115
|
-
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
116
|
-
|
|
117
|
-
|
|
118
122
|
return (
|
|
119
123
|
<ScreenContext.Provider
|
|
120
124
|
value={{
|
|
@@ -126,7 +130,6 @@ const InputDropDown = ({
|
|
|
126
130
|
componentId,
|
|
127
131
|
}}>
|
|
128
132
|
<TouchableOpacity
|
|
129
|
-
{...accessibilityID}
|
|
130
133
|
onPress={onPress}
|
|
131
134
|
style={[style, full && styles.wrapper]}>
|
|
132
135
|
{renderInputView()}
|
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,6 +105,11 @@ const InputMoney = forwardRef(
|
|
|
104
105
|
placeholderColor = disabledColor;
|
|
105
106
|
iconTintColor = disabledColor;
|
|
106
107
|
}
|
|
108
|
+
const accessibilityID = getAccessibilityID?.(
|
|
109
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
110
|
+
disabled && '_disabled'
|
|
111
|
+
}`,
|
|
112
|
+
);
|
|
107
113
|
|
|
108
114
|
return (
|
|
109
115
|
<View
|
|
@@ -123,6 +129,7 @@ const InputMoney = forwardRef(
|
|
|
123
129
|
<View style={styles.inputView}>
|
|
124
130
|
<TextInput
|
|
125
131
|
{...props}
|
|
132
|
+
{...accessibilityID}
|
|
126
133
|
editable={!disabled}
|
|
127
134
|
textAlignVertical="top"
|
|
128
135
|
ref={inputRef}
|
|
@@ -173,8 +180,6 @@ const InputMoney = forwardRef(
|
|
|
173
180
|
inputState = 'disabled';
|
|
174
181
|
}
|
|
175
182
|
|
|
176
|
-
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
177
|
-
|
|
178
183
|
return (
|
|
179
184
|
<ScreenContext.Provider
|
|
180
185
|
value={{
|
|
@@ -185,9 +190,7 @@ const InputMoney = forwardRef(
|
|
|
185
190
|
state: inputState,
|
|
186
191
|
componentId,
|
|
187
192
|
}}>
|
|
188
|
-
<View
|
|
189
|
-
{...accessibilityID}
|
|
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,6 +191,9 @@ const InputOTP = forwardRef(
|
|
|
191
191
|
);
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
+
const accessibilityID = getAccessibilityID?.(
|
|
195
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}`,
|
|
196
|
+
);
|
|
194
197
|
const renderInputView = () => {
|
|
195
198
|
return (
|
|
196
199
|
<View
|
|
@@ -216,6 +219,7 @@ const InputOTP = forwardRef(
|
|
|
216
219
|
<View style={styles.inputView}>
|
|
217
220
|
<TextInput
|
|
218
221
|
{...props}
|
|
222
|
+
{...accessibilityID}
|
|
219
223
|
ref={inputRef}
|
|
220
224
|
value={value}
|
|
221
225
|
onChangeText={_onChangeText}
|
|
@@ -230,7 +234,6 @@ const InputOTP = forwardRef(
|
|
|
230
234
|
</View>
|
|
231
235
|
);
|
|
232
236
|
};
|
|
233
|
-
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
234
237
|
|
|
235
238
|
return (
|
|
236
239
|
<ScreenContext.Provider
|
|
@@ -243,7 +246,6 @@ const InputOTP = forwardRef(
|
|
|
243
246
|
componentId,
|
|
244
247
|
}}>
|
|
245
248
|
<TouchableOpacity
|
|
246
|
-
{...accessibilityID}
|
|
247
249
|
activeOpacity={1}
|
|
248
250
|
onPress={onFocusInput}
|
|
249
251
|
style={[style, styles.otpWrapper]}>
|
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,11 +67,15 @@ const InputSearch = forwardRef(
|
|
|
66
67
|
checkTyping(text, haveValue, setHaveValue);
|
|
67
68
|
onChangeText?.(text);
|
|
68
69
|
};
|
|
70
|
+
const accessibilityID = getAccessibilityID?.(
|
|
71
|
+
`${appId}/${screenInfo.screenName}/input_search`,
|
|
72
|
+
);
|
|
69
73
|
|
|
70
74
|
const renderInputView = () => {
|
|
71
75
|
return (
|
|
72
76
|
<TextInput
|
|
73
77
|
{...props}
|
|
78
|
+
{...accessibilityID}
|
|
74
79
|
textAlignVertical="center"
|
|
75
80
|
ref={inputRef}
|
|
76
81
|
style={[
|
|
@@ -139,11 +144,9 @@ const InputSearch = forwardRef(
|
|
|
139
144
|
const backgroundColor = hasColorBG
|
|
140
145
|
? theme.colors.background.default
|
|
141
146
|
: theme.colors.background.surface;
|
|
142
|
-
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_search`)
|
|
143
147
|
|
|
144
148
|
return (
|
|
145
149
|
<ScreenContext.Provider
|
|
146
|
-
{...accessibilityID}
|
|
147
150
|
value={{
|
|
148
151
|
...screenInfo,
|
|
149
152
|
componentName: 'InputSearch',
|
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,6 +95,11 @@ const InputTextArea = forwardRef(
|
|
|
94
95
|
textColor = disabledColor;
|
|
95
96
|
placeholderColor = disabledColor;
|
|
96
97
|
}
|
|
98
|
+
const accessibilityID = getAccessibilityID?.(
|
|
99
|
+
`${appId}/${screenInfo.screenName}/input_${floatingValue}${
|
|
100
|
+
disabled && '_disabled'
|
|
101
|
+
}`,
|
|
102
|
+
);
|
|
97
103
|
|
|
98
104
|
return (
|
|
99
105
|
<View
|
|
@@ -116,6 +122,7 @@ const InputTextArea = forwardRef(
|
|
|
116
122
|
<View style={styles.textAreaView}>
|
|
117
123
|
<TextInput
|
|
118
124
|
{...props}
|
|
125
|
+
{...accessibilityID}
|
|
119
126
|
ref={inputRef}
|
|
120
127
|
editable={!disabled}
|
|
121
128
|
textAlignVertical="top"
|
|
@@ -153,12 +160,9 @@ const InputTextArea = forwardRef(
|
|
|
153
160
|
</View>
|
|
154
161
|
);
|
|
155
162
|
};
|
|
156
|
-
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
|
|
157
163
|
|
|
158
164
|
return (
|
|
159
|
-
<View
|
|
160
|
-
{...accessibilityID}
|
|
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/Input/styles.ts
CHANGED
|
@@ -7,7 +7,7 @@ export default StyleSheet.create({
|
|
|
7
7
|
input: {
|
|
8
8
|
flex: 1,
|
|
9
9
|
paddingLeft: Spacing.M,
|
|
10
|
-
fontSize: scaleSize(
|
|
10
|
+
fontSize: scaleSize(14),
|
|
11
11
|
},
|
|
12
12
|
wrapper: {
|
|
13
13
|
width: '100%',
|
|
@@ -75,7 +75,7 @@ export default StyleSheet.create({
|
|
|
75
75
|
flex: 1,
|
|
76
76
|
paddingRight: Spacing.XS,
|
|
77
77
|
paddingVertical: Spacing.XS,
|
|
78
|
-
fontSize: scaleSize(
|
|
78
|
+
fontSize: scaleSize(14),
|
|
79
79
|
},
|
|
80
80
|
textAreaWrapper: {
|
|
81
81
|
borderWidth: 1,
|
|
@@ -108,7 +108,7 @@ export default StyleSheet.create({
|
|
|
108
108
|
height: 36,
|
|
109
109
|
marginLeft: Spacing.S,
|
|
110
110
|
flex: 1,
|
|
111
|
-
fontSize: scaleSize(
|
|
111
|
+
fontSize: scaleSize(14),
|
|
112
112
|
paddingVertical: Spacing.XS,
|
|
113
113
|
},
|
|
114
114
|
searchInputView: {
|