@momo-kits/foundation 0.167.1-duotest.2 → 0.167.1

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.
Files changed (43) hide show
  1. package/Application/BottomSheet.tsx +14 -115
  2. package/Application/BottomTab/BottomTabBar.tsx +3 -6
  3. package/Application/BottomTab/index.tsx +135 -162
  4. package/Application/Components/HeaderExtendHeader.tsx +28 -75
  5. package/Application/Components/HeaderLeft.tsx +0 -38
  6. package/Application/Components/HeaderRight.tsx +9 -142
  7. package/Application/Components/HeaderTitle.tsx +7 -43
  8. package/Application/Components/SearchHeader.tsx +15 -22
  9. package/Application/ModalScreen.tsx +2 -16
  10. package/Application/NavigationContainer.tsx +38 -22
  11. package/Application/Navigator.ts +3 -1
  12. package/Application/StackScreen.tsx +9 -63
  13. package/Application/types.ts +1 -27
  14. package/Application/utils.tsx +6 -242
  15. package/Consts/theme.ts +4 -3
  16. package/Input/Input.tsx +4 -3
  17. package/Input/InputMoney.tsx +8 -5
  18. package/Input/InputPhoneNumber.tsx +4 -3
  19. package/Input/InputSearch.tsx +4 -3
  20. package/Input/InputTextArea.tsx +4 -3
  21. package/Layout/Card.tsx +26 -8
  22. package/Layout/FloatingButton.tsx +3 -3
  23. package/Layout/GridSystem.tsx +137 -0
  24. package/Layout/Item.tsx +10 -1
  25. package/Layout/Screen.tsx +52 -199
  26. package/Layout/Section.tsx +18 -5
  27. package/Layout/index.ts +4 -4
  28. package/Layout/styles.ts +0 -5
  29. package/Layout/utils.ts +5 -465
  30. package/Popup/PopupNotify.tsx +22 -33
  31. package/Popup/PopupPromotion.tsx +8 -20
  32. package/Text/utils.ts +2 -1
  33. package/package.json +2 -3
  34. package/Application/BottomTab/DuoBarCompression.tsx +0 -135
  35. package/Application/BottomTab/DuoTabBar.tsx +0 -462
  36. package/Application/Components/DuoGlassBackground.tsx +0 -179
  37. package/Application/Components/DuoQuickReturnHeader.tsx +0 -42
  38. package/Application/Components/OptionalGlassView.ts +0 -11
  39. package/Application/Components/OptionalScrollObserver.ts +0 -12
  40. package/Application/Components/SideBarButton.tsx +0 -139
  41. package/Application/device.ts +0 -29
  42. package/Layout/ReservedRegions.tsx +0 -47
  43. package/Popup/utils.ts +0 -32
@@ -1,6 +1,6 @@
1
1
  import React, { Ref, useContext } from 'react';
2
2
  import LinearGradient from 'react-native-linear-gradient';
