@momo-kits/title 0.92.2 → 0.92.3

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.
Files changed (3) hide show
  1. package/index.tsx +14 -9
  2. package/package.json +1 -1
  3. 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
- onPressLeftAction = () => {},
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
- <Text
98
- style={styles.description}
99
- color={theme.colors.text.secondary}
100
- typography={'description_default_regular'}>
101
- {description}
102
- </Text>
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 onPress={onPressLeftAction} style={styles.iconLeftView}>
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/title",
3
- "version": "0.92.2",
3
+ "version": "0.92.3",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "dependencies": {},
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
- onPressLeftAction?: () => void;
17
+ onPressTrailingAction?: () => void;
16
18
  textOnly?: boolean;
19
+ style?: ViewStyle;
17
20
  };