@momo-kits/foundation 0.81.52 → 0.81.53-beta.0
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 +216 -0
- package/Application/BottomTab/BottomTabBar.tsx +278 -0
- package/Application/{BottomTab.tsx → BottomTab/index.tsx} +43 -18
- package/Application/Components.tsx +71 -53
- package/Application/ModalScreen.tsx +12 -183
- package/Application/Navigation.ts +2 -2
- package/Application/NavigationContainer.tsx +54 -53
- package/Application/Navigator.ts +53 -35
- package/Application/StackScreen.tsx +225 -30
- package/Application/index.ts +8 -12
- package/Application/types.ts +45 -27
- package/Application/utils.tsx +19 -15
- package/Assets/icon_bank.json +1 -1
- package/Badge/Badge.tsx +1 -1
- package/Button/index.tsx +44 -25
- package/CheckBox/index.tsx +37 -26
- package/CheckBox/types.ts +5 -3
- package/Consts/colors+spacing+radius.ts +14 -0
- package/Icon/index.tsx +9 -8
- package/Icon/types.ts +2 -2
- package/IconButton/index.tsx +24 -14
- package/Image/index.tsx +23 -8
- package/Image/types.ts +2 -0
- package/Input/Input.tsx +116 -26
- package/Input/InputDropDown.tsx +66 -51
- package/Input/InputMoney.tsx +106 -15
- package/Input/InputOTP.tsx +45 -22
- package/Input/InputSearch.tsx +92 -44
- package/Input/InputTextArea.tsx +26 -6
- package/Input/common.tsx +48 -22
- package/Input/index.tsx +94 -77
- package/Input/styles.ts +35 -5
- package/Input/utils.ts +1 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +168 -0
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +3 -2
- package/Layout/Screen.tsx +87 -49
- package/Layout/Section.tsx +4 -3
- package/Layout/styles.ts +11 -7
- package/Layout/utils.ts +4 -4
- package/Loader/index.tsx +2 -0
- package/Popup/PopupNotify.tsx +55 -44
- package/Popup/PopupPromotion.tsx +5 -7
- package/Popup/types.ts +1 -7
- package/Radio/index.tsx +35 -20
- package/Radio/types.ts +5 -3
- package/Switch/index.tsx +32 -18
- package/Switch/types.ts +5 -3
- package/Tag/styles.ts +3 -2
- package/Text/index.tsx +24 -5
- package/Text/styles.ts +8 -8
- package/Title/index.tsx +170 -103
- package/Title/styles.ts +36 -9
- package/Title/types.ts +16 -48
- package/code-scanner.js +125 -16
- package/index.ts +7 -0
- package/package.json +6 -6
- package/publish.sh +16 -21
- package/tsconfig.json +1 -1
package/Radio/index.tsx
CHANGED
|
@@ -4,8 +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 {formatNameLength} from '../Application/utils';
|
|
9
10
|
|
|
10
11
|
const Radio: FC<RadioProps> = ({
|
|
11
12
|
value,
|
|
@@ -14,6 +15,8 @@ const Radio: FC<RadioProps> = ({
|
|
|
14
15
|
onChange,
|
|
15
16
|
label,
|
|
16
17
|
style,
|
|
18
|
+
params,
|
|
19
|
+
accessibilityLabel,
|
|
17
20
|
}) => {
|
|
18
21
|
const {theme} = useContext(ApplicationContext);
|
|
19
22
|
const selected = value === groupValue;
|
|
@@ -38,26 +41,38 @@ const Radio: FC<RadioProps> = ({
|
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<
|
|
44
|
+
<ComponentContext.Provider
|
|
45
|
+
value={{
|
|
46
|
+
componentName: 'Radio',
|
|
47
|
+
params,
|
|
48
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
49
|
+
componentId: accessibilityLabel,
|
|
50
|
+
componentLabel: formatNameLength(label || ''),
|
|
51
|
+
componentValue: selected,
|
|
52
|
+
action: 'click',
|
|
53
|
+
}}>
|
|
54
|
+
<TouchableOpacity
|
|
55
|
+
accessibilityLabel={accessibilityLabel}
|
|
56
|
+
onPress={onChange}
|
|
57
|
+
disabled={disabled}
|
|
52
58
|
style={[
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
style,
|
|
60
|
+
{
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
},
|
|
64
|
+
]}>
|
|
65
|
+
<View
|
|
66
|
+
style={[
|
|
67
|
+
styles.radio,
|
|
68
|
+
checkBoxStyle,
|
|
69
|
+
disabledStyle,
|
|
70
|
+
{marginRight: label ? Spacing.XS : 0},
|
|
71
|
+
]}
|
|
72
|
+
/>
|
|
73
|
+
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
74
|
+
</TouchableOpacity>
|
|
75
|
+
</ComponentContext.Provider>
|
|
61
76
|
);
|
|
62
77
|
};
|
|
63
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`.
|
|
@@ -35,4 +35,6 @@ export type RadioProps = {
|
|
|
35
35
|
* Accepts an object of style properties.
|
|
36
36
|
*/
|
|
37
37
|
style?: ViewStyle;
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
params?: any;
|
|
40
|
+
}
|
package/Switch/index.tsx
CHANGED
|
@@ -3,9 +3,16 @@ 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 {ComponentContext} from '../Application';
|
|
6
7
|
|
|
7
|
-
const Switch: FC<SwitchProps> =
|
|
8
|
-
|
|
8
|
+
const Switch: FC<SwitchProps> = ({
|
|
9
|
+
value = false,
|
|
10
|
+
onChange,
|
|
11
|
+
disabled = false,
|
|
12
|
+
style,
|
|
13
|
+
params,
|
|
14
|
+
accessibilityLabel,
|
|
15
|
+
}) => {
|
|
9
16
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
10
17
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
11
18
|
|
|
@@ -15,23 +22,30 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
<ComponentContext.Provider
|
|
26
|
+
value={{
|
|
27
|
+
componentName: 'Switch',
|
|
28
|
+
params,
|
|
29
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
30
|
+
componentId: accessibilityLabel,
|
|
31
|
+
componentValue: value,
|
|
32
|
+
action: 'click',
|
|
33
|
+
}}>
|
|
34
|
+
<TouchableOpacity
|
|
35
|
+
disabled={disabled}
|
|
36
|
+
accessibilityLabel={accessibilityLabel}
|
|
37
|
+
onPress={() => onChange?.(!value)}
|
|
38
|
+
style={[
|
|
39
|
+
style,
|
|
40
|
+
styles.container,
|
|
41
|
+
{backgroundColor, alignItems: circleAlign},
|
|
42
|
+
]}>
|
|
43
|
+
<View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
|
|
44
|
+
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
45
|
+
</View>
|
|
46
|
+
</TouchableOpacity>
|
|
47
|
+
</ComponentContext.Provider>
|
|
30
48
|
);
|
|
31
49
|
};
|
|
32
50
|
|
|
33
|
-
Switch.defaultProps = {
|
|
34
|
-
value: false,
|
|
35
|
-
disabled: false,
|
|
36
|
-
};
|
|
37
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
|
*/
|
|
@@ -23,4 +23,6 @@ export type SwitchProps = {
|
|
|
23
23
|
* Accepts an object of style properties.
|
|
24
24
|
*/
|
|
25
25
|
style?: ViewStyle;
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
params?: any;
|
|
28
|
+
}
|
package/Tag/styles.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import {StyleSheet} from 'react-native';
|
|
2
2
|
import {Radius, Spacing} from '../Consts';
|
|
3
|
+
import {scaleSize} from '../Text';
|
|
3
4
|
|
|
4
5
|
export default StyleSheet.create({
|
|
5
6
|
container: {
|
|
6
7
|
paddingHorizontal: Spacing.S,
|
|
7
8
|
borderRadius: Radius.S,
|
|
8
9
|
flexDirection: 'row',
|
|
9
|
-
height: 24,
|
|
10
|
+
height: scaleSize(24),
|
|
10
11
|
alignItems: 'center',
|
|
11
12
|
justifyContent: 'center',
|
|
12
13
|
},
|
|
13
14
|
mediumContainer: {
|
|
14
15
|
paddingHorizontal: Spacing.S,
|
|
15
16
|
borderRadius: Radius.S,
|
|
16
|
-
height: 18,
|
|
17
|
+
height: scaleSize(18),
|
|
17
18
|
alignItems: 'center',
|
|
18
19
|
flexDirection: 'row',
|
|
19
20
|
justifyContent: 'center',
|
package/Text/index.tsx
CHANGED
|
@@ -51,8 +51,24 @@ export interface TextProps extends RNTextProps {
|
|
|
51
51
|
*/
|
|
52
52
|
color?: string;
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
const deprecatedValues: Typography[] = [
|
|
56
|
+
'headline_default',
|
|
57
|
+
'headline_l',
|
|
58
|
+
'headline_xl',
|
|
59
|
+
'title_default',
|
|
60
|
+
'title_xs',
|
|
61
|
+
'title_s',
|
|
62
|
+
'header_default',
|
|
63
|
+
'paragraph_default',
|
|
64
|
+
'paragraph_bold',
|
|
65
|
+
'paragraph_italic',
|
|
66
|
+
'label_xxs',
|
|
67
|
+
'action_s',
|
|
68
|
+
];
|
|
69
|
+
|
|
54
70
|
const Text: React.FC<TextProps> = ({
|
|
55
|
-
typography,
|
|
71
|
+
typography = 'body_default_regular',
|
|
56
72
|
color,
|
|
57
73
|
children,
|
|
58
74
|
style,
|
|
@@ -94,6 +110,13 @@ const Text: React.FC<TextProps> = ({
|
|
|
94
110
|
};
|
|
95
111
|
|
|
96
112
|
const textStyle = getTypoStyle(typography);
|
|
113
|
+
|
|
114
|
+
if (deprecatedValues.includes(typography)) {
|
|
115
|
+
console.warn(
|
|
116
|
+
`Warning: The typography value "${typography}" is deprecated.`,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
97
120
|
return (
|
|
98
121
|
<RNText
|
|
99
122
|
{...rest}
|
|
@@ -103,8 +126,4 @@ const Text: React.FC<TextProps> = ({
|
|
|
103
126
|
);
|
|
104
127
|
};
|
|
105
128
|
|
|
106
|
-
Text.defaultProps = {
|
|
107
|
-
typography: 'body_default_regular',
|
|
108
|
-
};
|
|
109
|
-
|
|
110
129
|
export {Text, scaleSize};
|
package/Text/styles.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
headline_default_bold: {fontSize: 24, lineHeight:
|
|
3
|
-
header_m_bold: {fontSize: 18, lineHeight:
|
|
2
|
+
headline_default_bold: {fontSize: 24, lineHeight: 34, fontWeight: '700'},
|
|
3
|
+
header_m_bold: {fontSize: 18, lineHeight: 26, fontWeight: '700'},
|
|
4
4
|
header_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
5
5
|
header_s_semibold: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
|
|
6
|
-
header_xs_semibold: {fontSize: 12, lineHeight:
|
|
6
|
+
header_xs_semibold: {fontSize: 12, lineHeight: 18, fontWeight: '600'},
|
|
7
7
|
body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
|
|
8
|
-
|
|
8
|
+
body_default_regularstrikethrought: {
|
|
9
9
|
fontSize: 14,
|
|
10
10
|
lineHeight: 20,
|
|
11
11
|
fontWeight: '400',
|
|
@@ -13,12 +13,12 @@ export default {
|
|
|
13
13
|
},
|
|
14
14
|
description_default_regular: {
|
|
15
15
|
fontSize: 12,
|
|
16
|
-
lineHeight:
|
|
16
|
+
lineHeight: 18,
|
|
17
17
|
fontWeight: '400',
|
|
18
18
|
},
|
|
19
19
|
description_default_regularstrikethrought: {
|
|
20
20
|
fontSize: 12,
|
|
21
|
-
lineHeight:
|
|
21
|
+
lineHeight: 18,
|
|
22
22
|
fontWeight: '400',
|
|
23
23
|
textDecorationLine: 'line-through',
|
|
24
24
|
},
|
|
@@ -30,11 +30,11 @@ export default {
|
|
|
30
30
|
textDecorationLine: 'line-through',
|
|
31
31
|
},
|
|
32
32
|
label_default_medium: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
|
|
33
|
-
label_s_medium: {fontSize: 12, lineHeight:
|
|
33
|
+
label_s_medium: {fontSize: 12, lineHeight: 18, fontWeight: '500'},
|
|
34
34
|
label_xs_medium: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
|
|
35
35
|
action_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
36
36
|
action_s_bold: {fontSize: 14, lineHeight: 20, fontWeight: '700'},
|
|
37
|
-
action_xs_bold: {fontSize: 12, lineHeight:
|
|
37
|
+
action_xs_bold: {fontSize: 12, lineHeight: 18, fontWeight: '700'},
|
|
38
38
|
action_xxs_bold: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
|
|
39
39
|
/**non-support**/
|
|
40
40
|
headline_default: {
|
package/Title/index.tsx
CHANGED
|
@@ -1,129 +1,196 @@
|
|
|
1
1
|
import React, {FC, useContext, useState} from 'react';
|
|
2
|
-
import {
|
|
3
|
-
LayoutChangeEvent,
|
|
4
|
-
NativeSyntheticEvent,
|
|
5
|
-
Text as RNText,
|
|
6
|
-
TextLayoutEventData,
|
|
7
|
-
TouchableOpacity,
|
|
8
|
-
View,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import {TitleProps} from './types';
|
|
2
|
+
import {Text as RNText, TouchableOpacity, View, ViewStyle} from 'react-native';
|
|
11
3
|
import {Icon} from '../Icon';
|
|
12
|
-
import styles from './styles';
|
|
13
|
-
import {ApplicationContext} from '../Application';
|
|
14
|
-
import {Colors, Spacing} from '../Consts';
|
|
15
4
|
import {scaleSize, Text} from '../Text';
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
|
+
import {Badge} from '../Badge';
|
|
7
|
+
import {Colors} from '../Consts';
|
|
8
|
+
import styles from './styles';
|
|
9
|
+
import {TitleProps} from './types';
|
|
10
|
+
import {Typography} from '../Text/types';
|
|
16
11
|
|
|
17
12
|
const Title: FC<TitleProps> = ({
|
|
18
|
-
size = 'large',
|
|
19
|
-
type = 'section',
|
|
20
|
-
onPressAction,
|
|
21
|
-
actionTitle,
|
|
22
13
|
title = 'Title',
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
type = 'section',
|
|
15
|
+
size = 'medium',
|
|
25
16
|
icon,
|
|
26
17
|
description,
|
|
27
|
-
|
|
18
|
+
iconColor = null,
|
|
19
|
+
iconAlign = 'top',
|
|
20
|
+
showRightAction = false,
|
|
21
|
+
showTrailingAction = false,
|
|
22
|
+
badgeLabel,
|
|
23
|
+
buttonTitle,
|
|
24
|
+
onPressRightAction = () => {},
|
|
25
|
+
onPressTrailingAction = () => {},
|
|
26
|
+
buttonSize = 'small',
|
|
27
|
+
textOnly = false,
|
|
28
|
+
style,
|
|
28
29
|
}) => {
|
|
29
30
|
const {theme} = useContext(ApplicationContext);
|
|
30
|
-
const [
|
|
31
|
-
const [
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const numberOfLines =
|
|
31
|
+
const [badgeWidth, setBadgeWidth] = useState(0);
|
|
32
|
+
const [contentWidth, setContentWidth] = useState(0);
|
|
33
|
+
const styleSheet: {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
} = styles;
|
|
36
|
+
const typography = `${type}_${size}`;
|
|
37
|
+
const isSection = type === 'section';
|
|
38
|
+
const numberOfLines = showTrailingAction || !!badgeLabel ? 1 : 2;
|
|
39
|
+
const buttonTypo: Typography =
|
|
40
|
+
buttonSize === 'small' ? 'action_xs_bold' : 'action_s_bold';
|
|
41
|
+
const flexStyle = showTrailingAction && {maxWidth: '70%'};
|
|
38
42
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/>
|
|
59
|
-
</TouchableOpacity>
|
|
43
|
+
const renderIcon = () => {
|
|
44
|
+
if (!icon) return null;
|
|
45
|
+
|
|
46
|
+
let iconStyle: ViewStyle = {
|
|
47
|
+
justifyContent: 'flex-start',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (iconAlign === 'middle') {
|
|
51
|
+
iconStyle = {justifyContent: 'center'};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (iconAlign === 'bottom') {
|
|
55
|
+
iconStyle = {justifyContent: 'flex-end'};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<View style={[styles.iconView, iconStyle]}>
|
|
60
|
+
<Icon color={iconColor} source={icon} />
|
|
61
|
+
</View>
|
|
60
62
|
);
|
|
61
63
|
};
|
|
62
64
|
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
+
const renderContent = () => {
|
|
66
|
+
return (
|
|
67
|
+
<View style={styles.contentView}>
|
|
68
|
+
<View
|
|
69
|
+
onLayout={e => {
|
|
70
|
+
if (e.nativeEvent.layout.width !== contentWidth) {
|
|
71
|
+
setContentWidth(e.nativeEvent.layout.width);
|
|
72
|
+
}
|
|
73
|
+
}}
|
|
74
|
+
style={[styles.iconLeftView, flexStyle]}>
|
|
75
|
+
<RNText
|
|
76
|
+
numberOfLines={numberOfLines}
|
|
77
|
+
style={[
|
|
78
|
+
styleSheet[typography],
|
|
79
|
+
styles.title,
|
|
80
|
+
{
|
|
81
|
+
maxWidth:
|
|
82
|
+
contentWidth > 0 ? contentWidth - badgeWidth : undefined,
|
|
83
|
+
},
|
|
84
|
+
]}>
|
|
85
|
+
{title}
|
|
86
|
+
</RNText>
|
|
87
|
+
{badgeLabel && (
|
|
88
|
+
<View
|
|
89
|
+
onLayout={e => {
|
|
90
|
+
if (e.nativeEvent.layout.width !== badgeWidth) {
|
|
91
|
+
setBadgeWidth(e.nativeEvent.layout.width);
|
|
92
|
+
}
|
|
93
|
+
}}
|
|
94
|
+
style={{
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
}}>
|
|
97
|
+
<Badge style={styles.badge} label={badgeLabel} />
|
|
98
|
+
</View>
|
|
99
|
+
)}
|
|
100
|
+
{renderActionLeft()}
|
|
101
|
+
</View>
|
|
102
|
+
{description && (
|
|
103
|
+
<Text
|
|
104
|
+
style={styles.description}
|
|
105
|
+
color={theme.colors.text.secondary}
|
|
106
|
+
typography={'description_default_regular'}>
|
|
107
|
+
{description}
|
|
108
|
+
</Text>
|
|
109
|
+
)}
|
|
110
|
+
</View>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const renderActionLeft = () => {
|
|
65
115
|
return (
|
|
66
116
|
<TouchableOpacity
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
117
|
+
onPress={onPressTrailingAction}
|
|
118
|
+
style={styles.iconLeftView}>
|
|
119
|
+
{showTrailingAction && !showRightAction && (
|
|
120
|
+
<View
|
|
121
|
+
style={[
|
|
122
|
+
styles.iconLeft,
|
|
123
|
+
{
|
|
124
|
+
backgroundColor: isSection
|
|
125
|
+
? Colors.black_06 + '99'
|
|
126
|
+
: Colors.black_06 + '4D',
|
|
127
|
+
},
|
|
128
|
+
]}>
|
|
129
|
+
<Icon
|
|
130
|
+
source={'arrow_chevron_right_small'}
|
|
131
|
+
size={scaleSize(18)}
|
|
132
|
+
color={theme.colors.text.default}
|
|
133
|
+
/>
|
|
134
|
+
</View>
|
|
135
|
+
)}
|
|
78
136
|
</TouchableOpacity>
|
|
79
137
|
);
|
|
80
138
|
};
|
|
81
|
-
const onLayout = (e: LayoutChangeEvent) => {
|
|
82
|
-
setContainerWidth(e.nativeEvent.layout.width);
|
|
83
|
-
};
|
|
84
139
|
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
};
|
|
140
|
+
const renderActionRight = () => {
|
|
141
|
+
if (!showRightAction || showTrailingAction) return false;
|
|
88
142
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
|
|
116
|
-
{!!description && type !== 'screen' && (
|
|
117
|
-
<Text
|
|
118
|
-
numberOfLines={1}
|
|
119
|
-
typography={'description_default_regular'}
|
|
120
|
-
color={theme.colors.text.secondary}>
|
|
121
|
-
{description}
|
|
143
|
+
const lineHeight = styleSheet[typography].lineHeight;
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<View
|
|
147
|
+
style={{
|
|
148
|
+
height: lineHeight,
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
}}>
|
|
151
|
+
{!buttonTitle ? (
|
|
152
|
+
<TouchableOpacity
|
|
153
|
+
onPress={onPressRightAction}
|
|
154
|
+
style={[
|
|
155
|
+
styles.iconRight,
|
|
156
|
+
{
|
|
157
|
+
backgroundColor: theme.colors.primary + '0F',
|
|
158
|
+
},
|
|
159
|
+
]}>
|
|
160
|
+
<Icon
|
|
161
|
+
source={'arrow_chevron_right_small'}
|
|
162
|
+
size={scaleSize(22)}
|
|
163
|
+
color={theme.colors.primary}
|
|
164
|
+
/>
|
|
165
|
+
</TouchableOpacity>
|
|
166
|
+
) : (
|
|
167
|
+
<TouchableOpacity onPress={onPressRightAction}>
|
|
168
|
+
<Text color={theme.colors.primary} typography={buttonTypo}>
|
|
169
|
+
{buttonTitle}
|
|
122
170
|
</Text>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
171
|
+
</TouchableOpacity>
|
|
172
|
+
)}
|
|
173
|
+
</View>
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
if (textOnly) {
|
|
178
|
+
return (
|
|
179
|
+
<View style={isSection && styles.margin}>
|
|
180
|
+
<RNText
|
|
181
|
+
numberOfLines={numberOfLines}
|
|
182
|
+
style={[styleSheet[typography], styles.title]}>
|
|
183
|
+
{title}
|
|
184
|
+
</RNText>
|
|
126
185
|
</View>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<View style={[style, styles.wrapper, isSection && styles.margin]}>
|
|
191
|
+
{renderIcon()}
|
|
192
|
+
{renderContent()}
|
|
193
|
+
{renderActionRight()}
|
|
127
194
|
</View>
|
|
128
195
|
);
|
|
129
196
|
};
|
package/Title/styles.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {StyleSheet} from 'react-native';
|
|
2
2
|
import {scaleSize} from '../Text';
|
|
3
|
-
import {Radius, Spacing} from '../Consts';
|
|
3
|
+
import {Colors, Radius, Spacing} from '../Consts';
|
|
4
4
|
|
|
5
5
|
export default StyleSheet.create({
|
|
6
6
|
card_small: {
|
|
@@ -27,10 +27,6 @@ export default StyleSheet.create({
|
|
|
27
27
|
fontSize: scaleSize(24),
|
|
28
28
|
lineHeight: scaleSize(34),
|
|
29
29
|
},
|
|
30
|
-
screen: {
|
|
31
|
-
fontSize: scaleSize(36),
|
|
32
|
-
lineHeight: scaleSize(44),
|
|
33
|
-
},
|
|
34
30
|
actionIcon: {
|
|
35
31
|
borderRadius: Radius.M,
|
|
36
32
|
alignItems: 'center',
|
|
@@ -41,12 +37,43 @@ export default StyleSheet.create({
|
|
|
41
37
|
borderRadius: Radius.XS,
|
|
42
38
|
},
|
|
43
39
|
wrapper: {
|
|
44
|
-
width: '100%',
|
|
45
40
|
flexDirection: 'row',
|
|
46
|
-
alignItems: 'center',
|
|
47
41
|
},
|
|
48
|
-
|
|
42
|
+
margin: {
|
|
43
|
+
marginTop: Spacing.S,
|
|
44
|
+
},
|
|
45
|
+
iconView: {
|
|
49
46
|
marginRight: Spacing.S,
|
|
50
|
-
|
|
47
|
+
},
|
|
48
|
+
iconRight: {
|
|
49
|
+
width: 22,
|
|
50
|
+
height: 22,
|
|
51
|
+
borderRadius: Radius.M,
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
marginLeft: Spacing.S,
|
|
55
|
+
},
|
|
56
|
+
iconLeft: {
|
|
57
|
+
width: 18,
|
|
58
|
+
height: 18,
|
|
59
|
+
borderRadius: Radius.M,
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
justifyContent: 'center',
|
|
62
|
+
marginHorizontal: Spacing.XS,
|
|
63
|
+
},
|
|
64
|
+
iconLeftView: {
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
},
|
|
68
|
+
contentView: {marginRight: Spacing.S, flex: 1},
|
|
69
|
+
title: {
|
|
70
|
+
fontWeight: 'bold',
|
|
71
|
+
color: Colors.black_17,
|
|
72
|
+
},
|
|
73
|
+
badge: {
|
|
74
|
+
marginLeft: Spacing.XS,
|
|
75
|
+
},
|
|
76
|
+
description: {
|
|
77
|
+
marginTop: Spacing.XS,
|
|
51
78
|
},
|
|
52
79
|
});
|