@momo-kits/title 0.92.2 → 0.92.4
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/index.tsx +14 -9
- package/package.json +1 -1
- package/styles.ts +2 -1
- package/types.ts +4 -1
package/index.tsx
CHANGED
|
@@ -25,9 +25,10 @@ const Title: FC<TitleProps> = ({
|
|
|
25
25
|
badgeLabel,
|
|
26
26
|
buttonTitle,
|
|
27
27
|
onPressRightAction = () => {},
|
|
28
|
-
|
|
28
|
+
onPressTrailingAction = () => {},
|
|
29
29
|
buttonSize = 'small',
|
|
30
30
|
textOnly = false,
|
|
31
|
+
style,
|
|
31
32
|
}) => {
|
|
32
33
|
const {theme} = useContext(ApplicationContext);
|
|
33
34
|
const [badgeWidth, setBadgeWidth] = useState(0);
|
|
@@ -94,19 +95,23 @@ const Title: FC<TitleProps> = ({
|
|
|
94
95
|
)}
|
|
95
96
|
{renderActionLeft()}
|
|
96
97
|
</View>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
{description && (
|
|
99
|
+
<Text
|
|
100
|
+
style={styles.description}
|
|
101
|
+
color={theme.colors.text.secondary}
|
|
102
|
+
typography={'description_default_regular'}>
|
|
103
|
+
{description}
|
|
104
|
+
</Text>
|
|
105
|
+
)}
|
|
103
106
|
</View>
|
|
104
107
|
);
|
|
105
108
|
};
|
|
106
109
|
|
|
107
110
|
const renderActionLeft = () => {
|
|
108
111
|
return (
|
|
109
|
-
<TouchableOpacity
|
|
112
|
+
<TouchableOpacity
|
|
113
|
+
onPress={onPressTrailingAction}
|
|
114
|
+
style={styles.iconLeftView}>
|
|
110
115
|
{showTrailingAction && !showRightAction && (
|
|
111
116
|
<View
|
|
112
117
|
style={[
|
|
@@ -172,7 +177,7 @@ const Title: FC<TitleProps> = ({
|
|
|
172
177
|
}
|
|
173
178
|
|
|
174
179
|
return (
|
|
175
|
-
<View style={[styles.wrapper, isSection && styles.margin]}>
|
|
180
|
+
<View style={[style, styles.wrapper, isSection && styles.margin]}>
|
|
176
181
|
{renderIcon()}
|
|
177
182
|
{renderContent()}
|
|
178
183
|
{renderActionRight()}
|
package/package.json
CHANGED
package/styles.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {StyleSheet} from 'react-native';
|
|
2
|
-
import {scaleSize, Radius, Spacing} from '@momo-kits/foundation';
|
|
2
|
+
import {scaleSize, Radius, Spacing, Colors} from '@momo-kits/foundation';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
card_small: {
|
|
@@ -67,6 +67,7 @@ export default StyleSheet.create({
|
|
|
67
67
|
contentView: {marginRight: Spacing.S, flex: 1},
|
|
68
68
|
title: {
|
|
69
69
|
fontWeight: 'bold',
|
|
70
|
+
color: Colors.black_17,
|
|
70
71
|
},
|
|
71
72
|
badge: {
|
|
72
73
|
marginLeft: Spacing.XS,
|
package/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {ViewStyle} from 'react-native';
|
|
2
|
+
|
|
1
3
|
export type TitleProps = {
|
|
2
4
|
type?: 'card' | 'section';
|
|
3
5
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -12,6 +14,7 @@ export type TitleProps = {
|
|
|
12
14
|
buttonTitle?: string;
|
|
13
15
|
buttonSize?: 'small' | 'large';
|
|
14
16
|
onPressRightAction?: () => void;
|
|
15
|
-
|
|
17
|
+
onPressTrailingAction?: () => void;
|
|
16
18
|
textOnly?: boolean;
|
|
19
|
+
style?: ViewStyle;
|
|
17
20
|
};
|