@momo-kits/foundation 0.168.1-rn862.1 → 0.169.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/Application/BottomSheet.hooks.ts +195 -0
- package/Application/BottomSheet.parts.tsx +147 -0
- package/Application/BottomSheet.styles.ts +43 -0
- package/Application/BottomSheet.tsx +76 -279
- package/Application/BottomTab/ActiveIndicator.tsx +90 -0
- package/Application/BottomTab/BottomTabBar.styles.ts +65 -0
- package/Application/BottomTab/BottomTabBar.tsx +229 -276
- package/Application/BottomTab/BottomTabInset.tsx +14 -0
- package/Application/BottomTab/CurvedContainer.tsx +153 -0
- package/Application/BottomTab/CustomBottomTabItem.tsx +132 -108
- package/Application/BottomTab/DuoBarCompression.tsx +4 -12
- package/Application/BottomTab/DuoRailTabBar.tsx +227 -0
- package/Application/BottomTab/DuoTabBar.styles.ts +81 -0
- package/Application/BottomTab/DuoTabBar.tsx +29 -495
- package/Application/BottomTab/TabBarIcon.tsx +160 -72
- package/Application/BottomTab/TabScreen.tsx +164 -0
- package/Application/BottomTab/index.tsx +84 -351
- package/Application/BottomTab/metrics.ts +164 -0
- package/Application/BottomTab/tabItems.ts +46 -0
- package/Application/BottomTab/usePressLift.ts +32 -0
- package/Application/Components/DuoGlassBackground.tsx +7 -9
- package/Application/Components/HeaderAnimated.tsx +1 -1
- package/Application/Components/HeaderBackground.tsx +1 -1
- package/Application/Components/HeaderExtendHeader.tsx +17 -11
- package/Application/Components/HeaderRight.styles.ts +144 -0
- package/Application/Components/HeaderRight.tsx +6 -528
- package/Application/Components/HeaderTitle.shared.ts +43 -0
- package/Application/Components/HeaderTitle.styles.ts +125 -0
- package/Application/Components/HeaderTitle.tsx +12 -576
- package/Application/Components/HeaderToolkitAction.tsx +208 -0
- package/Application/Components/NavigationButton.tsx +9 -6
- package/Application/Components/SearchHeader.tsx +1 -1
- package/Application/Components/SwipeBackHaptic.tsx +95 -0
- package/Application/Components/TitleJourney.tsx +110 -0
- package/Application/Components/TitleLocation.tsx +73 -0
- package/Application/Components/TitleUser.tsx +304 -0
- package/Application/Components/useToolkitActions.tsx +233 -0
- package/Application/ModalIconButton.tsx +66 -0
- package/Application/ModalScreen.tsx +39 -18
- package/Application/Navigation.ts +1 -1
- package/Application/NavigationContainer.tsx +7 -8
- package/Application/StackScreen.tracking.ts +158 -0
- package/Application/StackScreen.tsx +10 -137
- package/Application/WidgetContainer.tsx +10 -3
- package/Application/__tests__/modalLayout.test.ts +128 -0
- package/Application/hooks.ts +137 -0
- package/Application/index.ts +13 -1
- package/Application/modalLayout.ts +177 -0
- package/Application/navigationOptions.tsx +217 -0
- package/Application/types.header.ts +116 -0
- package/Application/types.tabs.ts +48 -0
- package/Application/types.theme.ts +87 -0
- package/Application/types.ts +12 -244
- package/Application/utils.ts +107 -0
- package/Badge/BadgeRibbon.tsx +3 -3
- package/Badge/styles.ts +2 -0
- package/Button/index.tsx +16 -136
- package/Button/styles.ts +1 -1
- package/Button/utils.ts +139 -0
- package/CheckBox/index.tsx +1 -6
- package/Divider/DashDivider.tsx +10 -11
- package/Divider/index.tsx +18 -8
- package/Image/index.tsx +1 -46
- package/Input/Input.tsx +7 -8
- package/Input/InputDropDown.tsx +3 -4
- package/Input/InputMoney.tsx +38 -164
- package/Input/InputMoneyView.tsx +187 -0
- package/Input/InputOTP.tsx +1 -1
- package/Input/InputPhoneNumber.tsx +5 -1
- package/Input/InputSearch.tsx +2 -108
- package/Input/InputTextArea.tsx +1 -5
- package/Input/SearchTextTyping.tsx +104 -0
- package/Input/common.tsx +4 -4
- package/Input/moneyUtils.ts +17 -0
- package/Input/styles.ts +26 -2
- package/Layout/FloatingButton.tsx +22 -21
- package/Layout/ReservedRegions.tsx +21 -4
- package/Layout/Screen.tsx +74 -670
- package/Layout/Section.tsx +1 -2
- package/Layout/index.ts +10 -4
- package/Layout/layoutMetrics.ts +58 -0
- package/Layout/layoutTypes.ts +86 -0
- package/Layout/screenContent.tsx +90 -0
- package/Layout/screenFooter.tsx +53 -0
- package/Layout/screenHeader.tsx +315 -0
- package/Layout/screenQuickReturn.tsx +67 -0
- package/Layout/screenScroll.ts +110 -0
- package/Layout/screenTypes.ts +134 -0
- package/Layout/styles.ts +2 -0
- package/Layout/utils.ts +10 -144
- package/Loader/DotLoader.tsx +7 -3
- package/Loader/ProgressBar.tsx +2 -6
- package/Loader/Spinner.tsx +7 -3
- package/Loader/styles.ts +4 -0
- package/Popup/PopupNotify.tsx +70 -64
- package/Popup/PopupPromotion.tsx +5 -4
- package/Popup/types.ts +7 -0
- package/Popup/utils.ts +46 -24
- package/Radio/index.tsx +2 -10
- package/Radio/styles.ts +6 -0
- package/Skeleton/index.tsx +1 -9
- package/Skeleton/styles.ts +1 -0
- package/Tag/index.tsx +3 -3
- package/Text/index.tsx +11 -2
- package/Title/index.tsx +2 -9
- package/Title/styles.ts +6 -0
- package/package.json +21 -22
- package/Application/device.ts +0 -29
- package/Application/utils.tsx +0 -497
|
@@ -1,63 +1,24 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import Animated, {
|
|
4
4
|
Extrapolation,
|
|
5
5
|
interpolate,
|
|
6
6
|
useAnimatedStyle,
|
|
7
7
|
} from 'react-native-reanimated';
|
|
8
|
-
import {
|
|
9
|
-
import { exportFontFamily,
|
|
10
|
-
import { Colors, Radius, Spacing, Styles } from '../../Consts';
|
|
8
|
+
import { MiniAppContext } from '../../Context';
|
|
9
|
+
import { exportFontFamily, useScaleSize } from '../../Text';
|
|
11
10
|
import {
|
|
12
11
|
TitleJourneyProps,
|
|
13
12
|
TitleLocationProps,
|
|
14
13
|
TitleUserProps,
|
|
15
14
|
} from '../types';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from '../utils';
|
|
24
|
-
import { useScreenLayout } from '../../Layout';
|
|
25
|
-
|
|
26
|
-
const useHeaderFontFamily = (): string => {
|
|
27
|
-
const context = useContext<any>(MiniAppContext);
|
|
28
|
-
return isWhiteListDesignSystem(context) ? 'MoMoTrustDisplay' : 'SFProText';
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* back button and toolkit sharing the navigation bar with the title
|
|
33
|
-
*/
|
|
34
|
-
const HEADER_ACTIONS_WIDTH = 172;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* extra width the 48pt back and toolkit take on the iPhone Duo status bar row
|
|
38
|
-
*/
|
|
39
|
-
const STATUS_BAR_ROW_ACTIONS_EXTRA = 55;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* max title width, the iPhone Duo side bar takes back and toolkit out of the bar
|
|
43
|
-
*/
|
|
44
|
-
const useTitleMaxWidth = () => {
|
|
45
|
-
const { width, contentWidth, sideBar, statusBarClearance } =
|
|
46
|
-
useScreenLayout();
|
|
47
|
-
let clearance = 0;
|
|
48
|
-
if (statusBarClearance) {
|
|
49
|
-
clearance = statusBarClearance.left + statusBarClearance.right;
|
|
50
|
-
}
|
|
51
|
-
if (sideBar) {
|
|
52
|
-
return contentWidth - Spacing.M * 2 - clearance;
|
|
53
|
-
}
|
|
54
|
-
return (
|
|
55
|
-
width -
|
|
56
|
-
HEADER_ACTIONS_WIDTH -
|
|
57
|
-
(statusBarClearance ? STATUS_BAR_ROW_ACTIONS_EXTRA : 0) -
|
|
58
|
-
clearance
|
|
59
|
-
);
|
|
60
|
-
};
|
|
15
|
+
import { type AnimatedCompatValue } from '../utils';
|
|
16
|
+
import { useNormalizedSharedValue } from '../hooks';
|
|
17
|
+
import { styles } from './HeaderTitle.styles';
|
|
18
|
+
import { useHeaderFontFamily, useTitleMaxWidth } from './HeaderTitle.shared';
|
|
19
|
+
import { TitleUser } from './TitleUser';
|
|
20
|
+
import { TitleLocation } from './TitleLocation';
|
|
21
|
+
import { TitleJourney } from './TitleJourney';
|
|
61
22
|
|
|
62
23
|
type HeaderTitleInterpolate = {
|
|
63
24
|
inputRange: number[];
|
|
@@ -108,10 +69,8 @@ const HeaderTitle: React.FC<
|
|
|
108
69
|
<View
|
|
109
70
|
pointerEvents={'none'}
|
|
110
71
|
style={[
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
maxWidth,
|
|
114
|
-
},
|
|
72
|
+
styles.centerContent,
|
|
73
|
+
{ maxWidth },
|
|
115
74
|
showBaseLineDebug && styles.debugBaseLine,
|
|
116
75
|
]}
|
|
117
76
|
>
|
|
@@ -157,527 +116,4 @@ const TitleCustom: React.FC<any> = ({ type, data, ...props }) => {
|
|
|
157
116
|
}
|
|
158
117
|
};
|
|
159
118
|
|
|
160
|
-
/**
|
|
161
|
-
* Header user title
|
|
162
|
-
* @constructor
|
|
163
|
-
*/
|
|
164
|
-
const TitleUser: React.FC<TitleUserProps> = ({
|
|
165
|
-
title,
|
|
166
|
-
subTitle,
|
|
167
|
-
image: image,
|
|
168
|
-
tintColor,
|
|
169
|
-
dotColor,
|
|
170
|
-
onPress,
|
|
171
|
-
verify,
|
|
172
|
-
icons,
|
|
173
|
-
isLoading,
|
|
174
|
-
}) => {
|
|
175
|
-
const { theme } = useContext(ApplicationContext);
|
|
176
|
-
const headerFontFamily = useHeaderFontFamily();
|
|
177
|
-
const maxWidth = useTitleMaxWidth();
|
|
178
|
-
const getShortName = (name: string) => {
|
|
179
|
-
const words = name.split(' ');
|
|
180
|
-
const lastTwoWords = words.slice(-2);
|
|
181
|
-
return lastTwoWords.map(word => word.charAt(0).toUpperCase()).join('');
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
const renderImage = () => {
|
|
185
|
-
const avatarWidth = Spacing.XXL;
|
|
186
|
-
if (Array.isArray(image) && image.length > 0) {
|
|
187
|
-
switch (image.length) {
|
|
188
|
-
case 1: {
|
|
189
|
-
return image.map((i: string) => (
|
|
190
|
-
<Image
|
|
191
|
-
key={`avatar-${i}`}
|
|
192
|
-
source={{ uri: i }}
|
|
193
|
-
style={styles.circle}
|
|
194
|
-
/>
|
|
195
|
-
));
|
|
196
|
-
}
|
|
197
|
-
case 2: {
|
|
198
|
-
return (
|
|
199
|
-
<View style={[Styles.flex, styles.groupAvtContainer]}>
|
|
200
|
-
<Image
|
|
201
|
-
source={{ uri: image[0] }}
|
|
202
|
-
style={[
|
|
203
|
-
styles.circleMedium,
|
|
204
|
-
{ position: 'absolute', top: 0, right: 0, zIndex: 0 },
|
|
205
|
-
]}
|
|
206
|
-
/>
|
|
207
|
-
<Image
|
|
208
|
-
source={{ uri: image[1] }}
|
|
209
|
-
style={[
|
|
210
|
-
styles.circleMedium,
|
|
211
|
-
{ position: 'absolute', left: 0, bottom: 0, zIndex: 1 },
|
|
212
|
-
]}
|
|
213
|
-
/>
|
|
214
|
-
</View>
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
case 3: {
|
|
218
|
-
return (
|
|
219
|
-
<View style={[Styles.flex, styles.groupAvtContainer]}>
|
|
220
|
-
<Image
|
|
221
|
-
source={{ uri: image[0] }}
|
|
222
|
-
style={[
|
|
223
|
-
styles.circleSmall,
|
|
224
|
-
{ position: 'absolute', bottom: 2, right: 2, zIndex: 0 },
|
|
225
|
-
]}
|
|
226
|
-
/>
|
|
227
|
-
<Image
|
|
228
|
-
source={{ uri: image[1] }}
|
|
229
|
-
style={[
|
|
230
|
-
styles.circleSmall,
|
|
231
|
-
{
|
|
232
|
-
position: 'absolute',
|
|
233
|
-
top: 2,
|
|
234
|
-
left: avatarWidth / 2 - 16 / 2,
|
|
235
|
-
zIndex: 1,
|
|
236
|
-
},
|
|
237
|
-
]}
|
|
238
|
-
/>
|
|
239
|
-
<Image
|
|
240
|
-
source={{ uri: image[2] }}
|
|
241
|
-
style={[
|
|
242
|
-
styles.circleSmall,
|
|
243
|
-
{ position: 'absolute', left: 2, bottom: 2, zIndex: 2 },
|
|
244
|
-
]}
|
|
245
|
-
/>
|
|
246
|
-
</View>
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
case 4: {
|
|
250
|
-
return (
|
|
251
|
-
<View style={[Styles.flex, styles.groupAvtContainer]}>
|
|
252
|
-
<Image
|
|
253
|
-
source={{ uri: image[0] }}
|
|
254
|
-
style={[
|
|
255
|
-
styles.circleSmall,
|
|
256
|
-
{ position: 'absolute', bottom: 2, left: 2, zIndex: 0 },
|
|
257
|
-
]}
|
|
258
|
-
/>
|
|
259
|
-
<Image
|
|
260
|
-
source={{ uri: image[1] }}
|
|
261
|
-
style={[
|
|
262
|
-
styles.circleSmall,
|
|
263
|
-
{ position: 'absolute', bottom: 2, right: 2, zIndex: 1 },
|
|
264
|
-
]}
|
|
265
|
-
/>
|
|
266
|
-
<Image
|
|
267
|
-
source={{ uri: image[2] }}
|
|
268
|
-
style={[
|
|
269
|
-
styles.circleSmall,
|
|
270
|
-
{ position: 'absolute', top: 2, right: 2, zIndex: 2 },
|
|
271
|
-
]}
|
|
272
|
-
/>
|
|
273
|
-
<Image
|
|
274
|
-
source={{ uri: image[2] }}
|
|
275
|
-
style={[
|
|
276
|
-
styles.circleSmall,
|
|
277
|
-
{ position: 'absolute', top: 2, left: 2, zIndex: 3 },
|
|
278
|
-
]}
|
|
279
|
-
/>
|
|
280
|
-
</View>
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
default: {
|
|
284
|
-
return (
|
|
285
|
-
<View style={[Styles.flex, styles.groupAvtContainer]}>
|
|
286
|
-
<Image
|
|
287
|
-
source={{ uri: image[0] }}
|
|
288
|
-
style={[
|
|
289
|
-
styles.circleSmall,
|
|
290
|
-
{ position: 'absolute', left: 2, bottom: 2, zIndex: 0 },
|
|
291
|
-
]}
|
|
292
|
-
/>
|
|
293
|
-
<Image
|
|
294
|
-
source={{ uri: image[1] }}
|
|
295
|
-
style={[
|
|
296
|
-
styles.circleSmall,
|
|
297
|
-
{ position: 'absolute', top: 2, right: 2, zIndex: 2 },
|
|
298
|
-
]}
|
|
299
|
-
/>
|
|
300
|
-
<Image
|
|
301
|
-
source={{ uri: image[2] }}
|
|
302
|
-
style={[
|
|
303
|
-
styles.circleSmall,
|
|
304
|
-
{ position: 'absolute', left: 2, top: 2, zIndex: 3 },
|
|
305
|
-
]}
|
|
306
|
-
/>
|
|
307
|
-
<View
|
|
308
|
-
style={[
|
|
309
|
-
styles.circleSmall,
|
|
310
|
-
{
|
|
311
|
-
position: 'absolute',
|
|
312
|
-
bottom: 2,
|
|
313
|
-
right: 2,
|
|
314
|
-
zIndex: 1,
|
|
315
|
-
backgroundColor: Colors.pink_09,
|
|
316
|
-
},
|
|
317
|
-
]}
|
|
318
|
-
>
|
|
319
|
-
<Text
|
|
320
|
-
color={Colors.pink_03}
|
|
321
|
-
typography={'description_xs_regular'}
|
|
322
|
-
>
|
|
323
|
-
{`+${image.length - 3}`}
|
|
324
|
-
</Text>
|
|
325
|
-
</View>
|
|
326
|
-
</View>
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (typeof image === 'string' && image) {
|
|
333
|
-
return <Image source={{ uri: image }} style={styles.circle} />;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
return (
|
|
337
|
-
<View
|
|
338
|
-
style={[
|
|
339
|
-
styles.imageContainer,
|
|
340
|
-
{ borderColor: theme.colors.border.default },
|
|
341
|
-
]}
|
|
342
|
-
>
|
|
343
|
-
<Text color={Colors.pink_03} typography={'description_xs_regular'}>
|
|
344
|
-
{getShortName(title)}
|
|
345
|
-
</Text>
|
|
346
|
-
</View>
|
|
347
|
-
);
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
const renderVerifyIcon = () => {
|
|
351
|
-
if (icons && icons.length > 0) {
|
|
352
|
-
return (
|
|
353
|
-
<View style={[Styles.row]}>
|
|
354
|
-
{icons.map(icon => (
|
|
355
|
-
<Image
|
|
356
|
-
key={`verified-icon-${icon}`}
|
|
357
|
-
source={{
|
|
358
|
-
uri: icon,
|
|
359
|
-
}}
|
|
360
|
-
style={styles.verifiedIcon}
|
|
361
|
-
/>
|
|
362
|
-
))}
|
|
363
|
-
</View>
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
const renderShimmer = () => {
|
|
369
|
-
return (
|
|
370
|
-
<View style={Styles.row}>
|
|
371
|
-
<View
|
|
372
|
-
style={[
|
|
373
|
-
styles.imageContainer,
|
|
374
|
-
{
|
|
375
|
-
borderColor: theme.colors.border.default,
|
|
376
|
-
marginRight: Spacing.M / 2,
|
|
377
|
-
},
|
|
378
|
-
]}
|
|
379
|
-
>
|
|
380
|
-
<Skeleton />
|
|
381
|
-
</View>
|
|
382
|
-
<View style={Styles.flex}>
|
|
383
|
-
<View style={styles.shimmerTitle}>
|
|
384
|
-
<Skeleton />
|
|
385
|
-
</View>
|
|
386
|
-
<View style={{ height: Spacing.XXS }} />
|
|
387
|
-
<View style={styles.shimmerDescription}>
|
|
388
|
-
<Skeleton />
|
|
389
|
-
</View>
|
|
390
|
-
</View>
|
|
391
|
-
</View>
|
|
392
|
-
);
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
if (verify) {
|
|
396
|
-
console.warn(`Warning: The verify value "${verify}" is deprecated.`);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
if (isLoading) {
|
|
400
|
-
return renderShimmer();
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
return (
|
|
404
|
-
<TouchableOpacity
|
|
405
|
-
style={{
|
|
406
|
-
justifyContent: 'center',
|
|
407
|
-
maxWidth: maxWidth - (icons?.length ?? 0) * 16,
|
|
408
|
-
}}
|
|
409
|
-
onPress={onPress}
|
|
410
|
-
disabled={onPress === undefined}
|
|
411
|
-
>
|
|
412
|
-
<View
|
|
413
|
-
style={[Styles.row, { maxWidth: maxWidth - (icons?.length ?? 0) * 16 }]}
|
|
414
|
-
>
|
|
415
|
-
<View>
|
|
416
|
-
{renderImage()}
|
|
417
|
-
{!!dotColor && (
|
|
418
|
-
<View style={[styles.dotAvatar, { backgroundColor: dotColor }]} />
|
|
419
|
-
)}
|
|
420
|
-
</View>
|
|
421
|
-
<View style={{ marginLeft: 6 }}>
|
|
422
|
-
<View style={Styles.row}>
|
|
423
|
-
<Text
|
|
424
|
-
typography="action_xs_bold"
|
|
425
|
-
fontFamily={headerFontFamily}
|
|
426
|
-
color={tintColor}
|
|
427
|
-
numberOfLines={1}
|
|
428
|
-
>
|
|
429
|
-
{title}
|
|
430
|
-
</Text>
|
|
431
|
-
{renderVerifyIcon()}
|
|
432
|
-
</View>
|
|
433
|
-
{!!subTitle && (
|
|
434
|
-
<Text
|
|
435
|
-
typography="description_xs_regular"
|
|
436
|
-
color={tintColor}
|
|
437
|
-
numberOfLines={1}
|
|
438
|
-
>
|
|
439
|
-
{subTitle}
|
|
440
|
-
</Text>
|
|
441
|
-
)}
|
|
442
|
-
</View>
|
|
443
|
-
</View>
|
|
444
|
-
</TouchableOpacity>
|
|
445
|
-
);
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Header user title
|
|
450
|
-
* @constructor
|
|
451
|
-
*/
|
|
452
|
-
const TitleLocation: React.FC<TitleLocationProps> = ({
|
|
453
|
-
tintColor,
|
|
454
|
-
location,
|
|
455
|
-
description,
|
|
456
|
-
onPress,
|
|
457
|
-
isLoading,
|
|
458
|
-
}) => {
|
|
459
|
-
const headerFontFamily = useHeaderFontFamily();
|
|
460
|
-
const maxWidth = useTitleMaxWidth();
|
|
461
|
-
const renderShimmer = () => {
|
|
462
|
-
return (
|
|
463
|
-
<View style={Styles.flex}>
|
|
464
|
-
<View style={styles.shimmerDescription}>
|
|
465
|
-
<Skeleton />
|
|
466
|
-
</View>
|
|
467
|
-
<View style={{ height: Spacing.XXS }} />
|
|
468
|
-
<View style={styles.shimmerTitle}>
|
|
469
|
-
<Skeleton />
|
|
470
|
-
</View>
|
|
471
|
-
</View>
|
|
472
|
-
);
|
|
473
|
-
};
|
|
474
|
-
if (isLoading) {
|
|
475
|
-
return renderShimmer();
|
|
476
|
-
}
|
|
477
|
-
return (
|
|
478
|
-
<TouchableOpacity
|
|
479
|
-
style={{
|
|
480
|
-
justifyContent: 'center',
|
|
481
|
-
maxWidth: maxWidth,
|
|
482
|
-
alignItems: 'flex-start',
|
|
483
|
-
}}
|
|
484
|
-
onPress={onPress}
|
|
485
|
-
>
|
|
486
|
-
{!!description && (
|
|
487
|
-
<Text
|
|
488
|
-
typography="description_xs_regular"
|
|
489
|
-
color={tintColor}
|
|
490
|
-
numberOfLines={1}
|
|
491
|
-
>
|
|
492
|
-
{description}
|
|
493
|
-
</Text>
|
|
494
|
-
)}
|
|
495
|
-
<View style={Styles.row}>
|
|
496
|
-
<Text
|
|
497
|
-
typography="action_xs_bold"
|
|
498
|
-
fontFamily={headerFontFamily}
|
|
499
|
-
color={tintColor}
|
|
500
|
-
numberOfLines={1}
|
|
501
|
-
>
|
|
502
|
-
{location}
|
|
503
|
-
</Text>
|
|
504
|
-
<Icon
|
|
505
|
-
source={'16_arrow_chevron_down_small'}
|
|
506
|
-
size={16}
|
|
507
|
-
style={{ marginHorizontal: Spacing.XS }}
|
|
508
|
-
/>
|
|
509
|
-
</View>
|
|
510
|
-
</TouchableOpacity>
|
|
511
|
-
);
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Header user title
|
|
516
|
-
* @constructor
|
|
517
|
-
*/
|
|
518
|
-
const TitleJourney: React.FC<TitleJourneyProps> = ({
|
|
519
|
-
start,
|
|
520
|
-
end,
|
|
521
|
-
description,
|
|
522
|
-
icon,
|
|
523
|
-
iconColor,
|
|
524
|
-
tintColor,
|
|
525
|
-
onPress,
|
|
526
|
-
isLoading,
|
|
527
|
-
}) => {
|
|
528
|
-
const headerFontFamily = useHeaderFontFamily();
|
|
529
|
-
const maxWidth = useTitleMaxWidth();
|
|
530
|
-
const { sideBar } = useScreenLayout();
|
|
531
|
-
// journey split is tuned against the whole bar width
|
|
532
|
-
const screenWidth = Dimensions.get('screen').width;
|
|
533
|
-
const barWidth = sideBar ? maxWidth + HEADER_ACTIONS_WIDTH : screenWidth;
|
|
534
|
-
const startWidth = barWidth * 0.25;
|
|
535
|
-
const endWidth = barWidth * 0.75 - 212;
|
|
536
|
-
const renderShimmer = () => {
|
|
537
|
-
return (
|
|
538
|
-
<View style={Styles.flex}>
|
|
539
|
-
<View style={styles.shimmerTitle}>
|
|
540
|
-
<Skeleton />
|
|
541
|
-
</View>
|
|
542
|
-
<View style={{ height: Spacing.XXS }} />
|
|
543
|
-
<View style={styles.shimmerDescription}>
|
|
544
|
-
<Skeleton />
|
|
545
|
-
</View>
|
|
546
|
-
</View>
|
|
547
|
-
);
|
|
548
|
-
};
|
|
549
|
-
if (isLoading) {
|
|
550
|
-
return renderShimmer();
|
|
551
|
-
}
|
|
552
|
-
return (
|
|
553
|
-
<TouchableOpacity
|
|
554
|
-
style={{
|
|
555
|
-
justifyContent: 'center',
|
|
556
|
-
maxWidth: maxWidth,
|
|
557
|
-
}}
|
|
558
|
-
onPress={onPress}
|
|
559
|
-
>
|
|
560
|
-
<View style={styles.rowJourney}>
|
|
561
|
-
<View style={Styles.row}>
|
|
562
|
-
<Text
|
|
563
|
-
typography="action_xs_bold"
|
|
564
|
-
style={{ maxWidth: startWidth }}
|
|
565
|
-
color={tintColor}
|
|
566
|
-
numberOfLines={1}
|
|
567
|
-
fontFamily={headerFontFamily}
|
|
568
|
-
>
|
|
569
|
-
{start}
|
|
570
|
-
</Text>
|
|
571
|
-
<Icon
|
|
572
|
-
source={icon}
|
|
573
|
-
size={16}
|
|
574
|
-
color={iconColor ?? tintColor}
|
|
575
|
-
style={{ marginHorizontal: Spacing.S, marginVertical: Spacing.XXS }}
|
|
576
|
-
/>
|
|
577
|
-
{!!end && (
|
|
578
|
-
<Text
|
|
579
|
-
style={{ maxWidth: endWidth }}
|
|
580
|
-
typography="action_xs_bold"
|
|
581
|
-
color={tintColor}
|
|
582
|
-
numberOfLines={1}
|
|
583
|
-
fontFamily={headerFontFamily}
|
|
584
|
-
>
|
|
585
|
-
{end}
|
|
586
|
-
</Text>
|
|
587
|
-
)}
|
|
588
|
-
</View>
|
|
589
|
-
<Icon
|
|
590
|
-
source={'16_arrow_chevron_down_small'}
|
|
591
|
-
size={16}
|
|
592
|
-
color={tintColor}
|
|
593
|
-
style={{ marginHorizontal: Spacing.XS, marginVertical: Spacing.XXS }}
|
|
594
|
-
/>
|
|
595
|
-
</View>
|
|
596
|
-
{!!description && (
|
|
597
|
-
<View style={styles.rowJourney}>
|
|
598
|
-
<Text
|
|
599
|
-
typography="description_xs_regular"
|
|
600
|
-
color={tintColor}
|
|
601
|
-
numberOfLines={1}
|
|
602
|
-
>
|
|
603
|
-
{description}
|
|
604
|
-
</Text>
|
|
605
|
-
</View>
|
|
606
|
-
)}
|
|
607
|
-
</TouchableOpacity>
|
|
608
|
-
);
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
const styles = StyleSheet.create({
|
|
612
|
-
rowJourney: { flexDirection: 'row', width: '100%', alignItems: 'flex-start' },
|
|
613
|
-
verifiedDot: {
|
|
614
|
-
width: 4,
|
|
615
|
-
height: 4,
|
|
616
|
-
borderRadius: 2,
|
|
617
|
-
backgroundColor: Colors.green_03,
|
|
618
|
-
position: 'absolute',
|
|
619
|
-
alignSelf: 'center',
|
|
620
|
-
},
|
|
621
|
-
circle: {
|
|
622
|
-
width: 32,
|
|
623
|
-
height: 32,
|
|
624
|
-
borderRadius: 16,
|
|
625
|
-
borderWidth: 0.5,
|
|
626
|
-
borderColor: Colors.black_04,
|
|
627
|
-
},
|
|
628
|
-
circleMedium: {
|
|
629
|
-
width: 24,
|
|
630
|
-
height: 24,
|
|
631
|
-
borderRadius: 16,
|
|
632
|
-
borderWidth: 0.5,
|
|
633
|
-
borderColor: Colors.black_04,
|
|
634
|
-
},
|
|
635
|
-
circleSmall: {
|
|
636
|
-
width: 16,
|
|
637
|
-
height: 16,
|
|
638
|
-
borderRadius: 16,
|
|
639
|
-
borderWidth: 0.5,
|
|
640
|
-
borderColor: Colors.black_04,
|
|
641
|
-
},
|
|
642
|
-
groupAvtContainer: {
|
|
643
|
-
width: Spacing.XXL,
|
|
644
|
-
height: Spacing.XXL,
|
|
645
|
-
position: 'relative',
|
|
646
|
-
},
|
|
647
|
-
imageContainer: {
|
|
648
|
-
width: 32,
|
|
649
|
-
height: 32,
|
|
650
|
-
borderRadius: 16,
|
|
651
|
-
backgroundColor: Colors.pink_09,
|
|
652
|
-
borderWidth: 0.5,
|
|
653
|
-
justifyContent: 'center',
|
|
654
|
-
alignItems: 'center',
|
|
655
|
-
overflow: 'hidden',
|
|
656
|
-
},
|
|
657
|
-
dotAvatar: {
|
|
658
|
-
position: 'absolute',
|
|
659
|
-
width: 12,
|
|
660
|
-
height: 12,
|
|
661
|
-
borderRadius: 6,
|
|
662
|
-
bottom: -2,
|
|
663
|
-
right: -2,
|
|
664
|
-
borderWidth: 2,
|
|
665
|
-
borderColor: Colors.black_01,
|
|
666
|
-
},
|
|
667
|
-
verifiedIcon: { width: 16, height: 16, marginLeft: Spacing.XS },
|
|
668
|
-
shimmerTitle: {
|
|
669
|
-
height: 18,
|
|
670
|
-
width: 120,
|
|
671
|
-
borderRadius: Radius.XS,
|
|
672
|
-
overflow: 'hidden',
|
|
673
|
-
},
|
|
674
|
-
shimmerDescription: {
|
|
675
|
-
height: 12,
|
|
676
|
-
width: 120,
|
|
677
|
-
borderRadius: Radius.XS,
|
|
678
|
-
overflow: 'hidden',
|
|
679
|
-
},
|
|
680
|
-
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
681
|
-
});
|
|
682
|
-
|
|
683
119
|
export { HeaderTitle, TitleCustom };
|