@momo-kits/foundation 0.150.2-phuc.13 → 0.150.2-scaleSize.35
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/BottomSheet.tsx +39 -114
- package/Application/BottomTab/Badge.tsx +15 -2
- package/Application/BottomTab/BottomTabBar.tsx +1 -1
- package/Application/BottomTab/CustomBottomTabItem.tsx +5 -3
- package/Application/BottomTab/TabBarIcon.tsx +8 -6
- package/Application/BottomTab/index.tsx +82 -87
- package/Application/Components/BackgroundImageView.tsx +1 -1
- package/Application/Components/HeaderAnimated.tsx +12 -11
- package/Application/Components/HeaderBackground.tsx +1 -1
- package/Application/Components/HeaderExtendHeader.tsx +31 -26
- package/Application/Components/HeaderLeft.tsx +2 -2
- package/Application/Components/HeaderRight.tsx +24 -20
- package/Application/Components/HeaderTitle.tsx +19 -7
- package/Application/Components/NavigationButton.tsx +12 -11
- package/Application/Components/SearchHeader.tsx +20 -3
- package/Application/ModalScreen.tsx +14 -1
- package/Application/NavigationContainer.tsx +13 -7
- package/Application/StackScreen.tsx +100 -155
- package/Application/WidgetContainer.tsx +1 -1
- package/Application/index.ts +12 -31
- package/Application/types.ts +66 -18
- package/Application/utils.tsx +41 -17
- package/Assets/language.json +6 -2
- package/Assets/lottie_circle_loader.json +1 -0
- package/Badge/Badge.tsx +14 -11
- package/Badge/BadgeRibbon.tsx +1 -1
- package/Button/index.tsx +47 -32
- package/CheckBox/index.tsx +23 -19
- package/CheckBox/styles.ts +1 -0
- package/Context/index.ts +23 -0
- package/Divider/DashDivider.tsx +10 -9
- package/Divider/index.tsx +7 -7
- package/FoundationList/index.tsx +7 -4
- package/Icon/index.tsx +9 -9
- package/IconButton/index.tsx +12 -10
- package/Image/index.tsx +9 -2
- package/Input/Input.tsx +3 -5
- package/Input/InputDropDown.tsx +31 -23
- package/Input/InputMoney.tsx +3 -5
- package/Input/InputOTP.tsx +7 -7
- package/Input/InputPhoneNumber.tsx +271 -0
- package/Input/InputSearch.tsx +3 -5
- package/Input/InputTextArea.tsx +2 -1
- package/Input/TextTyping.tsx +8 -2
- package/Input/common.tsx +31 -24
- package/Input/index.tsx +21 -1
- package/Input/styles.ts +17 -12
- package/Input/utils.ts +42 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +1 -1
- package/Layout/GridSystem.tsx +15 -14
- package/Layout/Item.tsx +1 -1
- package/Layout/Screen.tsx +8 -5
- package/Layout/Section.tsx +1 -1
- package/Layout/TrackingScope.tsx +3 -3
- package/Loader/DotLoader.tsx +7 -7
- package/Loader/ProgressBar.tsx +10 -9
- package/Loader/Spinner.tsx +7 -7
- package/Pagination/Dot.tsx +10 -7
- package/Pagination/PaginationDot.tsx +8 -8
- package/Pagination/PaginationScroll.tsx +12 -10
- package/Popup/PopupNotify.tsx +2 -2
- package/Popup/PopupPromotion.tsx +1 -1
- package/Radio/index.tsx +18 -18
- package/Skeleton/index.tsx +1 -1
- package/Switch/index.tsx +17 -12
- package/Text/index.tsx +4 -4
- package/Text/styles.ts +37 -36
- package/Text/types.ts +1 -0
- package/Text/utils.ts +33 -4
- package/Title/index.tsx +48 -29
- package/index.ts +1 -0
- package/package.json +35 -34
- package/Application/Components/index.ts +0 -7
package/Switch/index.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, {FC} from 'react';
|
|
2
|
-
import {TouchableOpacity, View} from 'react-native';
|
|
3
|
-
import {SwitchProps} from './types';
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { SwitchProps } from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {Colors} from '../Consts';
|
|
6
|
-
import {
|
|
5
|
+
import { Colors } from '../Consts';
|
|
6
|
+
import { useComponentId } from '../Application';
|
|
7
|
+
import { ComponentContext } from '../Context';
|
|
7
8
|
|
|
8
9
|
const Switch: FC<SwitchProps> = ({
|
|
9
10
|
value = false,
|
|
@@ -18,7 +19,7 @@ const Switch: FC<SwitchProps> = ({
|
|
|
18
19
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
19
20
|
const componentName = 'Switch';
|
|
20
21
|
|
|
21
|
-
const {componentId} = useComponentId(componentName, accessibilityLabel);
|
|
22
|
+
const { componentId } = useComponentId(componentName, accessibilityLabel);
|
|
22
23
|
|
|
23
24
|
let backgroundColor = value ? Colors.green_03 : Colors.black_07;
|
|
24
25
|
if (disabled) {
|
|
@@ -32,7 +33,8 @@ const Switch: FC<SwitchProps> = ({
|
|
|
32
33
|
params,
|
|
33
34
|
state: disabled ? 'disabled' : 'enabled',
|
|
34
35
|
action: 'click',
|
|
35
|
-
}}
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
36
38
|
<TouchableOpacity
|
|
37
39
|
{...props}
|
|
38
40
|
disabled={disabled}
|
|
@@ -46,14 +48,17 @@ const Switch: FC<SwitchProps> = ({
|
|
|
46
48
|
style={[
|
|
47
49
|
style,
|
|
48
50
|
styles.container,
|
|
49
|
-
{backgroundColor, alignItems: circleAlign},
|
|
50
|
-
]}
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
{ backgroundColor, alignItems: circleAlign },
|
|
52
|
+
]}
|
|
53
|
+
>
|
|
54
|
+
<View
|
|
55
|
+
style={[styles.circle, { backgroundColor: circleBackgroundColor }]}
|
|
56
|
+
>
|
|
57
|
+
<View style={[styles.circleSmall, { backgroundColor }]} />
|
|
53
58
|
</View>
|
|
54
59
|
</TouchableOpacity>
|
|
55
60
|
</ComponentContext.Provider>
|
|
56
61
|
);
|
|
57
62
|
};
|
|
58
63
|
|
|
59
|
-
export {Switch};
|
|
64
|
+
export { Switch };
|
package/Text/index.tsx
CHANGED
|
@@ -2,8 +2,8 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import { Text as RNText, TextProps as RNTextProps, View } from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
4
|
import { Typography, TypographyWeight } from './types';
|
|
5
|
-
import { ApplicationContext, SkeletonContext } from '../
|
|
6
|
-
import { scaleSize } from './utils';
|
|
5
|
+
import { ApplicationContext, SkeletonContext } from '../Context';
|
|
6
|
+
import { scaleSize, useScaleSize } from './utils';
|
|
7
7
|
import { Skeleton } from '../Skeleton';
|
|
8
8
|
|
|
9
9
|
const SFProText: TypographyWeight = {
|
|
@@ -110,8 +110,8 @@ const TypoStyles = (typo: Typography, newFontFamily?: string) => {
|
|
|
110
110
|
return {
|
|
111
111
|
...typoStyle,
|
|
112
112
|
fontFamily,
|
|
113
|
-
fontSize:
|
|
114
|
-
lineHeight:
|
|
113
|
+
fontSize: useScaleSize(fontSize),
|
|
114
|
+
lineHeight: useScaleSize(lineHeight),
|
|
115
115
|
fontStyle,
|
|
116
116
|
fontWeight,
|
|
117
117
|
};
|
package/Text/styles.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
headline_l_bold: { fontSize: 28, lineHeight: 40, fontWeight: '700' },
|
|
3
|
+
headline_default_bold: { fontSize: 24, lineHeight: 34, fontWeight: '700' },
|
|
4
|
+
header_m_bold: { fontSize: 18, lineHeight: 26, fontWeight: '700' },
|
|
5
|
+
header_default_bold: { fontSize: 16, lineHeight: 22, fontWeight: '700' },
|
|
6
|
+
header_s_semibold: { fontSize: 14, lineHeight: 20, fontWeight: '600' },
|
|
7
|
+
header_xs_semibold: { fontSize: 12, lineHeight: 18, fontWeight: '600' },
|
|
8
|
+
body_default_regular: { fontSize: 14, lineHeight: 20, fontWeight: '400' },
|
|
8
9
|
body_default_regularstrikethrought: {
|
|
9
10
|
fontSize: 14,
|
|
10
11
|
lineHeight: 20,
|
|
@@ -22,52 +23,52 @@ export default {
|
|
|
22
23
|
fontWeight: '400',
|
|
23
24
|
textDecorationLine: 'line-through',
|
|
24
25
|
},
|
|
25
|
-
description_xs_regular: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
|
|
26
|
+
description_xs_regular: { fontSize: 10, lineHeight: 14, fontWeight: '400' },
|
|
26
27
|
description_xs_regularstrikethrought: {
|
|
27
28
|
fontSize: 10,
|
|
28
29
|
lineHeight: 14,
|
|
29
30
|
fontWeight: '400',
|
|
30
31
|
textDecorationLine: 'line-through',
|
|
31
32
|
},
|
|
32
|
-
label_default_medium: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
|
|
33
|
-
label_s_medium: {fontSize: 12, lineHeight: 18, fontWeight: '500'},
|
|
34
|
-
label_xs_medium: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
|
|
35
|
-
action_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
36
|
-
action_s_bold: {fontSize: 14, lineHeight: 20, fontWeight: '700'},
|
|
37
|
-
action_xs_bold: {fontSize: 12, lineHeight: 18, fontWeight: '700'},
|
|
38
|
-
action_xxs_bold: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
|
|
33
|
+
label_default_medium: { fontSize: 14, lineHeight: 20, fontWeight: '500' },
|
|
34
|
+
label_s_medium: { fontSize: 12, lineHeight: 18, fontWeight: '500' },
|
|
35
|
+
label_xs_medium: { fontSize: 10, lineHeight: 14, fontWeight: '500' },
|
|
36
|
+
action_default_bold: { fontSize: 16, lineHeight: 22, fontWeight: '700' },
|
|
37
|
+
action_s_bold: { fontSize: 14, lineHeight: 20, fontWeight: '700' },
|
|
38
|
+
action_xs_bold: { fontSize: 12, lineHeight: 18, fontWeight: '700' },
|
|
39
|
+
action_xxs_bold: { fontSize: 10, lineHeight: 14, fontWeight: '700' },
|
|
39
40
|
/**non-support**/
|
|
40
41
|
headline_default: {
|
|
41
42
|
fontSize: 28,
|
|
42
43
|
lineHeight: 34,
|
|
43
44
|
fontWeight: '600',
|
|
44
45
|
},
|
|
45
|
-
headline_s: {fontSize: 24, lineHeight: 32, fontWeight: '600'},
|
|
46
|
-
headline_l: {fontSize: 32, lineHeight: 36, fontWeight: '600'},
|
|
47
|
-
headline_xl: {fontSize: 36, lineHeight: 44, fontWeight: '600'},
|
|
48
|
-
title_default: {fontSize: 20, lineHeight: 28, fontWeight: '700'},
|
|
49
|
-
title_xs: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
50
|
-
title_s: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
|
|
51
|
-
header_default: {fontSize: 15, lineHeight: 22, fontWeight: '600'},
|
|
52
|
-
header_xs: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
|
|
53
|
-
header_s: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
|
|
54
|
-
paragraph_default: {fontSize: 15, lineHeight: 22, fontWeight: '400'},
|
|
55
|
-
paragraph_bold: {fontSize: 15, lineHeight: 22, fontWeight: '700'},
|
|
46
|
+
headline_s: { fontSize: 24, lineHeight: 32, fontWeight: '600' },
|
|
47
|
+
headline_l: { fontSize: 32, lineHeight: 36, fontWeight: '600' },
|
|
48
|
+
headline_xl: { fontSize: 36, lineHeight: 44, fontWeight: '600' },
|
|
49
|
+
title_default: { fontSize: 20, lineHeight: 28, fontWeight: '700' },
|
|
50
|
+
title_xs: { fontSize: 16, lineHeight: 22, fontWeight: '700' },
|
|
51
|
+
title_s: { fontSize: 18, lineHeight: 28, fontWeight: '700' },
|
|
52
|
+
header_default: { fontSize: 15, lineHeight: 22, fontWeight: '600' },
|
|
53
|
+
header_xs: { fontSize: 12, lineHeight: 16, fontWeight: '600' },
|
|
54
|
+
header_s: { fontSize: 14, lineHeight: 20, fontWeight: '600' },
|
|
55
|
+
paragraph_default: { fontSize: 15, lineHeight: 22, fontWeight: '400' },
|
|
56
|
+
paragraph_bold: { fontSize: 15, lineHeight: 22, fontWeight: '700' },
|
|
56
57
|
paragraph_italic: {
|
|
57
58
|
fontSize: 15,
|
|
58
59
|
lineHeight: 22,
|
|
59
60
|
fontWeight: '400',
|
|
60
61
|
fontStyle: 'italic',
|
|
61
62
|
},
|
|
62
|
-
description_default: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
|
|
63
|
-
description_xs: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
|
|
64
|
-
description_s: {fontSize: 12, lineHeight: 16, fontWeight: '400'},
|
|
65
|
-
label_default: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
|
|
66
|
-
label_xxs: {fontSize: 8, lineHeight: 12, fontWeight: '500'},
|
|
67
|
-
label_xs: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
|
|
68
|
-
label_s: {fontSize: 12, lineHeight: 16, fontWeight: '500'},
|
|
69
|
-
action_default: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
70
|
-
action_xxs: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
|
|
71
|
-
action_xs: {fontSize: 12, lineHeight: 16, fontWeight: '700'},
|
|
72
|
-
action_s: {fontSize: 15, lineHeight: 22, fontWeight: '700'},
|
|
63
|
+
description_default: { fontSize: 14, lineHeight: 20, fontWeight: '400' },
|
|
64
|
+
description_xs: { fontSize: 10, lineHeight: 14, fontWeight: '400' },
|
|
65
|
+
description_s: { fontSize: 12, lineHeight: 16, fontWeight: '400' },
|
|
66
|
+
label_default: { fontSize: 14, lineHeight: 20, fontWeight: '500' },
|
|
67
|
+
label_xxs: { fontSize: 8, lineHeight: 12, fontWeight: '500' },
|
|
68
|
+
label_xs: { fontSize: 10, lineHeight: 14, fontWeight: '500' },
|
|
69
|
+
label_s: { fontSize: 12, lineHeight: 16, fontWeight: '500' },
|
|
70
|
+
action_default: { fontSize: 16, lineHeight: 22, fontWeight: '700' },
|
|
71
|
+
action_xxs: { fontSize: 10, lineHeight: 14, fontWeight: '700' },
|
|
72
|
+
action_xs: { fontSize: 12, lineHeight: 16, fontWeight: '700' },
|
|
73
|
+
action_s: { fontSize: 15, lineHeight: 22, fontWeight: '700' },
|
|
73
74
|
};
|
package/Text/types.ts
CHANGED
package/Text/utils.ts
CHANGED
|
@@ -1,31 +1,60 @@
|
|
|
1
|
-
import {Dimensions, PixelRatio} from 'react-native';
|
|
1
|
+
import { Dimensions, PixelRatio } from 'react-native';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { MiniAppContext } from '../Context';
|
|
2
4
|
|
|
3
5
|
const deviceWidth = Dimensions.get('window').width;
|
|
4
6
|
const DEFAULT_SCREEN_SIZE = 375;
|
|
5
7
|
const MAX_FONT_SCALE = 1.5;
|
|
6
8
|
const MAX_DEVICE_SCALE = 5;
|
|
7
9
|
|
|
10
|
+
const useScaleSize = (size: number) => {
|
|
11
|
+
const context = useContext<any>(MiniAppContext);
|
|
12
|
+
const fontScale = PixelRatio.getFontScale();
|
|
13
|
+
const deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE;
|
|
14
|
+
const maxScaleRate = context?.features?.scaleSizeMaxRate || MAX_FONT_SCALE;
|
|
15
|
+
|
|
16
|
+
let fontSizeDeviceScale = size;
|
|
17
|
+
let fontSizeOSScale = size;
|
|
18
|
+
|
|
19
|
+
if (deviceScale > 1) {
|
|
20
|
+
fontSizeDeviceScale = Math.min(
|
|
21
|
+
fontSizeDeviceScale * deviceScale,
|
|
22
|
+
fontSizeDeviceScale + maxScaleRate,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (fontScale > 1) {
|
|
27
|
+
fontSizeOSScale = Math.min(
|
|
28
|
+
fontSizeOSScale * fontScale,
|
|
29
|
+
fontSizeOSScale * maxScaleRate,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return Math.max(fontSizeDeviceScale, fontSizeOSScale);
|
|
34
|
+
};
|
|
35
|
+
|
|
8
36
|
const scaleSize = (size: number) => {
|
|
9
37
|
const fontScale = PixelRatio.getFontScale();
|
|
10
38
|
const deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE;
|
|
39
|
+
|
|
11
40
|
let fontSizeDeviceScale = size;
|
|
12
41
|
let fontSizeOSScale = size;
|
|
13
42
|
|
|
14
43
|
if (deviceScale > 1) {
|
|
15
44
|
fontSizeDeviceScale = Math.min(
|
|
16
45
|
fontSizeDeviceScale * deviceScale,
|
|
17
|
-
fontSizeDeviceScale + MAX_DEVICE_SCALE
|
|
46
|
+
fontSizeDeviceScale + MAX_DEVICE_SCALE,
|
|
18
47
|
);
|
|
19
48
|
}
|
|
20
49
|
|
|
21
50
|
if (fontScale > 1) {
|
|
22
51
|
fontSizeOSScale = Math.min(
|
|
23
52
|
fontSizeOSScale * fontScale,
|
|
24
|
-
fontSizeOSScale * MAX_FONT_SCALE
|
|
53
|
+
fontSizeOSScale * MAX_FONT_SCALE,
|
|
25
54
|
);
|
|
26
55
|
}
|
|
27
56
|
|
|
28
57
|
return Math.max(fontSizeDeviceScale, fontSizeOSScale);
|
|
29
58
|
};
|
|
30
59
|
|
|
31
|
-
export {scaleSize};
|
|
60
|
+
export { scaleSize, useScaleSize };
|
package/Title/index.tsx
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import React, {FC, useContext, useState} from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import React, { FC, useContext, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Text as RNText,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
View,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import { Icon } from '../Icon';
|
|
9
|
+
import { scaleSize, Text } from '../Text';
|
|
10
|
+
import { useComponentId } from '../Application';
|
|
11
|
+
import { ApplicationContext } from '../Context';
|
|
12
|
+
import { Badge } from '../Badge';
|
|
13
|
+
import { Colors } from '../Consts';
|
|
8
14
|
import styles from './styles';
|
|
9
|
-
import {TitleProps} from './types';
|
|
10
|
-
import {Typography} from '../Text/types';
|
|
15
|
+
import { TitleProps } from './types';
|
|
16
|
+
import { Typography } from '../Text/types';
|
|
11
17
|
|
|
12
18
|
const Title: FC<TitleProps> = ({
|
|
13
19
|
accessibilityLabel,
|
|
@@ -28,7 +34,7 @@ const Title: FC<TitleProps> = ({
|
|
|
28
34
|
textOnly = false,
|
|
29
35
|
style,
|
|
30
36
|
}) => {
|
|
31
|
-
const {theme} = useContext(ApplicationContext);
|
|
37
|
+
const { theme } = useContext(ApplicationContext);
|
|
32
38
|
const [badgeWidth, setBadgeWidth] = useState(0);
|
|
33
39
|
const [contentWidth, setContentWidth] = useState(0);
|
|
34
40
|
const styleSheet: {
|
|
@@ -39,10 +45,10 @@ const Title: FC<TitleProps> = ({
|
|
|
39
45
|
const numberOfLines = showTrailingAction || !!badgeLabel ? 1 : 2;
|
|
40
46
|
const buttonTypo: Typography =
|
|
41
47
|
buttonSize === 'small' ? 'action_xs_bold' : 'action_s_bold';
|
|
42
|
-
const flexStyle: ViewStyle = showTrailingAction ? {maxWidth: '95%'} : {};
|
|
48
|
+
const flexStyle: ViewStyle = showTrailingAction ? { maxWidth: '95%' } : {};
|
|
43
49
|
const componentName = 'Title';
|
|
44
50
|
|
|
45
|
-
const {componentId} = useComponentId(
|
|
51
|
+
const { componentId } = useComponentId(
|
|
46
52
|
`${componentName}/${title}`,
|
|
47
53
|
accessibilityLabel,
|
|
48
54
|
);
|
|
@@ -55,17 +61,18 @@ const Title: FC<TitleProps> = ({
|
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
if (iconAlign === 'middle') {
|
|
58
|
-
iconStyle = {justifyContent: 'center'};
|
|
64
|
+
iconStyle = { justifyContent: 'center' };
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
if (iconAlign === 'bottom') {
|
|
62
|
-
iconStyle = {justifyContent: 'flex-end'};
|
|
68
|
+
iconStyle = { justifyContent: 'flex-end' };
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
return (
|
|
66
72
|
<View
|
|
67
73
|
accessibilityLabel={componentId + '|icon'}
|
|
68
|
-
style={[styles.iconView, iconStyle]}
|
|
74
|
+
style={[styles.iconView, iconStyle]}
|
|
75
|
+
>
|
|
69
76
|
<Icon color={iconColor} source={icon} />
|
|
70
77
|
</View>
|
|
71
78
|
);
|
|
@@ -80,7 +87,8 @@ const Title: FC<TitleProps> = ({
|
|
|
80
87
|
setContentWidth(e.nativeEvent.layout.width);
|
|
81
88
|
}
|
|
82
89
|
}}
|
|
83
|
-
style={[styles.iconLeftView, flexStyle]}
|
|
90
|
+
style={[styles.iconLeftView, flexStyle]}
|
|
91
|
+
>
|
|
84
92
|
<RNText
|
|
85
93
|
accessibilityLabel={componentId + '|title-text'}
|
|
86
94
|
numberOfLines={numberOfLines}
|
|
@@ -91,7 +99,8 @@ const Title: FC<TitleProps> = ({
|
|
|
91
99
|
maxWidth:
|
|
92
100
|
contentWidth > 0 ? contentWidth - badgeWidth : undefined,
|
|
93
101
|
},
|
|
94
|
-
]}
|
|
102
|
+
]}
|
|
103
|
+
>
|
|
95
104
|
{title}
|
|
96
105
|
</RNText>
|
|
97
106
|
{badgeLabel && (
|
|
@@ -103,7 +112,8 @@ const Title: FC<TitleProps> = ({
|
|
|
103
112
|
}}
|
|
104
113
|
style={{
|
|
105
114
|
alignItems: 'center',
|
|
106
|
-
}}
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
107
117
|
<Badge
|
|
108
118
|
style={styles.badge}
|
|
109
119
|
label={badgeLabel}
|
|
@@ -118,7 +128,8 @@ const Title: FC<TitleProps> = ({
|
|
|
118
128
|
accessibilityLabel={componentId + '|description-text'}
|
|
119
129
|
style={styles.description}
|
|
120
130
|
color={theme.colors.text.secondary}
|
|
121
|
-
typography={'description_default_regular'}
|
|
131
|
+
typography={'description_default_regular'}
|
|
132
|
+
>
|
|
122
133
|
{description}
|
|
123
134
|
</Text>
|
|
124
135
|
)}
|
|
@@ -132,7 +143,8 @@ const Title: FC<TitleProps> = ({
|
|
|
132
143
|
accessibilityLabel={componentId + '|trailing-touch'}
|
|
133
144
|
onPress={onPressTrailingAction}
|
|
134
145
|
style={styles.iconLeftView}
|
|
135
|
-
hitSlop={{top: 10, bottom: 10, left: 50, right: 10}}
|
|
146
|
+
hitSlop={{ top: 10, bottom: 10, left: 50, right: 10 }}
|
|
147
|
+
>
|
|
136
148
|
{showTrailingAction && !showRightAction && (
|
|
137
149
|
<View
|
|
138
150
|
style={[
|
|
@@ -142,7 +154,8 @@ const Title: FC<TitleProps> = ({
|
|
|
142
154
|
? Colors.black_06 + '99'
|
|
143
155
|
: Colors.black_06 + '4D',
|
|
144
156
|
},
|
|
145
|
-
]}
|
|
157
|
+
]}
|
|
158
|
+
>
|
|
146
159
|
<Icon
|
|
147
160
|
source={'arrow_chevron_right_small'}
|
|
148
161
|
size={scaleSize(18)}
|
|
@@ -164,7 +177,8 @@ const Title: FC<TitleProps> = ({
|
|
|
164
177
|
style={{
|
|
165
178
|
height: lineHeight,
|
|
166
179
|
justifyContent: 'center',
|
|
167
|
-
}}
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
168
182
|
{!buttonTitle ? (
|
|
169
183
|
<TouchableOpacity
|
|
170
184
|
onPress={onPressRightAction}
|
|
@@ -174,7 +188,8 @@ const Title: FC<TitleProps> = ({
|
|
|
174
188
|
backgroundColor: theme.colors.primary + '0F',
|
|
175
189
|
},
|
|
176
190
|
]}
|
|
177
|
-
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
191
|
+
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
192
|
+
>
|
|
178
193
|
<Icon
|
|
179
194
|
source={'arrow_chevron_right_small'}
|
|
180
195
|
size={scaleSize(22)}
|
|
@@ -184,11 +199,13 @@ const Title: FC<TitleProps> = ({
|
|
|
184
199
|
) : (
|
|
185
200
|
<TouchableOpacity
|
|
186
201
|
onPress={onPressRightAction}
|
|
187
|
-
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
202
|
+
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
203
|
+
>
|
|
188
204
|
<Text
|
|
189
205
|
color={theme.colors.primary}
|
|
190
206
|
typography={buttonTypo}
|
|
191
|
-
accessibilityLabel={componentId + '|label-right-action-text'}
|
|
207
|
+
accessibilityLabel={componentId + '|label-right-action-text'}
|
|
208
|
+
>
|
|
192
209
|
{buttonTitle}
|
|
193
210
|
</Text>
|
|
194
211
|
</TouchableOpacity>
|
|
@@ -203,7 +220,8 @@ const Title: FC<TitleProps> = ({
|
|
|
203
220
|
<RNText
|
|
204
221
|
accessibilityLabel={componentId + '|title-text'}
|
|
205
222
|
numberOfLines={numberOfLines}
|
|
206
|
-
style={[styleSheet[typography], styles.title]}
|
|
223
|
+
style={[styleSheet[typography], styles.title]}
|
|
224
|
+
>
|
|
207
225
|
{title}
|
|
208
226
|
</RNText>
|
|
209
227
|
</View>
|
|
@@ -213,7 +231,8 @@ const Title: FC<TitleProps> = ({
|
|
|
213
231
|
return (
|
|
214
232
|
<View
|
|
215
233
|
style={[style, styles.wrapper, isSection && styles.margin]}
|
|
216
|
-
accessibilityLabel={componentId}
|
|
234
|
+
accessibilityLabel={componentId}
|
|
235
|
+
>
|
|
217
236
|
{renderIcon()}
|
|
218
237
|
{renderContent()}
|
|
219
238
|
{renderActionRight()}
|
|
@@ -221,5 +240,5 @@ const Title: FC<TitleProps> = ({
|
|
|
221
240
|
);
|
|
222
241
|
};
|
|
223
242
|
|
|
224
|
-
export {Title};
|
|
225
|
-
export type {TitleProps};
|
|
243
|
+
export { Title };
|
|
244
|
+
export type { TitleProps };
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
"name": "@momo-kits/foundation",
|
|
3
|
+
"version": "0.150.2-scaleSize.35",
|
|
4
|
+
"description": "React Native Component Kits",
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"scripts": {},
|
|
7
|
+
"keywords": [
|
|
8
|
+
"@momo-kits/foundation"
|
|
9
|
+
],
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"react-native-fast-image": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
|
|
12
|
+
"@react-navigation/bottom-tabs": "7.4.2",
|
|
13
|
+
"@react-navigation/core": "7.12.1",
|
|
14
|
+
"@react-navigation/elements": "2.5.2",
|
|
15
|
+
"@react-navigation/native": "7.1.14",
|
|
16
|
+
"@react-navigation/routers": "7.4.1",
|
|
17
|
+
"@react-navigation/stack": "7.4.2",
|
|
18
|
+
"react-native-gesture-handler": "2.27.1",
|
|
19
|
+
"react-native-linear-gradient": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
|
|
20
|
+
"react-native-reanimated": "4.1.0",
|
|
21
|
+
"react-native-safe-area-context": "5.5.2",
|
|
22
|
+
"@shopify/flash-list": "2.1.0",
|
|
23
|
+
"lottie-react-native": "7.2.4"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"react-native": "*"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@momo-platform/versions": "4.1.11",
|
|
30
|
+
"@types/color": "3.0.6"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"registry": "https://registry.npmjs.org/"
|
|
34
|
+
},
|
|
35
|
+
"license": "MoMo"
|
|
36
|
+
}
|