3
- import { Platform, StyleSheet, View } from 'react-native';
3
+ import { Dimensions, Platform, StyleSheet, View } from 'react-native';
4
4
  import Animated, {
5
5
  Extrapolation,
6
6
  interpolate,
@@ -14,19 +14,21 @@ import { Colors, Radius, Spacing } from '../../Consts';
14
14
  import { Image } from '../../Image';
15
15
  import { SearchHeaderProps } from '../types';
16
16
  import BackgroundImageView from './BackgroundImageView';
17
- import { AnimatedCompatValue, useNormalizedSharedValue } from '../utils';
18
- import { useScreenLayout } from '../../Layout';
19
- import { DuoMetrics, HeaderMetrics } from '../../Layout/utils';
17
+ import {
18
+ AnimatedCompatValue,
19
+ useNormalizedSharedValue,
20
+ } from '../utils';
20
21
 
21
22
  const SCREEN_PADDING = 12;
22
23
  const BACK_WIDTH = 28;
23
- const TOOLKIT_WIDTH = 73;
24
+
25
+ const { width: screenWidth } = Dimensions.get('window');
24
26
 
25
27
  const HeaderExtendHeader: React.FC<{
26
28
  headerType?: HeaderType;
27
29
  animatedValue: AnimatedCompatValue;
28
30
  heightHeader: number;
29
- headerRightWidth?: number;
31
+ headerRightWidth: number;
30
32
  inputSearchProps?: SearchHeaderProps;
31
33
  inputSearchRef?: Ref<InputRef>;
32
34
  navigation?: Navigation;
@@ -37,7 +39,7 @@ const HeaderExtendHeader: React.FC<{
37
39
  headerType = 'default',
38
40
  animatedValue,
39
41
  heightHeader,
40
- headerRightWidth: customHeaderRightWidth,
42
+ headerRightWidth = 73,
41
43
  inputSearchProps,
42
44
  inputSearchRef,
43
45
  useShadowHeader: useShadowHeaderProp = true,
@@ -49,35 +51,7 @@ const HeaderExtendHeader: React.FC<{
49
51
  const sharedValue = useNormalizedSharedValue(animatedValue);
50
52
  const gradientColor = customGradientColor ?? theme.colors.gradient;
51
53
  const headerBackground = customBackground ?? theme.assets?.headerBackground;
52
- const layout = useScreenLayout();
53
-
54
- // the iPhone Duo status bar row keeps side bar sized back and toolkit
55
- const backWidth = layout.statusBarClearance
56
- ? DuoMetrics.controlSize
57
- : BACK_WIDTH;
58
- const toolkitWidth = layout.statusBarClearance
59
- ? DuoMetrics.itemPitch * 2 + SCREEN_PADDING
60
- : TOOLKIT_WIDTH;
61
- const leftPosition =
62
- inputSearchProps?.leftPosition ||
63
- (layout.sideBar ? SCREEN_PADDING : backWidth + 20);
64
- const headerRightWidth =
65
- customHeaderRightWidth ?? (layout.sideBar ? 0 : toolkitWidth);
66
- const contentLeft = layout.insetLeft + SCREEN_PADDING;
67
- const contentRight = layout.insetLeft + layout.contentWidth;
68
- // collapsed on the status bar row, the search stays between its clusters
69
- const collapsedLeft =
70
- layout.insetLeft + leftPosition + (layout.statusBarClearance?.left ?? 0);
71
- const collapsedRight = contentRight - (layout.statusBarClearance?.right ?? 0);
72
- const searchWidth = layout.contentWidth - SCREEN_PADDING * 2;
73
- const collapsedSearchWidth =
74
- collapsedRight - collapsedLeft - SCREEN_PADDING - headerRightWidth;
75
- // a row taller than barHeight (iPhone Duo) centers the collapsed search on the title
76
- const collapsedRaise =
77
- (layout.headerHeight -
78
- layout.headerStatusBarHeight -
79
- HeaderMetrics.barHeight) /
80
- 2;
54
+ const leftPosition = inputSearchProps?.leftPosition || BACK_WIDTH + 20;
81
55
 
82
56
  let useShadowHeader = useShadowHeaderProp;
83
57
  if (inputSearchProps && Platform.OS === 'android') {
@@ -96,12 +70,7 @@ const HeaderExtendHeader: React.FC<{
96
70
  }));
97
71
 
98
72
  const gradientOpacityStyle = useAnimatedStyle(() => ({
99
- opacity: interpolate(
100
- sharedValue.value,
101
- [0, 52],
102
- [1, 0],
103
- Extrapolation.CLAMP,
104
- ),
73
+ opacity: interpolate(sharedValue.value, [0, 52], [1, 0], Extrapolation.CLAMP),
105
74
  }));
106
75
 
107
76
  const searchTranslateStyle = useAnimatedStyle(() => ({
@@ -110,15 +79,7 @@ const HeaderExtendHeader: React.FC<{
110
79
  translateX: interpolate(
111
80
  sharedValue.value,
112
81
  [0, 100],
113
- [contentLeft, collapsedLeft],
114
- Extrapolation.CLAMP,
115
- ),
116
- },
117
- {
118
- translateY: interpolate(
119
- sharedValue.value,
120
- [0, 100],
121
- [0, -collapsedRaise],
82
+ [SCREEN_PADDING, leftPosition],
122
83
  Extrapolation.CLAMP,
123
84
  ),
124
85
  },
@@ -126,19 +87,19 @@ const HeaderExtendHeader: React.FC<{
126
87
  width: interpolate(
127
88
  sharedValue.value,
128
89
  [0, 100],
129
- [searchWidth, collapsedSearchWidth],
90
+ [
91
+ screenWidth - SCREEN_PADDING * 2,
92
+ screenWidth - leftPosition - 12 - headerRightWidth,
93
+ ],
130
94
  Extrapolation.CLAMP,
131
95
  ),
132
96
  }));
133
97
 
134
98
  const searchBackgroundStyle = useAnimatedStyle(() => {
135
99
  const t = Math.min(Math.max(sharedValue.value / 100, 0), 1);
136
- return {
137
- backgroundColor:
138
- t === 0
139
- ? theme.colors.background.surface
140
- : theme.colors.background.default,
141
- };
100
+ return { backgroundColor: t === 0
101
+ ? theme.colors.background.surface
102
+ : theme.colors.background.default };
142
103
  });
143
104
 
144
105
  const extendedHeightStyle = useAnimatedStyle(() => ({
@@ -163,17 +124,14 @@ const HeaderExtendHeader: React.FC<{
163
124
  <Animated.View
164
125
  style={[
165
126
  styles.headerBox,
166
- headerType === 'extended' ? heightStyle : { height: heightHeader },
127
+ headerType === 'extended'
128
+ ? heightStyle
129
+ : { height: heightHeader },
167
130
  ]}
168
131
  >
169
132
  {!!gradientColor && (
170
133
  <Animated.View
171
- style={[
172
- styles.extendedHeader,
173
- // fade out within the header box, as DuoScrollGradient does
174
- !!layout.sideBar && styles.fillHeaderBox,
175
- gradientOpacityStyle,
176
- ]}
134
+ style={[styles.extendedHeader, gradientOpacityStyle]}
177
135
  >
178
136
  <LinearGradient
179
137
  colors={[gradientColor, gradientColor + '00']}
@@ -204,7 +162,10 @@ const HeaderExtendHeader: React.FC<{
204
162
  style={[{ marginVertical: Spacing.S }, searchTranslateStyle]}
205
163
  >
206
164
  <Animated.View
207
- style={[{ borderRadius: Radius.XL }, searchBackgroundStyle]}
165
+ style={[
166
+ { borderRadius: Radius.XL },
167
+ searchBackgroundStyle,
168
+ ]}
208
169
  >
209
170
  <InputSearch
210
171
  {...inputSearchProps}
@@ -230,11 +191,7 @@ const HeaderExtendHeader: React.FC<{
230
191
  />
231
192
  {!!gradientColor && (
232
193
  <Animated.View
233
- style={[
234
- styles.extendedHeader,
235
- gradientOpacityStyle,
236
- extendedHeightStyle,
237
- ]}
194
+ style={[styles.extendedHeader, gradientOpacityStyle, extendedHeightStyle]}
238
195
  >
239
196
  <LinearGradient
240
197
  colors={[gradientColor, gradientColor + '00']}
@@ -270,10 +227,6 @@ const styles = StyleSheet.create({
270
227
  position: 'absolute',
271
228
  width: '100%',
272
229
  },
273
- fillHeaderBox: {
274
- aspectRatio: undefined,
275
- height: '100%',
276
- },
277
230
  headerBox: {
278
231
  width: '100%',
279
232
  position: 'absolute',
@@ -4,10 +4,6 @@ import React, { useCallback, useContext, useEffect } from 'react';
4
4
  import { ApplicationContext, MiniAppContext } from '../../Context';
5
5
  import { PopupNotify } from '../../Popup';
6
6
  import { NavigationButton } from './NavigationButton';
7
- import { SideBarButton } from './SideBarButton';
8
- import Animated from 'react-native-reanimated';
9
- import { useScreenLayout, useSideBarItemStyle } from '../../Layout/utils';
10
- import { useSideBarCounterStyle } from './DuoQuickReturnHeader';
11
7
 
12
8
  /**
13
9
  * default header left used for nav
@@ -17,13 +13,9 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
17
13
  preventBack,
18
14
  onPressLeftHeader,
19
15
  onBackHandler,
20
- floating = false,
21
16
  }) => {
22
17
  const context = useContext<any>(MiniAppContext);
23
18
  const { navigator } = useContext(ApplicationContext);
24
- const sideBarStyle = useSideBarItemStyle('left', 0);
25
- const counterStyle = useSideBarCounterStyle();
26
- const { statusBarClearance } = useScreenLayout();
27
19
 
28
20
  const goBack = useCallback(() => {
29
21
  const canGoBack = navigator?.ref?.current?.canGoBack?.();
@@ -80,36 +72,6 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
80
72
  return () => backHandler.remove();
81
73
  }, [goBackSafe]);
82
74
 
83
- if (floating && sideBarStyle) {
84
- return (
85
- <Animated.View
86
- style={[sideBarStyle, counterStyle]}
87
- pointerEvents={'box-none'}
88
- >
89
- <SideBarButton
90
- accessibilityLabel="btn_navigation_back"
91
- icon="arrow-back"
92
- tintColor={tintColor}
93
- onPress={goBackSafe}
94
- />
95
- </Animated.View>
96
- );
97
- }
98
-
99
- // on the status bar row the controls keep the side bar size
100
- if (statusBarClearance) {
101
- return (
102
- <View style={styles.headerLeft}>
103
- <SideBarButton
104
- accessibilityLabel="btn_navigation_back"
105
- icon="arrow-back"
106
- tintColor={tintColor}
107
- onPress={goBackSafe}
108
- />
109
- </View>
110
- );
111
- }
112
-
113
75
  return (
114
76
  <View style={styles.headerLeft}>
115
77
  <NavigationButton
@@ -13,12 +13,6 @@ import { PopupNotify } from '../../Popup';
13
13
  import { Tool, ToolGroup } from '../types';
14
14
  import { Icon } from '../../Icon';
15
15
  import { Text } from '../../Text';
16
- import Animated from 'react-native-reanimated';
17
- import { useScreenLayout, useSideBarItemStyle } from '../../Layout/utils';
18
- import { useSideBarCounterStyle } from './DuoQuickReturnHeader';
19
- import { SideBarButton, SideBarGroup, SideBarGroupItem } from './SideBarButton';
20
- import { useDuoBarCompression } from '../BottomTab/DuoBarCompression';
21
- import { DuoMetrics } from '../../Layout/utils';
22
16
 
23
17
  const DID_SYNC_NEW_HOME = 'did_sync_new_home';
24
18
 
@@ -27,10 +21,8 @@ const DID_SYNC_NEW_HOME = 'did_sync_new_home';
27
21
  */
28
22
  const HeaderRight: React.FC<any> = props => {
29
23
  const { translate } = useContext(ApplicationContext);
30
- const { headerRight = {}, floating = false } = props;
24
+ const { headerRight = {} } = props;
31
25
  const { useOnBoarding = false, buttonOnBoarding, onPress } = headerRight;
32
- const sideBarStyle = useSideBarItemStyle('right', 1);
33
- const counterStyle = useSideBarCounterStyle();
34
26
 
35
27
  if (typeof props.headerRight === 'function') {
36
28
  return props.headerRight(props);
@@ -46,21 +38,6 @@ const HeaderRight: React.FC<any> = props => {
46
38
  );
47
39
  }
48
40
 
49
- if (floating && sideBarStyle) {
50
- return (
51
- <Animated.View
52
- style={[sideBarStyle, counterStyle]}
53
- pointerEvents={'box-none'}
54
- >
55
- <HeaderToolkitAction
56
- {...props.headerRight}
57
- tintColor={props.tintColor}
58
- vertical
59
- />
60
- </Animated.View>
61
- );
62
- }
63
-
64
41
  return (
65
42
  <View style={styles.headerRightButton}>
66
43
  <HeaderToolkitAction {...props.headerRight} tintColor={props.tintColor} />
@@ -79,13 +56,9 @@ const HeaderToolkitAction: React.FC<any> = ({
79
56
  useMore = false,
80
57
  tools = [],
81
58
  useCloseIcon = false,
82
- vertical = false,
83
59
  }) => {
84
60
  const { navigator } = useContext(ApplicationContext);
85
61
  const context = useContext<any>(MiniAppContext);
86
- const { toolbarCompressed, toolbarHidden, expandToolbar, setToolbarHeight } =
87
- useDuoBarCompression();
88
- const { statusBarClearance } = useScreenLayout();
89
62
 
90
63
  const [isFavorite, setIsFavorite] = useState<boolean>(false);
91
64
  const [isLoading, setIsLoading] = useState(false);
@@ -287,111 +260,6 @@ const HeaderToolkitAction: React.FC<any> = ({
287
260
  group?.items?.some?.(tool => tool?.showBadge),
288
261
  );
289
262
 
290
- const useHelpCenter = context.appId !== 'vn.momo.helpcenter';
291
- const closeIcon = useCloseIcon
292
- ? '16_navigation_close_circle'
293
- : '16_basic_home';
294
-
295
- const groupCount = useHelpCenter ? 2 : 1;
296
- // Back slot, the optional shortcut, then the help/home capsule
297
- const fullToolbarHeight =
298
- DuoMetrics.controlSize +
299
- Spacing.M +
300
- (useShortcut ? DuoMetrics.controlSize + Spacing.M : 0) +
301
- (groupCount > 1
302
- ? groupCount * DuoMetrics.itemPitch
303
- : DuoMetrics.controlSize);
304
-
305
- useEffect(() => {
306
- if (vertical) {
307
- setToolbarHeight?.(fullToolbarHeight);
308
- }
309
- }, [vertical, fullToolbarHeight, setToolbarHeight]);
310
-
311
- // an open tab rail takes this slot for a moment
312
- if (vertical && toolbarHidden) {
313
- return null;
314
- }
315
-
316
- // HIG "Toolbar compressed": tools fold into one button; tapping it expands the
317
- // toolbar and compresses the tab bar instead. Not the useMore icon, to tell them apart
318
- if (vertical && toolbarCompressed) {
319
- return (
320
- <SideBarButton
321
- accessibilityLabel={'btn_navigation_toolbar'}
322
- icon={'navigation_menu'}
323
- tintColor={tintColor}
324
- showBadge={showBadge}
325
- onPress={expandToolbar}
326
- />
327
- );
328
- }
329
-
330
- if (vertical) {
331
- return (
332
- <View style={styles.sideBarColumn}>
333
- {useShortcut && (
334
- <SideBarButton
335
- disabled={isLoading}
336
- icon={iconShortcut}
337
- onPress={shortcutOnPress}
338
- tintColor={tintColor}
339
- showBadge={showBadge}
340
- />
341
- )}
342
- <SideBarGroup tintColor={tintColor}>
343
- {useHelpCenter && (
344
- <SideBarGroupItem
345
- accessibilityLabel={'btn_navigation_help_center'}
346
- icon={'help_center'}
347
- tintColor={tintColor}
348
- onPress={onPressHelpCenter}
349
- />
350
- )}
351
- <SideBarGroupItem
352
- accessibilityLabel={'btn_navigation_close'}
353
- icon={closeIcon}
354
- tintColor={tintColor}
355
- onPress={onClose}
356
- />
357
- </SideBarGroup>
358
- </View>
359
- );
360
- }
361
-
362
- // on the status bar row the controls keep the side bar size
363
- if (statusBarClearance) {
364
- return (
365
- <View style={styles.sideBarRow}>
366
- {useShortcut && (
367
- <SideBarButton
368
- disabled={isLoading}
369
- icon={iconShortcut}
370
- onPress={shortcutOnPress}
371
- tintColor={tintColor}
372
- showBadge={showBadge}
373
- />
374
- )}
375
- <SideBarGroup tintColor={tintColor} horizontal>
376
- {useHelpCenter && (
377
- <SideBarGroupItem
378
- accessibilityLabel={'btn_navigation_help_center'}
379
- icon={'help_center'}
380
- tintColor={tintColor}
381
- onPress={onPressHelpCenter}
382
- />
383
- )}
384
- <SideBarGroupItem
385
- accessibilityLabel={'btn_navigation_close'}
386
- icon={closeIcon}
387
- tintColor={tintColor}
388
- onPress={onClose}
389
- />
390
- </SideBarGroup>
391
- </View>
392
- );
393
- }
394
-
395
263
  return (
396
264
  <View style={Styles.row}>
397
265
  {useShortcut && (
@@ -412,7 +280,7 @@ const HeaderToolkitAction: React.FC<any> = ({
412
280
  },
413
281
  ]}
414
282
  >
415
- {useHelpCenter && (
283
+ {context.appId !== 'vn.momo.helpcenter' && (
416
284
  <>
417
285
  <TouchableOpacity
418
286
  accessibilityLabel={'btn_navigation_help_center'}
@@ -431,7 +299,13 @@ const HeaderToolkitAction: React.FC<any> = ({
431
299
  style={styles.toolkitButton}
432
300
  hitSlop={{ top: 7, bottom: 7, left: 0, right: 7 }}
433
301
  >
434
- <Icon color={tintColor} source={closeIcon} size={20} />
302
+ <Icon
303
+ color={tintColor}
304
+ source={
305
+ useCloseIcon ? '16_navigation_close_circle' : '16_basic_home'
306
+ }
307
+ size={20}
308
+ />
435
309
  </TouchableOpacity>
436
310
  </View>
437
311
  </View>
@@ -502,13 +376,6 @@ const styles = StyleSheet.create({
502
376
  width: 0.5,
503
377
  height: 12,
504
378
  },
505
- sideBarColumn: {
506
- gap: Spacing.M,
507
- },
508
- sideBarRow: {
509
- flexDirection: 'row',
510
- gap: Spacing.M,
511
- },
512
379
  headerLeft: {
513
380
  marginLeft: 12,
514
381
  },
@@ -21,43 +21,12 @@ import {
21
21
  isWhiteListDesignSystem,
22
22
  useNormalizedSharedValue,
23
23
  } from '../utils';
24
- import { useScreenLayout } from '../../Layout';
25
24
 
26
25
  const useHeaderFontFamily = (): string => {
27
26
  const context = useContext<any>(MiniAppContext);
28
27
  return isWhiteListDesignSystem(context) ? 'MoMoTrustDisplay' : 'SFProText';
29
28
  };
30
29
 
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
- const clearance = statusBarClearance
48
- ? statusBarClearance.left + statusBarClearance.right
49
- : 0;
50
- if (sideBar) {
51
- return contentWidth - Spacing.M * 2 - clearance;
52
- }
53
- return (
54
- width -
55
- HEADER_ACTIONS_WIDTH -
56
- (statusBarClearance ? STATUS_BAR_ROW_ACTIONS_EXTRA : 0) -
57
- clearance
58
- );
59
- };
60
-
61
30
  type HeaderTitleInterpolate = {
62
31
  inputRange: number[];
63
32
  outputRange: number[];
@@ -78,7 +47,6 @@ const HeaderTitle: React.FC<
78
47
  > = props => {
79
48
  const context = useContext<any>(MiniAppContext);
80
49
  const headerFontFamily = useHeaderFontFamily();
81
- const maxWidth = useTitleMaxWidth();
82
50
 
83
51
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
84
52
 
@@ -109,7 +77,7 @@ const HeaderTitle: React.FC<
109
77
  style={[
110
78
  {
111
79
  justifyContent: 'center',
112
- maxWidth,
80
+ maxWidth: Dimensions.get('window').width - 172,
113
81
  },
114
82
  showBaseLineDebug && styles.debugBaseLine,
115
83
  ]}
@@ -173,7 +141,7 @@ const TitleUser: React.FC<TitleUserProps> = ({
173
141
  }) => {
174
142
  const { theme } = useContext(ApplicationContext);
175
143
  const headerFontFamily = useHeaderFontFamily();
176
- const maxWidth = useTitleMaxWidth();
144
+ const maxWidth = Dimensions.get('window').width - 172;
177
145
  const getShortName = (name: string) => {
178
146
  const words = name.split(' ');
179
147
  const lastTwoWords = words.slice(-2);
@@ -456,7 +424,7 @@ const TitleLocation: React.FC<TitleLocationProps> = ({
456
424
  isLoading,
457
425
  }) => {
458
426
  const headerFontFamily = useHeaderFontFamily();
459
- const maxWidth = useTitleMaxWidth();
427
+ const maxWidth = Dimensions.get('window').width - 172;
460
428
  const renderShimmer = () => {
461
429
  return (
462
430
  <View style={Styles.flex}>
@@ -525,14 +493,10 @@ const TitleJourney: React.FC<TitleJourneyProps> = ({
525
493
  isLoading,
526
494
  }) => {
527
495
  const headerFontFamily = useHeaderFontFamily();
528
- const maxWidth = useTitleMaxWidth();
529
- const { sideBar } = useScreenLayout();
530
- // journey split is tuned against the whole bar width
531
- const barWidth = sideBar
532
- ? maxWidth + HEADER_ACTIONS_WIDTH
533
- : Dimensions.get('screen').width;
534
- const startWidth = barWidth * 0.25;
535
- const endWidth = barWidth * 0.75 - 212;
496
+ const { width } = Dimensions.get('screen');
497
+ const maxWidth = Dimensions.get('window').width - 172;
498
+ const startWidth = width * 0.25;
499
+ const endWidth = width * 0.75 - 212;
536
500
  const renderShimmer = () => {
537
501
  return (
538
502
  <View style={Styles.flex}>
@@ -1,14 +1,17 @@
1
1
  import { Colors, Radius, Spacing, Styles } from '../../Consts';
2
2
  import { InputRef, InputSearch } from '../../Input';
3
- import { StyleSheet, TouchableOpacity, View } from 'react-native';
3
+ import {
4
+ Dimensions,
5
+ StyleSheet,
6
+ TouchableOpacity,
7
+ View,
8
+ } from 'react-native';
4
9
  import Animated, { useAnimatedStyle } from 'react-native-reanimated';
5
10
  import React, { useContext } from 'react';
6
11
  import { SearchHeaderProps } from '../types';
7
12
  import { ApplicationContext, MiniAppContext } from '../../Context';
8
13
  import { Text } from '../../Text';
9
14
  import { useNormalizedSharedValue } from '../utils';
10
- import { useScreenLayout } from '../../Layout';
11
- import { DuoMetrics } from '../../Layout/utils';
12
15
 
13
16
  const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
14
17
  (
@@ -23,31 +26,19 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
23
26
  ) => {
24
27
  const { theme, navigator } = useContext(ApplicationContext);
25
28
  const context = useContext<any>(MiniAppContext);
26
- const layout = useScreenLayout();
27
- // the iPhone Duo status bar row keeps a side bar sized back button
28
- const BACK_WIDTH = layout.statusBarClearance ? DuoMetrics.controlSize : 28;
29
+ const BACK_WIDTH = 28;
30
+ const { width: screenWidth } = Dimensions.get('window');
29
31
 
30
32
  const sharedValue = useNormalizedSharedValue(animatedValue);
31
33
  const leftPosition = props?.leftPosition ?? BACK_WIDTH + 20;
32
34
  const headerRightWidth = props?.headerRightWidth ?? 73;
33
35
 
34
- // iPhone Duo side bar holds back: the search shares the content width with the buttons only
35
- let searchMaxWidth = layout.width - leftPosition - 12 - headerRightWidth;
36
- if (layout.sideBar) {
37
- searchMaxWidth = layout.contentWidth - Spacing.M * 2 - headerRightWidth;
38
- }
39
- if (layout.statusBarClearance) {
40
- searchMaxWidth -=
41
- layout.statusBarClearance.left + layout.statusBarClearance.right;
42
- }
43
-
44
36
  const backgroundStyle = useAnimatedStyle(() => {
45
37
  const t = Math.min(Math.max(sharedValue.value / 100, 0), 1);
46
38
  return {
47
- backgroundColor:
48
- t === 0
49
- ? theme.colors.background.surface
50
- : theme.colors.background.default,
39
+ backgroundColor: t === 0
40
+ ? theme.colors.background.surface
41
+ : theme.colors.background.default,
51
42
  };
52
43
  });
53
44
 
@@ -86,11 +77,13 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
86
77
  style={[
87
78
  Styles.flex,
88
79
  renderButtons && {
89
- maxWidth: searchMaxWidth,
80
+ maxWidth: screenWidth - leftPosition - 12 - headerRightWidth,
90
81
  },
91
82
  ]}
92
83
  >
93
- <Animated.View style={[{ borderRadius: Radius.XL }, backgroundStyle]}>
84
+ <Animated.View
85
+ style={[{ borderRadius: Radius.XL }, backgroundStyle]}
86
+ >
94
87
  <InputSearch
95
88
  ref={ref}
96
89
  {...props}
@@ -8,18 +8,15 @@ import {
8
8
  Platform,
9
9
  Pressable,
10
10
  StyleSheet,
11
- useWindowDimensions,
12
11
  View,
13
12
  } from 'react-native';
14
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
15
13
 
16
14
  import { ApplicationContext, MiniAppContext } from '../Context';
17
15
  import { Styles } from '../Consts';
18
16
  import Navigation from './Navigation';
19
17
  import { ModalParams } from './types';
20
18
  import BottomSheet from './BottomSheet';
21
- import { getDuoTopInset, isIPhoneDuo } from './device';
22
- import { scheduleOnRN } from 'react-native-worklets';
19
+ import { runOnJS } from 'react-native-reanimated';
23
20
 
24
21
  const ModalScreen: React.FC<any> = props => {
25
22
  if (props.route?.params?.isBottomSheet) {
@@ -40,8 +37,6 @@ const Modal: React.FC<ModalParams> = props => {
40
37
  title,
41
38
  } = props.route.params;
42
39
  const Component = useRef(screen).current;
43
- const insets = useSafeAreaInsets();
44
- const windowSize = useWindowDimensions();
45
40
 
46
41
  /**
47
42
  * Fire auto_popup_displayed tracking event on mount
@@ -111,7 +106,7 @@ const Modal: React.FC<ModalParams> = props => {
111
106
  }),
112
107
  ]).start(() => {
113
108
  navigator?.pop();
114
- scheduleOnRN(callback);
109
+ runOnJS(callback)();
115
110
  });
116
111
  },
117
112
  [navigator, opacity, scale],
@@ -152,15 +147,6 @@ const Modal: React.FC<ModalParams> = props => {
152
147
  opacity,
153
148
  transform: [{ scale }],
154
149
  },
155
- // center below the side status bar and above the home indicator
156
- isIPhoneDuo() && {
157
- marginTop: getDuoTopInset(
158
- insets,
159
- windowSize.width,
160
- windowSize.height,
161
- ),
162
- marginBottom: insets.bottom,
163
- },
164
150
  modalStyle,
165
151
  ]}
166
152
  >