@momo-kits/foundation 0.168.1-beta.39 → 0.168.1-beta.40
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.tsx +398 -86
- package/Application/BottomTab/BottomTabBar.tsx +275 -215
- package/Application/BottomTab/CustomBottomTabItem.tsx +107 -131
- package/Application/BottomTab/DuoBarCompression.tsx +28 -14
- package/Application/BottomTab/DuoTabBar.tsx +540 -32
- package/Application/BottomTab/TabBarIcon.tsx +72 -146
- package/Application/BottomTab/index.tsx +353 -89
- package/Application/BottomTab/useLiquidSelection.ts +374 -0
- package/Application/Components/BackgroundImageView.tsx +0 -4
- package/Application/Components/DuoGlassBackground.tsx +5 -7
- package/Application/Components/HeaderAnimated.tsx +13 -41
- package/Application/Components/HeaderBackground.tsx +3 -20
- package/Application/Components/HeaderExtendHeader.tsx +46 -66
- package/Application/Components/HeaderLeft.tsx +18 -5
- package/Application/Components/HeaderRight.tsx +529 -8
- package/Application/Components/HeaderTitle.tsx +579 -16
- package/Application/Components/NavigationButton.tsx +11 -18
- package/Application/Components/SearchHeader.tsx +18 -38
- package/Application/Localize.ts +0 -7
- package/Application/ModalScreen.tsx +18 -41
- package/Application/Navigation.ts +17 -15
- package/Application/NavigationContainer.tsx +21 -23
- package/Application/Navigator.ts +48 -20
- package/Application/ScaleSizeProvider.tsx +6 -13
- package/Application/StackScreen.tsx +172 -27
- package/Application/TooltipPortal.tsx +5 -12
- package/Application/WidgetContainer.tsx +7 -20
- package/Application/device.ts +52 -0
- package/Application/index.ts +1 -23
- package/Application/types.ts +242 -17
- package/Application/utils.tsx +493 -0
- package/Badge/Badge.tsx +0 -5
- package/Badge/BadgeDot.tsx +0 -1
- package/Badge/BadgeDotAnimation.tsx +7 -15
- package/Badge/BadgeRibbon.tsx +39 -47
- package/Badge/Shape.tsx +0 -2
- package/Badge/styles.ts +0 -2
- package/Badge/types.ts +2 -2
- package/Button/index.tsx +152 -21
- package/Button/styles.ts +1 -1
- package/CheckBox/index.tsx +6 -5
- package/Consts/theme.ts +10 -10
- package/Context/index.ts +1 -5
- package/Divider/DashDivider.tsx +11 -11
- package/Divider/index.tsx +7 -21
- package/FoundationList/index.tsx +0 -4
- package/Icon/index.tsx +6 -6
- package/Icon/types.ts +1 -1
- package/IconButton/index.tsx +12 -4
- package/Image/index.tsx +7 -9
- package/Input/Input.tsx +12 -10
- package/Input/InputDropDown.tsx +13 -10
- package/Input/InputMoney.tsx +152 -45
- package/Input/InputOTP.tsx +34 -36
- package/Input/InputPhoneNumber.tsx +5 -8
- package/Input/InputSearch.tsx +111 -19
- package/Input/InputTextArea.tsx +5 -5
- package/Input/SystemTextInput.tsx +2 -7
- package/Input/TextTyping.tsx +0 -4
- package/Input/common.tsx +17 -31
- package/Input/index.tsx +21 -24
- package/Input/styles.ts +5 -25
- package/Input/utils.ts +12 -14
- package/Layout/Card.tsx +4 -7
- package/Layout/FloatingButton.tsx +21 -26
- package/Layout/Item.tsx +2 -6
- package/Layout/ItemList.tsx +7 -9
- package/Layout/ItemSectionList.tsx +1 -2
- package/Layout/ReservedRegions.tsx +17 -34
- package/Layout/Screen.tsx +696 -122
- package/Layout/Section.tsx +7 -9
- package/Layout/TrackingScope.tsx +0 -1
- package/Layout/index.ts +4 -10
- package/Layout/styles.ts +0 -2
- package/Layout/types.ts +4 -2
- package/Layout/utils.ts +181 -40
- package/Loader/DotLoader.tsx +3 -11
- package/Loader/Loader.tsx +0 -4
- package/Loader/ProgressBar.tsx +6 -3
- package/Loader/Spinner.tsx +3 -11
- package/Loader/styles.ts +0 -4
- package/Loader/utils.ts +7 -11
- package/Pagination/Dot.tsx +0 -4
- package/Pagination/PaginationDot.tsx +0 -1
- package/Pagination/PaginationNumber.tsx +3 -5
- package/Pagination/PaginationScroll.tsx +0 -5
- package/Pagination/PaginationWhiteDot.tsx +0 -1
- package/Pagination/index.tsx +0 -4
- package/Pagination/types.ts +2 -2
- package/Popup/PopupNotify.tsx +102 -94
- package/Popup/PopupPromotion.tsx +11 -9
- package/Popup/types.ts +4 -11
- package/Popup/utils.ts +18 -50
- package/Radio/index.tsx +10 -6
- package/Radio/styles.ts +0 -6
- package/Skeleton/index.tsx +9 -9
- package/Skeleton/styles.ts +0 -1
- package/Switch/index.tsx +0 -1
- package/Tag/index.tsx +4 -8
- package/Tag/types.ts +3 -3
- package/Text/index.tsx +5 -25
- package/Text/styles.ts +1 -1
- package/Text/types.ts +6 -1
- package/Text/utils.ts +4 -20
- package/Title/index.tsx +40 -42
- package/Title/styles.ts +0 -6
- package/ViewBoundary/index.tsx +2 -4
- package/index.ts +6 -0
- package/package.json +1 -2
- package/Application/BottomSheet.hooks.ts +0 -195
- package/Application/BottomSheet.parts.tsx +0 -157
- package/Application/BottomSheet.styles.ts +0 -43
- package/Application/BottomTab/ActiveIndicator.tsx +0 -91
- package/Application/BottomTab/BottomTabBar.styles.ts +0 -65
- package/Application/BottomTab/BottomTabInset.tsx +0 -18
- package/Application/BottomTab/CurvedContainer.tsx +0 -155
- package/Application/BottomTab/DuoRailTabBar.tsx +0 -223
- package/Application/BottomTab/DuoTabBar.styles.ts +0 -81
- package/Application/BottomTab/TabScreen.tsx +0 -160
- package/Application/BottomTab/metrics.ts +0 -164
- package/Application/BottomTab/tabItems.ts +0 -46
- package/Application/BottomTab/usePressLift.ts +0 -32
- package/Application/Components/HeaderRight.styles.ts +0 -146
- package/Application/Components/HeaderTitle.shared.ts +0 -44
- package/Application/Components/HeaderTitle.styles.ts +0 -125
- package/Application/Components/HeaderToolkitAction.tsx +0 -180
- package/Application/Components/SwipeBackHaptic.tsx +0 -95
- package/Application/Components/TitleJourney.tsx +0 -110
- package/Application/Components/TitleLocation.tsx +0 -73
- package/Application/Components/TitleUser.tsx +0 -304
- package/Application/Components/useToolkitActions.tsx +0 -218
- package/Application/ModalIconButton.tsx +0 -66
- package/Application/StackScreen.tracking.ts +0 -143
- package/Application/headerLayout.ts +0 -158
- package/Application/hooks.ts +0 -137
- package/Application/modalLayout.ts +0 -176
- package/Application/navigationOptions.tsx +0 -212
- package/Application/types.header.ts +0 -121
- package/Application/types.tabs.ts +0 -48
- package/Application/types.theme.ts +0 -87
- package/Application/utils.ts +0 -107
- package/Button/utils.ts +0 -133
- package/Input/InputMoneyView.tsx +0 -194
- package/Input/SearchTextTyping.tsx +0 -108
- package/Input/moneyUtils.ts +0 -23
- package/Layout/layoutMetrics.ts +0 -58
- package/Layout/layoutTypes.ts +0 -86
- package/Layout/screenContent.tsx +0 -92
- package/Layout/screenFooter.tsx +0 -63
- package/Layout/screenHeader.tsx +0 -321
- package/Layout/screenQuickReturn.tsx +0 -64
- package/Layout/screenScroll.ts +0 -107
- package/Layout/screenTypes.ts +0 -143
|
@@ -1,24 +1,63 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { Dimensions, StyleSheet, TouchableOpacity, 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 { MiniAppContext } from '../../Context';
|
|
9
|
-
import { exportFontFamily, useScaleSize } from '../../Text';
|
|
8
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
9
|
+
import { exportFontFamily, Text, useScaleSize } from '../../Text';
|
|
10
|
+
import { Colors, Radius, Spacing, Styles } from '../../Consts';
|
|
10
11
|
import {
|
|
11
12
|
TitleJourneyProps,
|
|
12
13
|
TitleLocationProps,
|
|
13
14
|
TitleUserProps,
|
|
14
15
|
} from '../types';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
import { Image } from '../../Image';
|
|
17
|
+
import { Icon } from '../../Icon';
|
|
18
|
+
import { Skeleton } from '../../Skeleton';
|
|
19
|
+
import {
|
|
20
|
+
AnimatedCompatValue,
|
|
21
|
+
isWhiteListDesignSystem,
|
|
22
|
+
useNormalizedSharedValue,
|
|
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
|
+
};
|
|
22
61
|
|
|
23
62
|
type HeaderTitleInterpolate = {
|
|
24
63
|
inputRange: number[];
|
|
@@ -33,8 +72,7 @@ type HeaderTitleExtraProps = {
|
|
|
33
72
|
};
|
|
34
73
|
|
|
35
74
|
/**
|
|
36
|
-
*
|
|
37
|
-
* scroll through `interpolate` (0 to 1 over the first 200pt by default).
|
|
75
|
+
* default header title used for nav
|
|
38
76
|
*/
|
|
39
77
|
const HeaderTitle: React.FC<
|
|
40
78
|
HeaderTitleExtraProps & { [key: string]: any }
|
|
@@ -70,8 +108,10 @@ const HeaderTitle: React.FC<
|
|
|
70
108
|
<View
|
|
71
109
|
pointerEvents={'none'}
|
|
72
110
|
style={[
|
|
73
|
-
|
|
74
|
-
|
|
111
|
+
{
|
|
112
|
+
justifyContent: 'center',
|
|
113
|
+
maxWidth,
|
|
114
|
+
},
|
|
75
115
|
showBaseLineDebug && styles.debugBaseLine,
|
|
76
116
|
]}
|
|
77
117
|
>
|
|
@@ -101,8 +141,8 @@ const HeaderTitle: React.FC<
|
|
|
101
141
|
};
|
|
102
142
|
|
|
103
143
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
144
|
+
* Title custom for header
|
|
145
|
+
* @constructor
|
|
106
146
|
*/
|
|
107
147
|
const TitleCustom: React.FC<any> = ({ type, data, ...props }) => {
|
|
108
148
|
switch (type) {
|
|
@@ -117,4 +157,527 @@ const TitleCustom: React.FC<any> = ({ type, data, ...props }) => {
|
|
|
117
157
|
}
|
|
118
158
|
};
|
|
119
159
|
|
|
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
|
+
|
|
120
683
|
export { HeaderTitle, TitleCustom };
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { NavigationButtonProps } from '../types';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
|
-
import { ApplicationContext } from '../../Context';
|
|
3
|
+
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
4
4
|
import { StyleSheet, TouchableOpacity, View, ViewStyle } from 'react-native';
|
|
5
5
|
import { Colors, Spacing } from '../../Consts';
|
|
6
6
|
import { Icon } from '../../Icon';
|
|
7
7
|
import { BadgeDot } from '../../Badge';
|
|
8
|
-
import { HeaderBarMetrics } from '../headerLayout';
|
|
9
|
-
|
|
10
|
-
const { buttonSize, iconSize } = HeaderBarMetrics;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
|
-
*
|
|
14
|
-
* dot; switches to a dark fill under a white tint so the icon stays readable.
|
|
10
|
+
* default navigation button used header nav
|
|
15
11
|
*/
|
|
16
12
|
const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
17
13
|
icon,
|
|
@@ -23,13 +19,13 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
23
19
|
let buttonStyle: ViewStyle = {};
|
|
24
20
|
if (tintColor === Colors.black_01) {
|
|
25
21
|
buttonStyle = {
|
|
26
|
-
backgroundColor:
|
|
27
|
-
borderColor:
|
|
22
|
+
backgroundColor: '#00000099',
|
|
23
|
+
borderColor: '#FFFFFF33',
|
|
28
24
|
};
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
return (
|
|
32
|
-
<View style={
|
|
28
|
+
<View style={{ width: 28 }}>
|
|
33
29
|
<TouchableOpacity
|
|
34
30
|
{...props}
|
|
35
31
|
style={[styles.navigationButton, buttonStyle]}
|
|
@@ -38,7 +34,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
38
34
|
<Icon
|
|
39
35
|
source={icon}
|
|
40
36
|
color={tintColor ?? theme.colors.text.default}
|
|
41
|
-
size={
|
|
37
|
+
size={20}
|
|
42
38
|
/>
|
|
43
39
|
</TouchableOpacity>
|
|
44
40
|
{showBadge && <BadgeDot size={'small'} style={styles.badgeDot} />}
|
|
@@ -47,17 +43,14 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
47
43
|
};
|
|
48
44
|
|
|
49
45
|
const styles = StyleSheet.create({
|
|
50
|
-
container: {
|
|
51
|
-
width: buttonSize,
|
|
52
|
-
},
|
|
53
46
|
navigationButton: {
|
|
54
|
-
height:
|
|
55
|
-
width:
|
|
56
|
-
borderRadius:
|
|
47
|
+
height: 28,
|
|
48
|
+
width: 28,
|
|
49
|
+
borderRadius: 14,
|
|
57
50
|
justifyContent: 'center',
|
|
58
51
|
alignItems: 'center',
|
|
59
|
-
backgroundColor:
|
|
60
|
-
borderColor:
|
|
52
|
+
backgroundColor: '#FFFFFF99',
|
|
53
|
+
borderColor: '#00000033',
|
|
61
54
|
borderWidth: 0.2,
|
|
62
55
|
},
|
|
63
56
|
badgeDot: {
|