@momo-kits/foundation 0.92.2 → 0.92.3-tracking.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 -23
- package/Application/NavigationContainer.tsx +2 -7
- package/Application/StackScreen.tsx +70 -64
- package/Application/index.ts +8 -8
- package/Button/index.tsx +11 -31
- package/CheckBox/index.tsx +9 -31
- package/CheckBox/types.ts +4 -6
- package/Icon/index.tsx +8 -8
- package/IconButton/index.tsx +7 -19
- package/Image/index.tsx +15 -8
- package/Image/types.ts +1 -0
- package/Input/Input.tsx +7 -34
- package/Input/InputDropDown.tsx +7 -32
- package/Input/InputMoney.tsx +7 -30
- package/Input/InputOTP.tsx +7 -26
- package/Input/InputSearch.tsx +6 -17
- package/Input/InputTextArea.tsx +1 -23
- package/Input/index.tsx +1 -9
- package/Popup/PopupNotify.tsx +3 -6
- package/Popup/PopupPromotion.tsx +3 -10
- package/Radio/index.tsx +7 -25
- package/Radio/types.ts +4 -7
- package/Switch/index.tsx +14 -25
- package/Switch/types.ts +4 -6
- package/package.json +1 -1
package/Radio/index.tsx
CHANGED
|
@@ -4,18 +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, ComponentContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
|
-
import {
|
|
10
|
-
cleanNameForTracking,
|
|
11
|
-
formatNameLength,
|
|
12
|
-
getAccessibilityID,
|
|
13
|
-
} from '../Application/utils';
|
|
14
|
-
|
|
15
|
-
const {
|
|
16
|
-
ScreenContext,
|
|
17
|
-
MiniAppContext,
|
|
18
|
-
} = require('react-native/Libraries/Components/ScreenContext');
|
|
9
|
+
import {formatNameLength} from '../Application/utils';
|
|
19
10
|
|
|
20
11
|
const Radio: FC<RadioProps> = ({
|
|
21
12
|
value,
|
|
@@ -25,11 +16,9 @@ const Radio: FC<RadioProps> = ({
|
|
|
25
16
|
label,
|
|
26
17
|
style,
|
|
27
18
|
params,
|
|
28
|
-
|
|
19
|
+
accessibilityLabel,
|
|
29
20
|
}) => {
|
|
30
|
-
const {appId, code} = useContext<any>(MiniAppContext);
|
|
31
21
|
const {theme} = useContext(ApplicationContext);
|
|
32
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
33
22
|
const selected = value === groupValue;
|
|
34
23
|
let disabledStyle = {};
|
|
35
24
|
let checkBoxStyle = {
|
|
@@ -51,26 +40,19 @@ const Radio: FC<RadioProps> = ({
|
|
|
51
40
|
};
|
|
52
41
|
}
|
|
53
42
|
|
|
54
|
-
const accessibilityID = getAccessibilityID?.(
|
|
55
|
-
`${appId}/${code}/${screenInfo.screenName}/rdo_${cleanNameForTracking(
|
|
56
|
-
label,
|
|
57
|
-
)}_${selected}`,
|
|
58
|
-
);
|
|
59
|
-
|
|
60
43
|
return (
|
|
61
|
-
<
|
|
44
|
+
<ComponentContext.Provider
|
|
62
45
|
value={{
|
|
63
|
-
...screenInfo,
|
|
64
46
|
componentName: 'Button',
|
|
65
47
|
params,
|
|
66
48
|
state: disabled ? 'disabled' : 'enabled',
|
|
67
|
-
componentId,
|
|
49
|
+
componentId: accessibilityLabel,
|
|
68
50
|
componentLabel: formatNameLength(label || ''),
|
|
69
51
|
componentValue: value,
|
|
70
52
|
action: 'click',
|
|
71
53
|
}}>
|
|
72
54
|
<TouchableOpacity
|
|
73
|
-
{
|
|
55
|
+
accessibilityLabel={accessibilityLabel}
|
|
74
56
|
onPress={onChange}
|
|
75
57
|
disabled={disabled}
|
|
76
58
|
style={[
|
|
@@ -90,7 +72,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
90
72
|
/>
|
|
91
73
|
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
92
74
|
</TouchableOpacity>
|
|
93
|
-
</
|
|
75
|
+
</ComponentContext.Provider>
|
|
94
76
|
);
|
|
95
77
|
};
|
|
96
78
|
|
package/Radio/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {ViewStyle} from 'react-native';
|
|
1
|
+
import {TouchableOpacityProps, ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface RadioProps extends TouchableOpacityProps {
|
|
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,8 +36,5 @@ export type RadioProps = {
|
|
|
36
36
|
*/
|
|
37
37
|
style?: ViewStyle;
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
componentId?: string
|
|
43
|
-
};
|
|
39
|
+
params?: any;
|
|
40
|
+
}
|
package/Switch/index.tsx
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import React, {FC
|
|
1
|
+
import React, {FC} from 'react';
|
|
2
2
|
import {TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {SwitchProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {Colors} from '../Consts';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
ScreenContext,
|
|
10
|
-
MiniAppContext,
|
|
11
|
-
} = require('react-native/Libraries/Components/ScreenContext');
|
|
12
|
-
|
|
13
|
-
const Switch: FC<SwitchProps> = props => {
|
|
14
|
-
const {appId, code} = useContext<any>(MiniAppContext);
|
|
15
|
-
const {value, onChange, disabled, style, params, componentId} = props;
|
|
16
|
-
const screenInfo = useContext<any>(ScreenContext);
|
|
6
|
+
import {ComponentContext} from '../Application';
|
|
17
7
|
|
|
8
|
+
const Switch: FC<SwitchProps> = ({
|
|
9
|
+
value = false,
|
|
10
|
+
onChange,
|
|
11
|
+
disabled = false,
|
|
12
|
+
style,
|
|
13
|
+
params,
|
|
14
|
+
accessibilityLabel,
|
|
15
|
+
}) => {
|
|
18
16
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
19
17
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
20
18
|
|
|
@@ -23,24 +21,19 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
23
21
|
backgroundColor = value ? Colors.green_09 : Colors.black_05;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
const accessibilityID = getAccessibilityID?.(
|
|
27
|
-
`${appId}/${code}/${screenInfo.screenName}/swt_${value}`,
|
|
28
|
-
);
|
|
29
|
-
|
|
30
24
|
return (
|
|
31
|
-
<
|
|
25
|
+
<ComponentContext.Provider
|
|
32
26
|
value={{
|
|
33
|
-
...screenInfo,
|
|
34
27
|
componentName: 'Button',
|
|
35
28
|
params,
|
|
36
29
|
state: disabled ? 'disabled' : 'enabled',
|
|
37
|
-
componentId,
|
|
30
|
+
componentId: accessibilityLabel,
|
|
38
31
|
componentValue: value,
|
|
39
32
|
action: 'click',
|
|
40
33
|
}}>
|
|
41
34
|
<TouchableOpacity
|
|
42
|
-
{...accessibilityID}
|
|
43
35
|
disabled={disabled}
|
|
36
|
+
accessibilityLabel={accessibilityLabel}
|
|
44
37
|
onPress={() => onChange?.(!value)}
|
|
45
38
|
style={[
|
|
46
39
|
style,
|
|
@@ -51,12 +44,8 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
51
44
|
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
52
45
|
</View>
|
|
53
46
|
</TouchableOpacity>
|
|
54
|
-
</
|
|
47
|
+
</ComponentContext.Provider>
|
|
55
48
|
);
|
|
56
49
|
};
|
|
57
50
|
|
|
58
|
-
Switch.defaultProps = {
|
|
59
|
-
value: false,
|
|
60
|
-
disabled: false,
|
|
61
|
-
};
|
|
62
51
|
export {Switch};
|
package/Switch/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {ViewStyle} from 'react-native';
|
|
1
|
+
import {TouchableOpacityProps, ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface SwitchProps extends TouchableOpacityProps {
|
|
4
4
|
/**
|
|
5
5
|
* `value`: Represents whether the Switch component is currently in the 'on' (`true`) or 'off' (`false`) state.
|
|
6
6
|
*/
|
|
@@ -24,7 +24,5 @@ export type SwitchProps = {
|
|
|
24
24
|
*/
|
|
25
25
|
style?: ViewStyle;
|
|
26
26
|
|
|
27
|
-
params?: any
|
|
28
|
-
|
|
29
|
-
componentId?: string
|
|
30
|
-
};
|
|
27
|
+
params?: any;
|
|
28
|
+
}
|