@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,28 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
StyleSheet,
|
|
5
|
-
TouchableOpacity,
|
|
6
|
-
View,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
} from 'react-native';
|
|
9
|
-
import { NavigationButton } from './NavigationButton';
|
|
10
|
-
import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
11
|
-
import { Colors, Spacing, Styles } from '../../Consts';
|
|
12
|
-
import { PopupNotify } from '../../Popup';
|
|
13
|
-
import { Tool, ToolGroup } from '../types';
|
|
14
|
-
import { Icon } from '../../Icon';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { ApplicationContext } from '../../Context';
|
|
15
4
|
import { Text } from '../../Text';
|
|
16
5
|
import Animated from 'react-native-reanimated';
|
|
17
|
-
import {
|
|
6
|
+
import { useSideBarItemStyle } from '../../Layout/utils';
|
|
18
7
|
import { useSideBarCounterStyle } from './DuoQuickReturnHeader';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { DuoMetrics } from '../../Layout/utils';
|
|
22
|
-
|
|
23
|
-
const DID_SYNC_NEW_HOME = 'did_sync_new_home';
|
|
24
|
-
const CLOSE_ICON = '16_navigation_close_circle';
|
|
25
|
-
const HOME_ICON = '16_basic_home';
|
|
8
|
+
import { HeaderToolkitAction } from './HeaderToolkitAction';
|
|
9
|
+
import { styles } from './HeaderRight.styles';
|
|
26
10
|
|
|
27
11
|
/**
|
|
28
12
|
* main component for header right
|
|
@@ -70,510 +54,4 @@ const HeaderRight: React.FC<any> = props => {
|
|
|
70
54
|
);
|
|
71
55
|
};
|
|
72
56
|
|
|
73
|
-
/**
|
|
74
|
-
* Header toolkit action
|
|
75
|
-
*/
|
|
76
|
-
const HeaderToolkitAction: React.FC<any> = ({
|
|
77
|
-
tintColor,
|
|
78
|
-
preventClose,
|
|
79
|
-
useSystemTools = true,
|
|
80
|
-
useShortcut = false,
|
|
81
|
-
useMore = false,
|
|
82
|
-
tools = [],
|
|
83
|
-
useCloseIcon = false,
|
|
84
|
-
vertical = false,
|
|
85
|
-
}) => {
|
|
86
|
-
const { navigator } = useContext(ApplicationContext);
|
|
87
|
-
const context = useContext<any>(MiniAppContext);
|
|
88
|
-
const { toolbarCompressed, toolbarHidden, expandToolbar, setToolbarHeight } =
|
|
89
|
-
useDuoBarCompression();
|
|
90
|
-
const { statusBarClearance } = useScreenLayout();
|
|
91
|
-
|
|
92
|
-
const [isFavorite, setIsFavorite] = useState<boolean>(false);
|
|
93
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* check app is favorite
|
|
97
|
-
*/
|
|
98
|
-
const checkAppIsFavorite = useCallback(
|
|
99
|
-
() =>
|
|
100
|
-
navigator?.maxApi?.dispatchFunction?.(
|
|
101
|
-
'isFavoriteApp',
|
|
102
|
-
{ code: context?.code },
|
|
103
|
-
(result: boolean) => {
|
|
104
|
-
setIsFavorite(result);
|
|
105
|
-
},
|
|
106
|
-
),
|
|
107
|
-
[context?.code, navigator?.maxApi],
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (useShortcut) {
|
|
112
|
-
checkAppIsFavorite();
|
|
113
|
-
|
|
114
|
-
const favoriteObserver = navigator?.maxApi?.observer?.(
|
|
115
|
-
DID_SYNC_NEW_HOME,
|
|
116
|
-
(updatedData: any) => {
|
|
117
|
-
const status = updatedData?.items?.includes(context?.code);
|
|
118
|
-
setIsFavorite(status);
|
|
119
|
-
},
|
|
120
|
-
);
|
|
121
|
-
return () => {
|
|
122
|
-
favoriteObserver?.remove?.();
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
}, [useShortcut, context, checkAppIsFavorite, navigator?.maxApi]);
|
|
126
|
-
|
|
127
|
-
let buttonStyle: ViewStyle = {};
|
|
128
|
-
if (tintColor === Colors.black_01 || tintColor === 'white') {
|
|
129
|
-
buttonStyle = {
|
|
130
|
-
backgroundColor: '#00000099',
|
|
131
|
-
borderColor: '#FFFFFF33',
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const onDismiss = () => {
|
|
136
|
-
if (useCloseIcon) {
|
|
137
|
-
navigator?.maxApi?.dispatchFunction?.(
|
|
138
|
-
'dismiss',
|
|
139
|
-
navigator?.dismissData,
|
|
140
|
-
undefined,
|
|
141
|
-
);
|
|
142
|
-
} else {
|
|
143
|
-
navigator?.maxApi?.dispatchFunction?.('dismissAll');
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* close navigation container
|
|
149
|
-
*/
|
|
150
|
-
const onClose = () => {
|
|
151
|
-
const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
|
|
152
|
-
context?.autoTracking?.({
|
|
153
|
-
...context,
|
|
154
|
-
componentName: 'IconButton',
|
|
155
|
-
componentId: 'navigation_close',
|
|
156
|
-
screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
if (preventClose) {
|
|
160
|
-
navigator?.showModal({
|
|
161
|
-
screen: () => (
|
|
162
|
-
<PopupNotify
|
|
163
|
-
{...preventClose}
|
|
164
|
-
primary={{
|
|
165
|
-
title: preventClose.primary.title,
|
|
166
|
-
onPress: () => {
|
|
167
|
-
preventClose?.primary.onPress();
|
|
168
|
-
onDismiss();
|
|
169
|
-
},
|
|
170
|
-
}}
|
|
171
|
-
/>
|
|
172
|
-
),
|
|
173
|
-
});
|
|
174
|
-
} else {
|
|
175
|
-
onDismiss();
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* on press shortcut
|
|
181
|
-
*/
|
|
182
|
-
const onPressShortcut = () => {
|
|
183
|
-
const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
|
|
184
|
-
const expected = !isFavorite;
|
|
185
|
-
context?.autoTracking?.({
|
|
186
|
-
...context,
|
|
187
|
-
componentName: 'IconButton',
|
|
188
|
-
componentId: `${expected ? 'pin' : 'unpin'}_shortcut`,
|
|
189
|
-
screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
190
|
-
});
|
|
191
|
-
setIsLoading(true);
|
|
192
|
-
navigator?.maxApi?.dispatchFunction?.(
|
|
193
|
-
'onToolAction',
|
|
194
|
-
{
|
|
195
|
-
item: {
|
|
196
|
-
key: 'onFavorite',
|
|
197
|
-
},
|
|
198
|
-
context,
|
|
199
|
-
},
|
|
200
|
-
({ success }: { success: boolean }) => {
|
|
201
|
-
if (success) {
|
|
202
|
-
setIsFavorite(expected);
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
);
|
|
206
|
-
setTimeout(() => {
|
|
207
|
-
setIsLoading(false);
|
|
208
|
-
}, 1000);
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* on press help center
|
|
213
|
-
*/
|
|
214
|
-
const onPressHelpCenter = () => {
|
|
215
|
-
const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
|
|
216
|
-
context?.autoTracking?.({
|
|
217
|
-
...context,
|
|
218
|
-
componentName: 'IconButton',
|
|
219
|
-
componentId: 'navigation_helpcenter',
|
|
220
|
-
screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
navigator?.maxApi?.dispatchFunction?.('showHelpCenter', context);
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* on press icon more
|
|
228
|
-
*/
|
|
229
|
-
const onPressIconMore = () => {
|
|
230
|
-
const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
|
|
231
|
-
context?.autoTracking?.({
|
|
232
|
-
...context,
|
|
233
|
-
componentName: 'IconButton',
|
|
234
|
-
componentId: 'navigation_more',
|
|
235
|
-
screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
navigator?.maxApi?.dispatchFunction?.(
|
|
239
|
-
'showTools',
|
|
240
|
-
{
|
|
241
|
-
useSystemTools,
|
|
242
|
-
tools,
|
|
243
|
-
context,
|
|
244
|
-
},
|
|
245
|
-
(key: string) => {
|
|
246
|
-
for (const group of tools) {
|
|
247
|
-
const pressedTool = group?.items?.find?.(
|
|
248
|
-
(tool: Tool) => tool?.key === key,
|
|
249
|
-
);
|
|
250
|
-
if (pressedTool) {
|
|
251
|
-
pressedTool?.onPress();
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
);
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
let iconShortcut = isFavorite ? 'pin_star_checked' : 'pin_star';
|
|
260
|
-
let shortcutOnPress = onPressShortcut;
|
|
261
|
-
const totalTools = tools.reduce(
|
|
262
|
-
(count: number, group: ToolGroup) => count + group?.items?.length,
|
|
263
|
-
0,
|
|
264
|
-
);
|
|
265
|
-
const showIconMore = tools && totalTools > 1;
|
|
266
|
-
const isHaveOneTool = tools && totalTools === 1;
|
|
267
|
-
|
|
268
|
-
if (showIconMore || useMore) {
|
|
269
|
-
iconShortcut = 'navigation_more_icon';
|
|
270
|
-
shortcutOnPress = onPressIconMore;
|
|
271
|
-
} else if (isHaveOneTool) {
|
|
272
|
-
const singleTool = tools.find(
|
|
273
|
-
(group: ToolGroup) => group?.items?.length === 1,
|
|
274
|
-
)?.items[0];
|
|
275
|
-
iconShortcut = singleTool?.icon;
|
|
276
|
-
shortcutOnPress = () => {
|
|
277
|
-
singleTool?.onPress?.();
|
|
278
|
-
const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
|
|
279
|
-
context?.autoTracking?.({
|
|
280
|
-
...context,
|
|
281
|
-
componentName: 'IconButton',
|
|
282
|
-
componentId: 'navigation_shortcut',
|
|
283
|
-
screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
const showBadge = tools.some((group: ToolGroup) =>
|
|
289
|
-
group?.items?.some?.(tool => tool?.showBadge),
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
const useHelpCenter = context.appId !== 'vn.momo.helpcenter';
|
|
293
|
-
const closeIcon = useCloseIcon ? CLOSE_ICON : HOME_ICON;
|
|
294
|
-
|
|
295
|
-
const groupCount = useHelpCenter ? 2 : 1;
|
|
296
|
-
let capsuleHeight = DuoMetrics.controlSize;
|
|
297
|
-
if (groupCount > 1) {
|
|
298
|
-
capsuleHeight = groupCount * DuoMetrics.itemPitch;
|
|
299
|
-
}
|
|
300
|
-
// Back slot, the optional shortcut, then the help/home capsule
|
|
301
|
-
const fullToolbarHeight =
|
|
302
|
-
DuoMetrics.controlSize +
|
|
303
|
-
Spacing.M +
|
|
304
|
-
(useShortcut ? DuoMetrics.controlSize + Spacing.M : 0) +
|
|
305
|
-
capsuleHeight;
|
|
306
|
-
|
|
307
|
-
useEffect(() => {
|
|
308
|
-
if (vertical) {
|
|
309
|
-
setToolbarHeight?.(fullToolbarHeight);
|
|
310
|
-
}
|
|
311
|
-
}, [vertical, fullToolbarHeight, setToolbarHeight]);
|
|
312
|
-
|
|
313
|
-
// an open tab rail takes this slot for a moment
|
|
314
|
-
if (vertical && toolbarHidden) {
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// HIG "Toolbar compressed": tools fold into one button; tapping it expands the
|
|
319
|
-
// toolbar and compresses the tab bar instead. Not the useMore icon, to tell them apart
|
|
320
|
-
if (vertical && toolbarCompressed) {
|
|
321
|
-
return (
|
|
322
|
-
<SideBarButton
|
|
323
|
-
accessibilityLabel={'btn_navigation_toolbar'}
|
|
324
|
-
icon={'navigation_menu'}
|
|
325
|
-
tintColor={tintColor}
|
|
326
|
-
showBadge={showBadge}
|
|
327
|
-
onPress={expandToolbar}
|
|
328
|
-
/>
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (vertical) {
|
|
333
|
-
return (
|
|
334
|
-
<View style={styles.sideBarColumn}>
|
|
335
|
-
{useShortcut && (
|
|
336
|
-
<SideBarButton
|
|
337
|
-
disabled={isLoading}
|
|
338
|
-
icon={iconShortcut}
|
|
339
|
-
onPress={shortcutOnPress}
|
|
340
|
-
tintColor={tintColor}
|
|
341
|
-
showBadge={showBadge}
|
|
342
|
-
/>
|
|
343
|
-
)}
|
|
344
|
-
<SideBarGroup tintColor={tintColor}>
|
|
345
|
-
{useHelpCenter && (
|
|
346
|
-
<SideBarGroupItem
|
|
347
|
-
accessibilityLabel={'btn_navigation_help_center'}
|
|
348
|
-
icon={'help_center'}
|
|
349
|
-
tintColor={tintColor}
|
|
350
|
-
onPress={onPressHelpCenter}
|
|
351
|
-
/>
|
|
352
|
-
)}
|
|
353
|
-
<SideBarGroupItem
|
|
354
|
-
accessibilityLabel={'btn_navigation_close'}
|
|
355
|
-
icon={closeIcon}
|
|
356
|
-
tintColor={tintColor}
|
|
357
|
-
onPress={onClose}
|
|
358
|
-
/>
|
|
359
|
-
</SideBarGroup>
|
|
360
|
-
</View>
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// on the status bar row the controls keep the side bar size
|
|
365
|
-
if (statusBarClearance) {
|
|
366
|
-
return (
|
|
367
|
-
<View style={styles.sideBarRow}>
|
|
368
|
-
{useShortcut && (
|
|
369
|
-
<SideBarButton
|
|
370
|
-
disabled={isLoading}
|
|
371
|
-
icon={iconShortcut}
|
|
372
|
-
onPress={shortcutOnPress}
|
|
373
|
-
tintColor={tintColor}
|
|
374
|
-
showBadge={showBadge}
|
|
375
|
-
/>
|
|
376
|
-
)}
|
|
377
|
-
<SideBarGroup tintColor={tintColor} horizontal>
|
|
378
|
-
{useHelpCenter && (
|
|
379
|
-
<SideBarGroupItem
|
|
380
|
-
accessibilityLabel={'btn_navigation_help_center'}
|
|
381
|
-
icon={'help_center'}
|
|
382
|
-
tintColor={tintColor}
|
|
383
|
-
onPress={onPressHelpCenter}
|
|
384
|
-
/>
|
|
385
|
-
)}
|
|
386
|
-
<SideBarGroupItem
|
|
387
|
-
accessibilityLabel={'btn_navigation_close'}
|
|
388
|
-
icon={closeIcon}
|
|
389
|
-
tintColor={tintColor}
|
|
390
|
-
onPress={onClose}
|
|
391
|
-
/>
|
|
392
|
-
</SideBarGroup>
|
|
393
|
-
</View>
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
return (
|
|
398
|
-
<View style={Styles.row}>
|
|
399
|
-
{useShortcut && (
|
|
400
|
-
<NavigationButton
|
|
401
|
-
disabled={isLoading}
|
|
402
|
-
icon={iconShortcut}
|
|
403
|
-
onPress={shortcutOnPress}
|
|
404
|
-
tintColor={tintColor}
|
|
405
|
-
showBadge={showBadge}
|
|
406
|
-
/>
|
|
407
|
-
)}
|
|
408
|
-
<View
|
|
409
|
-
style={[
|
|
410
|
-
styles.toolkitContainer,
|
|
411
|
-
buttonStyle,
|
|
412
|
-
{
|
|
413
|
-
width: context.appId !== 'vn.momo.helpcenter' ? 65 : 28,
|
|
414
|
-
},
|
|
415
|
-
]}
|
|
416
|
-
>
|
|
417
|
-
{useHelpCenter && (
|
|
418
|
-
<>
|
|
419
|
-
<TouchableOpacity
|
|
420
|
-
accessibilityLabel={'btn_navigation_help_center'}
|
|
421
|
-
style={styles.toolkitButton}
|
|
422
|
-
onPress={onPressHelpCenter}
|
|
423
|
-
hitSlop={{ top: 7, bottom: 7, left: 7, right: 0 }}
|
|
424
|
-
>
|
|
425
|
-
<Icon color={tintColor} source={'help_center'} size={20} />
|
|
426
|
-
</TouchableOpacity>
|
|
427
|
-
<View style={[styles.divider, { backgroundColor: tintColor }]} />
|
|
428
|
-
</>
|
|
429
|
-
)}
|
|
430
|
-
<TouchableOpacity
|
|
431
|
-
accessibilityLabel={'btn_navigation_close'}
|
|
432
|
-
onPress={onClose}
|
|
433
|
-
style={styles.toolkitButton}
|
|
434
|
-
hitSlop={{ top: 7, bottom: 7, left: 0, right: 7 }}
|
|
435
|
-
>
|
|
436
|
-
<Icon color={tintColor} source={closeIcon} size={20} />
|
|
437
|
-
</TouchableOpacity>
|
|
438
|
-
</View>
|
|
439
|
-
</View>
|
|
440
|
-
);
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
const styles = StyleSheet.create({
|
|
444
|
-
navigationButton: {
|
|
445
|
-
height: 28,
|
|
446
|
-
width: 28,
|
|
447
|
-
borderRadius: 14,
|
|
448
|
-
justifyContent: 'center',
|
|
449
|
-
alignItems: 'center',
|
|
450
|
-
backgroundColor: '#FFFFFF99',
|
|
451
|
-
borderColor: '#00000033',
|
|
452
|
-
borderWidth: 0.2,
|
|
453
|
-
},
|
|
454
|
-
headerBackground: {
|
|
455
|
-
width: '100%',
|
|
456
|
-
height: undefined,
|
|
457
|
-
position: 'absolute',
|
|
458
|
-
aspectRatio: 375 / 154,
|
|
459
|
-
},
|
|
460
|
-
headerTitleContainer: {
|
|
461
|
-
alignItems: 'center',
|
|
462
|
-
justifyContent: 'center',
|
|
463
|
-
width: '70%',
|
|
464
|
-
},
|
|
465
|
-
circle: {
|
|
466
|
-
width: 32,
|
|
467
|
-
height: 32,
|
|
468
|
-
borderRadius: 16,
|
|
469
|
-
borderWidth: 0.5,
|
|
470
|
-
borderColor: Colors.black_04,
|
|
471
|
-
},
|
|
472
|
-
dotAvatar: {
|
|
473
|
-
position: 'absolute',
|
|
474
|
-
width: 12,
|
|
475
|
-
height: 12,
|
|
476
|
-
borderRadius: 6,
|
|
477
|
-
bottom: -2,
|
|
478
|
-
right: -2,
|
|
479
|
-
borderWidth: 2,
|
|
480
|
-
borderColor: Colors.black_01,
|
|
481
|
-
},
|
|
482
|
-
headerButton: { paddingHorizontal: 4 },
|
|
483
|
-
headerRightButton: {
|
|
484
|
-
flexDirection: 'row',
|
|
485
|
-
justifyContent: 'center',
|
|
486
|
-
alignItems: 'center',
|
|
487
|
-
paddingRight: Spacing.M,
|
|
488
|
-
},
|
|
489
|
-
toolkitContainer: {
|
|
490
|
-
height: 28,
|
|
491
|
-
borderRadius: 14,
|
|
492
|
-
justifyContent: 'center',
|
|
493
|
-
alignItems: 'center',
|
|
494
|
-
flexDirection: 'row',
|
|
495
|
-
backgroundColor: '#FFFFFF99',
|
|
496
|
-
borderColor: '#00000033',
|
|
497
|
-
borderWidth: 0.2,
|
|
498
|
-
marginLeft: Spacing.S,
|
|
499
|
-
},
|
|
500
|
-
toolkitButton: {
|
|
501
|
-
padding: 4,
|
|
502
|
-
},
|
|
503
|
-
divider: {
|
|
504
|
-
width: 0.5,
|
|
505
|
-
height: 12,
|
|
506
|
-
},
|
|
507
|
-
sideBarColumn: {
|
|
508
|
-
gap: Spacing.M,
|
|
509
|
-
},
|
|
510
|
-
sideBarRow: {
|
|
511
|
-
flexDirection: 'row',
|
|
512
|
-
gap: Spacing.M,
|
|
513
|
-
},
|
|
514
|
-
headerLeft: {
|
|
515
|
-
marginLeft: 12,
|
|
516
|
-
},
|
|
517
|
-
badge: {
|
|
518
|
-
position: 'absolute',
|
|
519
|
-
top: -Spacing.S,
|
|
520
|
-
right: -6,
|
|
521
|
-
},
|
|
522
|
-
badgeDot: {
|
|
523
|
-
position: 'absolute',
|
|
524
|
-
top: -Spacing.XXS,
|
|
525
|
-
right: -Spacing.XXS,
|
|
526
|
-
},
|
|
527
|
-
badgeDotAnimation: {
|
|
528
|
-
position: 'absolute',
|
|
529
|
-
top: -Spacing.XS,
|
|
530
|
-
right: -Spacing.XS,
|
|
531
|
-
},
|
|
532
|
-
gradientContainer: {
|
|
533
|
-
width: '100%',
|
|
534
|
-
height: '100%',
|
|
535
|
-
position: 'absolute',
|
|
536
|
-
overflow: 'hidden',
|
|
537
|
-
},
|
|
538
|
-
extendedHeader: {
|
|
539
|
-
aspectRatio: 2.43,
|
|
540
|
-
position: 'absolute',
|
|
541
|
-
width: '100%',
|
|
542
|
-
},
|
|
543
|
-
verifiedDot: {
|
|
544
|
-
width: 4,
|
|
545
|
-
height: 4,
|
|
546
|
-
borderRadius: 2,
|
|
547
|
-
backgroundColor: Colors.green_03,
|
|
548
|
-
position: 'absolute',
|
|
549
|
-
alignSelf: 'center',
|
|
550
|
-
},
|
|
551
|
-
shadowHeader: {
|
|
552
|
-
...Platform.select({
|
|
553
|
-
ios: {
|
|
554
|
-
shadowColor: Colors.black_20,
|
|
555
|
-
shadowOffset: {
|
|
556
|
-
width: 3,
|
|
557
|
-
height: 3,
|
|
558
|
-
},
|
|
559
|
-
shadowOpacity: 0.12,
|
|
560
|
-
shadowRadius: 10,
|
|
561
|
-
},
|
|
562
|
-
android: {
|
|
563
|
-
shadowColor: Colors.black_17,
|
|
564
|
-
shadowOffset: {
|
|
565
|
-
width: 3,
|
|
566
|
-
height: 3,
|
|
567
|
-
},
|
|
568
|
-
shadowOpacity: 0.12,
|
|
569
|
-
shadowRadius: 10,
|
|
570
|
-
elevation: 10,
|
|
571
|
-
},
|
|
572
|
-
}),
|
|
573
|
-
},
|
|
574
|
-
onBoarding: {
|
|
575
|
-
marginRight: Spacing.M,
|
|
576
|
-
},
|
|
577
|
-
});
|
|
578
|
-
|
|
579
57
|
export { HeaderRight };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { MiniAppContext } from '../../Context';
|
|
3
|
+
import { Spacing } from '../../Consts';
|
|
4
|
+
import { isWhiteListDesignSystem } from '../utils';
|
|
5
|
+
import { useScreenLayout } from '../../Layout';
|
|
6
|
+
|
|
7
|
+
const useHeaderFontFamily = (): string => {
|
|
8
|
+
const context = useContext<any>(MiniAppContext);
|
|
9
|
+
return isWhiteListDesignSystem(context) ? 'MoMoTrustDisplay' : 'SFProText';
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* back button and toolkit sharing the navigation bar with the title
|
|
14
|
+
*/
|
|
15
|
+
const HEADER_ACTIONS_WIDTH = 172;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* extra width the 48pt back and toolkit take on the iPhone Duo status bar row
|
|
19
|
+
*/
|
|
20
|
+
const STATUS_BAR_ROW_ACTIONS_EXTRA = 55;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* max title width, the iPhone Duo side bar takes back and toolkit out of the bar
|
|
24
|
+
*/
|
|
25
|
+
const useTitleMaxWidth = () => {
|
|
26
|
+
const { width, contentWidth, sideBar, statusBarClearance } =
|
|
27
|
+
useScreenLayout();
|
|
28
|
+
let clearance = 0;
|
|
29
|
+
if (statusBarClearance) {
|
|
30
|
+
clearance = statusBarClearance.left + statusBarClearance.right;
|
|
31
|
+
}
|
|
32
|
+
if (sideBar) {
|
|
33
|
+
return contentWidth - Spacing.M * 2 - clearance;
|
|
34
|
+
}
|
|
35
|
+
return (
|
|
36
|
+
width -
|
|
37
|
+
HEADER_ACTIONS_WIDTH -
|
|
38
|
+
(statusBarClearance ? STATUS_BAR_ROW_ACTIONS_EXTRA : 0) -
|
|
39
|
+
clearance
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { useHeaderFontFamily, HEADER_ACTIONS_WIDTH, useTitleMaxWidth };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors, Radius, Spacing } from '../../Consts';
|
|
3
|
+
|
|
4
|
+
export const styles = StyleSheet.create({
|
|
5
|
+
rowJourney: { flexDirection: 'row', width: '100%', alignItems: 'flex-start' },
|
|
6
|
+
verifiedDot: {
|
|
7
|
+
width: 4,
|
|
8
|
+
height: 4,
|
|
9
|
+
borderRadius: 2,
|
|
10
|
+
backgroundColor: Colors.green_03,
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
alignSelf: 'center',
|
|
13
|
+
},
|
|
14
|
+
circle: {
|
|
15
|
+
width: 32,
|
|
16
|
+
height: 32,
|
|
17
|
+
borderRadius: 16,
|
|
18
|
+
borderWidth: 0.5,
|
|
19
|
+
borderColor: Colors.black_04,
|
|
20
|
+
},
|
|
21
|
+
circleMedium: {
|
|
22
|
+
width: 24,
|
|
23
|
+
height: 24,
|
|
24
|
+
borderRadius: 16,
|
|
25
|
+
borderWidth: 0.5,
|
|
26
|
+
borderColor: Colors.black_04,
|
|
27
|
+
},
|
|
28
|
+
circleSmall: {
|
|
29
|
+
width: 16,
|
|
30
|
+
height: 16,
|
|
31
|
+
borderRadius: 16,
|
|
32
|
+
borderWidth: 0.5,
|
|
33
|
+
borderColor: Colors.black_04,
|
|
34
|
+
},
|
|
35
|
+
groupAvtContainer: {
|
|
36
|
+
width: Spacing.XXL,
|
|
37
|
+
height: Spacing.XXL,
|
|
38
|
+
position: 'relative',
|
|
39
|
+
},
|
|
40
|
+
imageContainer: {
|
|
41
|
+
width: 32,
|
|
42
|
+
height: 32,
|
|
43
|
+
borderRadius: 16,
|
|
44
|
+
backgroundColor: Colors.pink_09,
|
|
45
|
+
borderWidth: 0.5,
|
|
46
|
+
justifyContent: 'center',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
overflow: 'hidden',
|
|
49
|
+
},
|
|
50
|
+
dotAvatar: {
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
width: 12,
|
|
53
|
+
height: 12,
|
|
54
|
+
borderRadius: 6,
|
|
55
|
+
bottom: -2,
|
|
56
|
+
right: -2,
|
|
57
|
+
borderWidth: 2,
|
|
58
|
+
borderColor: Colors.black_01,
|
|
59
|
+
},
|
|
60
|
+
verifiedIcon: { width: 16, height: 16, marginLeft: Spacing.XS },
|
|
61
|
+
shimmerTitle: {
|
|
62
|
+
height: 18,
|
|
63
|
+
width: 120,
|
|
64
|
+
borderRadius: Radius.XS,
|
|
65
|
+
overflow: 'hidden',
|
|
66
|
+
},
|
|
67
|
+
shimmerDescription: {
|
|
68
|
+
height: 12,
|
|
69
|
+
width: 120,
|
|
70
|
+
borderRadius: Radius.XS,
|
|
71
|
+
overflow: 'hidden',
|
|
72
|
+
},
|
|
73
|
+
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
74
|
+
centerContent: {
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
},
|
|
77
|
+
centerStart: {
|
|
78
|
+
justifyContent: 'center',
|
|
79
|
+
alignItems: 'flex-start',
|
|
80
|
+
},
|
|
81
|
+
titleInfo: {
|
|
82
|
+
marginLeft: 6,
|
|
83
|
+
},
|
|
84
|
+
avatarEdgeTopRight: {
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
top: 0,
|
|
87
|
+
right: 0,
|
|
88
|
+
},
|
|
89
|
+
avatarEdgeBottomLeft: {
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
left: 0,
|
|
92
|
+
bottom: 0,
|
|
93
|
+
},
|
|
94
|
+
avatarTop: {
|
|
95
|
+
position: 'absolute',
|
|
96
|
+
top: 2,
|
|
97
|
+
},
|
|
98
|
+
avatarTopLeft: {
|
|
99
|
+
position: 'absolute',
|
|
100
|
+
top: 2,
|
|
101
|
+
left: 2,
|
|
102
|
+
},
|
|
103
|
+
avatarTopRight: {
|
|
104
|
+
position: 'absolute',
|
|
105
|
+
top: 2,
|
|
106
|
+
right: 2,
|
|
107
|
+
},
|
|
108
|
+
avatarBottomLeft: {
|
|
109
|
+
position: 'absolute',
|
|
110
|
+
left: 2,
|
|
111
|
+
bottom: 2,
|
|
112
|
+
},
|
|
113
|
+
avatarBottomRight: {
|
|
114
|
+
position: 'absolute',
|
|
115
|
+
bottom: 2,
|
|
116
|
+
right: 2,
|
|
117
|
+
},
|
|
118
|
+
avatarMore: {
|
|
119
|
+
backgroundColor: Colors.pink_09,
|
|
120
|
+
},
|
|
121
|
+
layer0: { zIndex: 0 },
|
|
122
|
+
layer1: { zIndex: 1 },
|
|
123
|
+
layer2: { zIndex: 2 },
|
|
124
|
+
layer3: { zIndex: 3 },
|
|
125
|
+
});
|