@momo-kits/foundation 0.111.1-optimize.2 → 0.111.1-optimize.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.
|
@@ -143,10 +143,11 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
143
143
|
*/
|
|
144
144
|
const onPressShortcut = () => {
|
|
145
145
|
const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
|
|
146
|
+
const expected = !isFavorite;
|
|
146
147
|
context?.autoTracking?.({
|
|
147
148
|
...context,
|
|
148
149
|
componentName: 'IconButton',
|
|
149
|
-
componentId: '
|
|
150
|
+
componentId: `${expected ? 'pin' : 'unpin'}_shortcut`,
|
|
150
151
|
screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
151
152
|
});
|
|
152
153
|
setIsLoading(true);
|
|
@@ -160,7 +161,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
160
161
|
},
|
|
161
162
|
({success}: {success: boolean}) => {
|
|
162
163
|
if (success) {
|
|
163
|
-
setIsFavorite(
|
|
164
|
+
setIsFavorite(expected);
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
);
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import {ApplicationContext, MiniAppContext} from '../index';
|
|
10
10
|
import {exportFontFamily, scaleSize, Text} from '../../Text';
|
|
11
|
-
import {Colors,
|
|
11
|
+
import {Colors, Radius, Spacing, Styles} from '../../Consts';
|
|
12
12
|
import {TitleJourneyProps, TitleLocationProps, TitleUserProps} from '../types';
|
|
13
13
|
import {Image} from '../../Image';
|
|
14
14
|
import {Icon} from '../../Icon';
|
|
@@ -79,7 +79,7 @@ const TitleUser: React.FC<TitleUserProps> = ({
|
|
|
79
79
|
isLoading,
|
|
80
80
|
}) => {
|
|
81
81
|
const {theme} = useContext(ApplicationContext);
|
|
82
|
-
const maxWidth =
|
|
82
|
+
const maxWidth = Dimensions.get('window').width - scaleSize(172);
|
|
83
83
|
const getShortName = (name: string) => {
|
|
84
84
|
const words = name.split(' ');
|
|
85
85
|
const lastTwoWords = words.slice(-2);
|
|
@@ -246,20 +246,20 @@ const TitleUser: React.FC<TitleUserProps> = ({
|
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
const renderVerifyIcon = () => {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
249
|
+
if (icons && icons.length > 0) {
|
|
250
|
+
return (
|
|
251
|
+
<View style={[Styles.row]}>
|
|
252
|
+
{icons.map(icon => (
|
|
253
|
+
<Image
|
|
254
|
+
source={{
|
|
255
|
+
uri: icon,
|
|
256
|
+
}}
|
|
257
|
+
style={styles.verifiedIcon}
|
|
258
|
+
/>
|
|
259
|
+
))}
|
|
260
|
+
</View>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
263
|
};
|
|
264
264
|
|
|
265
265
|
const renderShimmer = () => {
|
|
@@ -295,19 +295,21 @@ const TitleUser: React.FC<TitleUserProps> = ({
|
|
|
295
295
|
if (isLoading) {
|
|
296
296
|
return renderShimmer();
|
|
297
297
|
}
|
|
298
|
+
|
|
298
299
|
return (
|
|
299
300
|
<TouchableOpacity
|
|
300
301
|
style={styles.headerTitleContainer}
|
|
301
302
|
onPress={onPress}
|
|
302
303
|
disabled={onPress === undefined}>
|
|
303
|
-
<View
|
|
304
|
+
<View
|
|
305
|
+
style={[Styles.row, {maxWidth: maxWidth - (icons?.length ?? 0) * 16}]}>
|
|
304
306
|
<View>
|
|
305
307
|
{renderImage()}
|
|
306
308
|
{!!dotColor && (
|
|
307
309
|
<View style={[styles.dotAvatar, {backgroundColor: dotColor}]} />
|
|
308
310
|
)}
|
|
309
311
|
</View>
|
|
310
|
-
<View style={[Styles.flex, {marginLeft: 6
|
|
312
|
+
<View style={[Styles.flex, {marginLeft: 6}]}>
|
|
311
313
|
<View style={Styles.row}>
|
|
312
314
|
<Text
|
|
313
315
|
typography="action_xs_bold"
|
|
@@ -493,7 +495,7 @@ const styles = StyleSheet.create({
|
|
|
493
495
|
},
|
|
494
496
|
headerTitleContainer: {
|
|
495
497
|
justifyContent: 'center',
|
|
496
|
-
maxWidth: Dimensions.get('window').width -
|
|
498
|
+
maxWidth: Dimensions.get('window').width - scaleSize(172),
|
|
497
499
|
},
|
|
498
500
|
circle: {
|
|
499
501
|
width: 32,
|