@momo-kits/title 0.167.1-duo.8 → 0.167.1-rc.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/index.tsx +12 -24
- package/package.json +16 -16
- package/styles.ts +6 -0
package/index.tsx
CHANGED
|
@@ -79,11 +79,12 @@ const Title: FC<TitleProps> = ({
|
|
|
79
79
|
const titleFontFamily = exportFontFamily('bold');
|
|
80
80
|
const isSection = type === 'section';
|
|
81
81
|
const numberOfLines = showTrailingAction || !!badgeLabel ? 1 : 2;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
let buttonTypo: Typography = 'action_s_bold';
|
|
83
|
+
if (buttonSize === 'small') {
|
|
84
|
+
buttonTypo = 'action_xs_bold';
|
|
85
|
+
}
|
|
86
|
+
const trailingFlexStyle: ViewStyle = { width: '70%' };
|
|
87
|
+
const flexStyle = showTrailingAction ? trailingFlexStyle : undefined;
|
|
87
88
|
const componentName = 'Title';
|
|
88
89
|
|
|
89
90
|
const app = useContext<any>(MiniAppContext);
|
|
@@ -123,6 +124,7 @@ const Title: FC<TitleProps> = ({
|
|
|
123
124
|
};
|
|
124
125
|
|
|
125
126
|
const renderContent = () => {
|
|
127
|
+
const maxWidth = contentWidth > 0 ? contentWidth - badgeWidth : undefined;
|
|
126
128
|
return (
|
|
127
129
|
<View style={styles.contentView}>
|
|
128
130
|
<View
|
|
@@ -141,10 +143,7 @@ const Title: FC<TitleProps> = ({
|
|
|
141
143
|
styleSheet[typography],
|
|
142
144
|
{ fontFamily: titleFontFamily },
|
|
143
145
|
styles.title,
|
|
144
|
-
{
|
|
145
|
-
maxWidth:
|
|
146
|
-
contentWidth > 0 ? contentWidth - badgeWidth : undefined,
|
|
147
|
-
},
|
|
146
|
+
{ maxWidth },
|
|
148
147
|
]}
|
|
149
148
|
>
|
|
150
149
|
{title}
|
|
@@ -156,9 +155,7 @@ const Title: FC<TitleProps> = ({
|
|
|
156
155
|
setBadgeWidth(e.nativeEvent.layout.width);
|
|
157
156
|
}
|
|
158
157
|
}}
|
|
159
|
-
style={
|
|
160
|
-
alignItems: 'center',
|
|
161
|
-
}}
|
|
158
|
+
style={styles.badgeView}
|
|
162
159
|
>
|
|
163
160
|
<Badge
|
|
164
161
|
style={styles.badge}
|
|
@@ -184,6 +181,7 @@ const Title: FC<TitleProps> = ({
|
|
|
184
181
|
};
|
|
185
182
|
|
|
186
183
|
const renderActionLeft = () => {
|
|
184
|
+
const trailingBackground = Colors.black_06 + (isSection ? '99' : '4D');
|
|
187
185
|
return (
|
|
188
186
|
<TouchableOpacity
|
|
189
187
|
accessibilityLabel={componentId + '|trailing-touch'}
|
|
@@ -193,14 +191,7 @@ const Title: FC<TitleProps> = ({
|
|
|
193
191
|
>
|
|
194
192
|
{showTrailingAction && !showRightAction && (
|
|
195
193
|
<View
|
|
196
|
-
style={[
|
|
197
|
-
styles.iconLeft,
|
|
198
|
-
{
|
|
199
|
-
backgroundColor: isSection
|
|
200
|
-
? Colors.black_06 + '99'
|
|
201
|
-
: Colors.black_06 + '4D',
|
|
202
|
-
},
|
|
203
|
-
]}
|
|
194
|
+
style={[styles.iconLeft, { backgroundColor: trailingBackground }]}
|
|
204
195
|
>
|
|
205
196
|
<Icon
|
|
206
197
|
source={'arrow_chevron_right_small'}
|
|
@@ -220,10 +211,7 @@ const Title: FC<TitleProps> = ({
|
|
|
220
211
|
|
|
221
212
|
return (
|
|
222
213
|
<View
|
|
223
|
-
style={{
|
|
224
|
-
height: lineHeight,
|
|
225
|
-
justifyContent: 'center',
|
|
226
|
-
}}
|
|
214
|
+
style={[styles.actionRightView, { height: lineHeight }]}
|
|
227
215
|
>
|
|
228
216
|
{!buttonTitle ? (
|
|
229
217
|
<TouchableOpacity
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
2
|
+
"name": "@momo-kits/title",
|
|
3
|
+
"version": "0.167.1-rc.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.tsx",
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"@momo-kits/foundation": "latest",
|
|
9
|
+
"prop-types": "^15.7.2",
|
|
10
|
+
"react": "16.9.0",
|
|
11
|
+
"react-native": ">=0.55"
|
|
12
|
+
},
|
|
13
|
+
"license": "MoMo",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"registry": "https://registry.npmjs.org/"
|
|
16
|
+
}
|
|
17
|
+
}
|
package/styles.ts
CHANGED