@momo-kits/foundation 0.169.7-beta.7 → 0.169.7-beta.9

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.
@@ -1,5 +1,4 @@
1
- import { StyleSheet, View } from 'react-native';
2
- import LinearGradient from 'react-native-linear-gradient';
1
+ import { StyleSheet } from 'react-native';
3
2
  import Animated, {
4
3
  Extrapolation,
5
4
  interpolate,
@@ -10,7 +9,6 @@ import React from 'react';
10
9
  import { Image } from '../../Image';
11
10
  import { Colors } from '../../Consts';
12
11
  import { useNormalizedSharedValue } from '../hooks';
13
- import { HeaderBarMetrics, useHeaderLayout } from '../headerLayout';
14
12
 
15
13
  const ASPECT_RATIOS: Record<
16
14
  NonNullable<HeaderAnimatedProps['aspectRatio']>,
@@ -23,19 +21,16 @@ const ASPECT_RATIOS: Record<
23
21
 
24
22
  /**
25
23
  * Parallax header image (or `children`): stretches when pulled down and fades out
26
- * as the content scrolls up. Wide windows keep it at phone size, centered.
24
+ * as the content scrolls up.
27
25
  */
28
26
  const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
29
27
  animatedValue,
30
28
  image,
31
29
  useScale = true,
32
30
  aspectRatio = '16/9',
33
- bannerBackgroundColor,
34
31
  children,
35
32
  }) => {
36
33
  const sharedValue = useNormalizedSharedValue(animatedValue);
37
- const { isWide, bannerWidth } = useHeaderLayout();
38
- const ratio = ASPECT_RATIOS[aspectRatio];
39
34
  const animatedStyle = useAnimatedStyle(() => {
40
35
  let scale = 1;
41
36
  if (useScale) {
@@ -64,36 +59,22 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
64
59
  };
65
60
  });
66
61
 
67
- const content = children ?? (
68
- <Image
69
- source={{
70
- uri: image,
71
- }}
72
- style={styles.full}
73
- />
74
- );
75
-
76
- if (!isWide) {
77
- return (
78
- <Animated.View
79
- style={[styles.container, { aspectRatio: ratio }, animatedStyle]}
80
- >
81
- {content}
82
- </Animated.View>
83
- );
84
- }
85
-
86
62
  return (
87
63
  <Animated.View
88
- style={[styles.container, { height: bannerWidth / ratio }, animatedStyle]}
64
+ style={[
65
+ styles.container,
66
+ { aspectRatio: ASPECT_RATIOS[aspectRatio] },
67
+ animatedStyle,
68
+ ]}
89
69
  >
90
- {!!bannerBackgroundColor && (
91
- <LinearGradient
92
- colors={[bannerBackgroundColor, bannerBackgroundColor + '00']}
93
- style={StyleSheet.absoluteFill}
70
+ {children ?? (
71
+ <Image
72
+ source={{
73
+ uri: image,
74
+ }}
75
+ style={styles.full}
94
76
  />
95
77
  )}
96
- <View style={styles.phoneBanner}>{content}</View>
97
78
  </Animated.View>
98
79
  );
99
80
  };
@@ -109,11 +90,6 @@ const styles = StyleSheet.create({
109
90
  alignSelf: 'center',
110
91
  },
111
92
  full: { width: '100%', height: '100%' },
112
- phoneBanner: {
113
- width: HeaderBarMetrics.bannerWidth,
114
- height: '100%',
115
- alignSelf: 'center',
116
- },
117
93
  });
118
94
 
119
95
  export { HeaderAnimated };
@@ -8,12 +8,10 @@ import { Colors, Styles } from '../../Consts';
8
8
  import { Image } from '../../Image';
9
9
  import BackgroundImageView from './BackgroundImageView';
10
10
  import { useNormalizedSharedValue } from '../hooks';
11
- import { HeaderBarMetrics, useHeaderLayout } from '../headerLayout';
12
11
 
13
12
  /**
14
13
  * Header background: surface and image that fade in on scroll, with an optional
15
- * gradient (custom or theme) on top, at phone height on wide windows. Outlined
16
- * when `showBaseLineDebug` is on.
14
+ * gradient (custom or theme) on top. Outlined when `showBaseLineDebug` is on.
17
15
  */
18
16
  const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
19
17
  animatedValue,
@@ -27,7 +25,6 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
27
25
  const gradientColor = customGradientColor ?? theme.colors.gradient;
28
26
  const headerImage = headerBackground ?? theme.assets?.headerBackground;
29
27
  const sharedValue = useNormalizedSharedValue(animatedValue);
30
- const { isWide } = useHeaderLayout();
31
28
 
32
29
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
33
30
 
@@ -41,19 +38,14 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
41
38
  />
42
39
  <View style={styles.gradientContainer}>
43
40
  {useGradient && !!gradientColor && (
44
- <Animated.View
45
- style={[styles.extendedHeader, isWide && styles.phoneHeight]}
46
- >
41
+ <Animated.View style={styles.extendedHeader}>
47
42
  <LinearGradient
48
43
  colors={[gradientColor, gradientColor + '00']}
49
44
  style={StyleSheet.absoluteFill}
50
45
  >
51
46
  {!!headerImage && (
52
47
  <Image
53
- style={[
54
- styles.headerBackground,
55
- isWide && styles.phoneHeight,
56
- ]}
48
+ style={styles.headerBackground}
57
49
  source={{ uri: headerImage }}
58
50
  loading={false}
59
51
  />
@@ -83,11 +75,6 @@ const styles = StyleSheet.create({
83
75
  position: 'absolute',
84
76
  aspectRatio: 375 / 154,
85
77
  },
86
- // wide windows keep the phone gradient height instead of scaling with the width
87
- phoneHeight: {
88
- aspectRatio: undefined,
89
- height: HeaderBarMetrics.gradientHeight,
90
- },
91
78
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
92
79
  });
93
80
 
@@ -17,16 +17,11 @@ import BackgroundImageView from './BackgroundImageView';
17
17
  import { type AnimatedCompatValue } from '../utils';
18
18
  import { useNormalizedSharedValue } from '../hooks';
19
19
  import { useScreenLayout } from '../../Layout';
20
- import { HeaderMetrics } from '../../Layout/utils';
21
- import {
22
- HeaderBarMetrics,
23
- type HeaderContentLayout,
24
- useHeaderLayout,
25
- } from '../headerLayout';
20
+ import { DuoMetrics, HeaderMetrics } from '../../Layout/utils';
26
21
 
27
- const { buttonSize, pillWidth, sidePadding, titleGap } = HeaderBarMetrics;
28
- const SCREEN_PADDING = sidePadding;
29
- const TOOLKIT_WIDTH = pillWidth + sidePadding;
22
+ const SCREEN_PADDING = 12;
23
+ const BACK_WIDTH = 28;
24
+ const TOOLKIT_WIDTH = 73;
30
25
 
31
26
  /**
32
27
  * Extended header background: a gradient that collapses on scroll and, with
@@ -43,7 +38,6 @@ const HeaderExtendHeader: React.FC<{
43
38
  useShadowHeader?: boolean;
44
39
  gradientColor?: string;
45
40
  headerBackground?: string;
46
- contentLayout?: HeaderContentLayout;
47
41
  }> = ({
48
42
  headerType = 'default',
49
43
  animatedValue,
@@ -54,7 +48,6 @@ const HeaderExtendHeader: React.FC<{
54
48
  useShadowHeader: useShadowHeaderProp = true,
55
49
  gradientColor: customGradientColor,
56
50
  headerBackground: customBackground,
57
- contentLayout,
58
51
  }) => {
59
52
  const { theme } = useContext(ApplicationContext);
60
53
  const context = useContext<any>(MiniAppContext);
@@ -62,32 +55,29 @@ const HeaderExtendHeader: React.FC<{
62
55
  const gradientColor = customGradientColor ?? theme.colors.gradient;
63
56
  const headerBackground = customBackground ?? theme.assets?.headerBackground;
64
57
  const layout = useScreenLayout();
65
- const headerLayout = useHeaderLayout(contentLayout);
66
- // the stretch frame pulls the search in from both bar edges
67
- const frameShift = headerLayout.frameInset - sidePadding;
68
58
 
69
- const backLeft = buttonSize + sidePadding + titleGap;
70
- const defaultLeft = layout.sideBar ? SCREEN_PADDING : backLeft;
59
+ // the iPhone Duo status bar row keeps side bar sized back and toolkit
60
+ const isStatusBarRow = !!layout.statusBarClearance;
61
+ const duoToolkitWidth = DuoMetrics.itemPitch * 2 + SCREEN_PADDING;
62
+ const backWidth = isStatusBarRow ? DuoMetrics.controlSize : BACK_WIDTH;
63
+ const toolkitWidth = isStatusBarRow ? duoToolkitWidth : TOOLKIT_WIDTH;
64
+ const defaultLeft = layout.sideBar ? SCREEN_PADDING : backWidth + 20;
71
65
  const leftPosition = inputSearchProps?.leftPosition || defaultLeft;
72
- const defaultRightWidth = layout.sideBar ? 0 : TOOLKIT_WIDTH;
66
+ const defaultRightWidth = layout.sideBar ? 0 : toolkitWidth;
73
67
  const headerRightWidth = customHeaderRightWidth ?? defaultRightWidth;
74
- const contentLeft = layout.insetLeft + SCREEN_PADDING + frameShift;
75
- const contentRight = layout.insetLeft + layout.contentWidth - frameShift;
68
+ const contentLeft = layout.insetLeft + SCREEN_PADDING;
69
+ const contentRight = layout.insetLeft + layout.contentWidth;
76
70
  // collapsed on the status bar row, the search stays between its clusters
77
71
  const clearanceLeft = layout.statusBarClearance?.left ?? 0;
78
72
  const clearanceRight = layout.statusBarClearance?.right ?? 0;
79
- const searchLeft = leftPosition + clearanceLeft + frameShift;
80
- const collapsedLeft = layout.insetLeft + searchLeft;
73
+ const collapsedLeft = layout.insetLeft + leftPosition + clearanceLeft;
81
74
  const collapsedRight = contentRight - clearanceRight - headerRightWidth;
82
- const searchWidth = contentRight - contentLeft - SCREEN_PADDING;
75
+ const searchWidth = layout.contentWidth - SCREEN_PADDING * 2;
83
76
  const collapsedSearchWidth = collapsedRight - collapsedLeft - SCREEN_PADDING;
84
77
  // a row taller than barHeight (iPhone Duo) centers the collapsed search on the title
85
78
  const titleRowHeight = layout.headerHeight - layout.headerStatusBarHeight;
86
79
  const collapsedRaise = (titleRowHeight - HeaderMetrics.barHeight) / 2;
87
80
 
88
- // the iPhone Duo side bar keeps the content search size
89
- const searchSize = layout.sideBar ? 'default' : 'header';
90
-
91
81
  let useShadowHeader = useShadowHeaderProp;
92
82
  if (inputSearchProps && Platform.OS === 'android') {
93
83
  useShadowHeader = false;
@@ -179,7 +169,6 @@ const HeaderExtendHeader: React.FC<{
179
169
  <Animated.View
180
170
  style={[
181
171
  styles.extendedHeader,
182
- headerLayout.isWide && styles.phoneHeight,
183
172
  // fade out within the header box, as DuoScrollGradient does
184
173
  !!layout.sideBar && styles.fillHeaderBox,
185
174
  gradientOpacityStyle,
@@ -191,10 +180,7 @@ const HeaderExtendHeader: React.FC<{
191
180
  >
192
181
  {!!theme.assets?.headerBackground && (
193
182
  <Image
194
- style={[
195
- styles.headerBackground,
196
- headerLayout.isWide && styles.phoneHeight,
197
- ]}
183
+ style={styles.headerBackground}
198
184
  source={{ uri: theme.assets?.headerBackground }}
199
185
  loading={false}
200
186
  />
@@ -203,7 +189,9 @@ const HeaderExtendHeader: React.FC<{
203
189
  </Animated.View>
204
190
  )}
205
191
  </Animated.View>
206
- <Animated.View style={[styles.searchContainer, heightStyle]}>
192
+ <Animated.View
193
+ style={[styles.searchContainer, heightStyle]}
194
+ >
207
195
  <Animated.View
208
196
  style={[{ marginVertical: Spacing.S }, searchTranslateStyle]}
209
197
  >
@@ -213,7 +201,6 @@ const HeaderExtendHeader: React.FC<{
213
201
  <InputSearch
214
202
  {...inputSearchProps}
215
203
  ref={inputSearchRef}
216
- size={searchSize}
217
204
  backgroundColor={'transparent'}
218
205
  showButtonText={false}
219
206
  />
@@ -249,10 +236,7 @@ const HeaderExtendHeader: React.FC<{
249
236
  >
250
237
  {!!headerBackground && (
251
238
  <Image
252
- style={[
253
- styles.headerBackground,
254
- headerLayout.isWide && styles.phoneHeight,
255
- ]}
239
+ style={styles.headerBackground}
256
240
  source={{ uri: headerBackground }}
257
241
  loading={false}
258
242
  />
@@ -280,11 +264,6 @@ const styles = StyleSheet.create({
280
264
  position: 'absolute',
281
265
  width: '100%',
282
266
  },
283
- // wide windows keep the phone gradient height instead of scaling with the width
284
- phoneHeight: {
285
- aspectRatio: undefined,
286
- height: HeaderBarMetrics.gradientHeight,
287
- },
288
267
  fillHeaderBox: {
289
268
  aspectRatio: undefined,
290
269
  height: '100%',
@@ -294,6 +273,14 @@ const styles = StyleSheet.create({
294
273
  position: 'absolute',
295
274
  overflow: 'hidden',
296
275
  },
276
+ verifiedDot: {
277
+ width: 4,
278
+ height: 4,
279
+ borderRadius: 2,
280
+ backgroundColor: Colors.green_03,
281
+ position: 'absolute',
282
+ alignSelf: 'center',
283
+ },
297
284
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
298
285
  container: {
299
286
  zIndex: 0,
@@ -6,13 +6,12 @@ import { PopupNotify } from '../../Popup';
6
6
  import { NavigationButton } from './NavigationButton';
7
7
  import { SideBarButton } from './SideBarButton';
8
8
  import Animated from 'react-native-reanimated';
9
- import { useSideBarItemStyle } from '../../Layout/utils';
9
+ import { useScreenLayout, useSideBarItemStyle } from '../../Layout/utils';
10
10
  import { useSideBarCounterStyle } from './DuoQuickReturnHeader';
11
- import { HeaderBarMetrics } from '../headerLayout';
12
11
 
13
12
  /**
14
13
  * Header back button, also bound to the Android hardware back. `preventBack`
15
- * confirms in a popup first; the iPhone Duo side bar uses the 48pt side bar button.
14
+ * confirms in a popup first; the iPhone Duo layouts use the 48pt side bar button.
16
15
  */
17
16
  const HeaderLeft: React.FC<HeaderBackProps> = ({
18
17
  tintColor,
@@ -25,6 +24,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
25
24
  const { navigator } = useContext(ApplicationContext);
26
25
  const sideBarStyle = useSideBarItemStyle('left', 0);
27
26
  const counterStyle = useSideBarCounterStyle();
27
+ const { statusBarClearance } = useScreenLayout();
28
28
 
29
29
  const goBack = useCallback(() => {
30
30
  const canGoBack = navigator?.ref?.current?.canGoBack?.();
@@ -97,6 +97,20 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
97
97
  );
98
98
  }
99
99
 
100
+ // on the status bar row the controls keep the side bar size
101
+ if (statusBarClearance) {
102
+ return (
103
+ <View style={styles.headerLeft}>
104
+ <SideBarButton
105
+ accessibilityLabel="btn_navigation_back"
106
+ icon="arrow-back"
107
+ tintColor={tintColor}
108
+ onPress={goBackSafe}
109
+ />
110
+ </View>
111
+ );
112
+ }
113
+
100
114
  return (
101
115
  <View style={styles.headerLeft}>
102
116
  <NavigationButton
@@ -111,7 +125,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
111
125
 
112
126
  const styles = StyleSheet.create({
113
127
  headerLeft: {
114
- marginLeft: HeaderBarMetrics.sidePadding,
128
+ marginLeft: 12,
115
129
  },
116
130
  });
117
131
 
@@ -1,14 +1,11 @@
1
1
  import { Platform, StyleSheet } from 'react-native';
2
2
  import { Colors, Spacing } from '../../Consts';
3
- import { HeaderBarMetrics } from '../headerLayout';
4
-
5
- const { buttonSize, pillWidth, pillHeight, sidePadding } = HeaderBarMetrics;
6
3
 
7
4
  export const styles = StyleSheet.create({
8
5
  navigationButton: {
9
- height: buttonSize,
10
- width: buttonSize,
11
- borderRadius: buttonSize / 2,
6
+ height: 28,
7
+ width: 28,
8
+ borderRadius: 14,
12
9
  justifyContent: 'center',
13
10
  alignItems: 'center',
14
11
  backgroundColor: Colors.black_01 + '99',
@@ -48,11 +45,11 @@ export const styles = StyleSheet.create({
48
45
  flexDirection: 'row',
49
46
  justifyContent: 'center',
50
47
  alignItems: 'center',
51
- paddingRight: sidePadding,
48
+ paddingRight: Spacing.M,
52
49
  },
53
50
  toolkitContainer: {
54
- height: pillHeight,
55
- borderRadius: pillHeight / 2,
51
+ height: 28,
52
+ borderRadius: 14,
56
53
  justifyContent: 'center',
57
54
  alignItems: 'center',
58
55
  flexDirection: 'row',
@@ -62,10 +59,7 @@ export const styles = StyleSheet.create({
62
59
  marginLeft: Spacing.S,
63
60
  },
64
61
  toolkitButton: {
65
- flex: 1,
66
- height: '100%',
67
- justifyContent: 'center',
68
- alignItems: 'center',
62
+ padding: 4,
69
63
  },
70
64
  divider: {
71
65
  width: 0.5,
@@ -74,6 +68,10 @@ export const styles = StyleSheet.create({
74
68
  sideBarColumn: {
75
69
  gap: Spacing.M,
76
70
  },
71
+ sideBarRow: {
72
+ flexDirection: 'row',
73
+ gap: Spacing.M,
74
+ },
77
75
  headerLeft: {
78
76
  marginLeft: 12,
79
77
  },
@@ -138,9 +136,9 @@ export const styles = StyleSheet.create({
138
136
  marginRight: Spacing.M,
139
137
  },
140
138
  toolkitWide: {
141
- width: pillWidth,
139
+ width: 65,
142
140
  },
143
141
  toolkitNarrow: {
144
- width: buttonSize,
142
+ width: 28,
145
143
  },
146
144
  });
@@ -3,9 +3,6 @@ import { MiniAppContext } from '../../Context';
3
3
  import { Spacing } from '../../Consts';
4
4
  import { isWhiteListDesignSystem } from '../utils';
5
5
  import { useScreenLayout } from '../../Layout';
6
- import { HeaderBarMetrics } from '../headerLayout';
7
-
8
- const { sidePadding, buttonSize, titleGap, clusterWidth } = HeaderBarMetrics;
9
6
 
10
7
  /**
11
8
  * Header title font: MoMoTrustDisplay for design-system whitelisted mini apps,
@@ -17,28 +14,32 @@ const useHeaderFontFamily = (): string => {
17
14
  };
18
15
 
19
16
  /**
20
- * side paddings, back button, title gaps and right cluster sharing the
21
- * navigation bar with the title
17
+ * back button and toolkit sharing the navigation bar with the title
18
+ */
19
+ const HEADER_ACTIONS_WIDTH = 172;
20
+
21
+ /**
22
+ * extra width the 48pt back and toolkit take on the iPhone Duo status bar row
22
23
  */
23
- const HEADER_ACTIONS_WIDTH =
24
- sidePadding * 2 + buttonSize + titleGap * 2 + clusterWidth;
24
+ const STATUS_BAR_ROW_ACTIONS_EXTRA = 55;
25
25
 
26
26
  /**
27
27
  * Max header title width. The iPhone Duo side bar takes back and toolkit out of
28
- * the bar, so the title gets the content width; otherwise it shares the bar with
29
- * them, minus the status bar clusters on the iPhone Duo inner portrait row.
28
+ * the bar, so the title gets the content width; otherwise it shares the bar with them.
30
29
  */
31
30
  const useTitleMaxWidth = () => {
32
31
  const layout = useScreenLayout();
33
32
  const { width, contentWidth, sideBar, statusBarClearance } = layout;
34
33
  let clearance = 0;
34
+ let rowActionsExtra = 0;
35
35
  if (statusBarClearance) {
36
36
  clearance = statusBarClearance.left + statusBarClearance.right;
37
+ rowActionsExtra = STATUS_BAR_ROW_ACTIONS_EXTRA;
37
38
  }
38
39
  if (sideBar) {
39
40
  return contentWidth - Spacing.M * 2 - clearance;
40
41
  }
41
- return width - HEADER_ACTIONS_WIDTH - clearance;
42
+ return width - HEADER_ACTIONS_WIDTH - rowActionsExtra - clearance;
42
43
  };
43
44
 
44
45
  export { useHeaderFontFamily, HEADER_ACTIONS_WIDTH, useTitleMaxWidth };
@@ -4,12 +4,11 @@ import { NavigationButton } from './NavigationButton';
4
4
  import { MiniAppContext } from '../../Context';
5
5
  import { Colors, Spacing, Styles } from '../../Consts';
6
6
  import { Icon } from '../../Icon';
7
- import { DuoMetrics } from '../../Layout/utils';
7
+ import { DuoMetrics, useScreenLayout } from '../../Layout/utils';
8
8
  import { SideBarButton, SideBarGroup, SideBarGroupItem } from './SideBarButton';
9
9
  import { useDuoBarCompression } from '../BottomTab/DuoBarCompression';
10
10
  import { styles } from './HeaderRight.styles';
11
11
  import { useToolkitActions } from './useToolkitActions';
12
- import { HeaderBarMetrics } from '../headerLayout';
13
12
 
14
13
  const CLOSE_ICON = '16_navigation_close_circle';
15
14
  const HOME_ICON = '16_basic_home';
@@ -32,6 +31,7 @@ const HeaderToolkitAction: React.FC<any> = ({
32
31
  const compression = useDuoBarCompression();
33
32
  const { toolbarCompressed, toolbarHidden } = compression;
34
33
  const { expandToolbar, setToolbarHeight } = compression;
34
+ const { statusBarClearance } = useScreenLayout();
35
35
  const {
36
36
  isLoading,
37
37
  iconShortcut,
@@ -131,6 +131,39 @@ const HeaderToolkitAction: React.FC<any> = ({
131
131
  );
132
132
  }
133
133
 
134
+ // on the status bar row the controls keep the side bar size
135
+ if (statusBarClearance) {
136
+ return (
137
+ <View style={styles.sideBarRow}>
138
+ {useShortcut && (
139
+ <SideBarButton
140
+ disabled={isLoading}
141
+ icon={iconShortcut}
142
+ onPress={shortcutOnPress}
143
+ tintColor={tintColor}
144
+ showBadge={showBadge}
145
+ />
146
+ )}
147
+ <SideBarGroup tintColor={tintColor} horizontal>
148
+ {useHelpCenter && (
149
+ <SideBarGroupItem
150
+ accessibilityLabel={'btn_navigation_help_center'}
151
+ icon={'help_center'}
152
+ tintColor={tintColor}
153
+ onPress={onPressHelpCenter}
154
+ />
155
+ )}
156
+ <SideBarGroupItem
157
+ accessibilityLabel={'btn_navigation_close'}
158
+ icon={closeIcon}
159
+ tintColor={tintColor}
160
+ onPress={onClose}
161
+ />
162
+ </SideBarGroup>
163
+ </View>
164
+ );
165
+ }
166
+
134
167
  return (
135
168
  <View style={Styles.row}>
136
169
  {useShortcut && (
@@ -151,11 +184,7 @@ const HeaderToolkitAction: React.FC<any> = ({
151
184
  onPress={onPressHelpCenter}
152
185
  hitSlop={{ top: 7, bottom: 7, left: 7, right: 0 }}
153
186
  >
154
- <Icon
155
- color={tintColor}
156
- source={'help_center'}
157
- size={HeaderBarMetrics.iconSize}
158
- />
187
+ <Icon color={tintColor} source={'help_center'} size={20} />
159
188
  </TouchableOpacity>
160
189
  <View style={[styles.divider, { backgroundColor: tintColor }]} />
161
190
  </>
@@ -166,11 +195,7 @@ const HeaderToolkitAction: React.FC<any> = ({
166
195
  style={styles.toolkitButton}
167
196
  hitSlop={{ top: 7, bottom: 7, left: 0, right: 7 }}
168
197
  >
169
- <Icon
170
- color={tintColor}
171
- source={closeIcon}
172
- size={HeaderBarMetrics.iconSize}
173
- />
198
+ <Icon color={tintColor} source={closeIcon} size={20} />
174
199
  </TouchableOpacity>
175
200
  </View>
176
201
  </View>
@@ -5,12 +5,9 @@ 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
- * Round 32pt icon button of the header (back, shortcut) with an optional badge
10
+ * Round 28pt icon button of the header (back, shortcut) with an optional badge
14
11
  * dot; switches to a dark fill under a white tint so the icon stays readable.
15
12
  */
16
13
  const NavigationButton: React.FC<NavigationButtonProps> = ({
@@ -38,7 +35,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
38
35
  <Icon
39
36
  source={icon}
40
37
  color={tintColor ?? theme.colors.text.default}
41
- size={iconSize}
38
+ size={20}
42
39
  />
43
40
  </TouchableOpacity>
44
41
  {showBadge && <BadgeDot size={'small'} style={styles.badgeDot} />}
@@ -48,12 +45,12 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
48
45
 
49
46
  const styles = StyleSheet.create({
50
47
  container: {
51
- width: buttonSize,
48
+ width: 28,
52
49
  },
53
50
  navigationButton: {
54
- height: buttonSize,
55
- width: buttonSize,
56
- borderRadius: buttonSize / 2,
51
+ height: 28,
52
+ width: 28,
53
+ borderRadius: 14,
57
54
  justifyContent: 'center',
58
55
  alignItems: 'center',
59
56
  backgroundColor: Colors.black_01 + '99',
@@ -1,5 +1,5 @@
1
1
  import { Colors, Radius, Spacing, Styles } from '../../Consts';
2
- import { InputRef, InputSearch, type InputSearchProps } from '../../Input';
2
+ import { InputRef, InputSearch } from '../../Input';
3
3
  import { StyleSheet, TouchableOpacity, View } from 'react-native';
4
4
  import Animated, { useAnimatedStyle } from 'react-native-reanimated';
5
5
  import React, { useContext } from 'react';
@@ -8,13 +8,7 @@ import { ApplicationContext, MiniAppContext } from '../../Context';
8
8
  import { Text } from '../../Text';
9
9
  import { useNormalizedSharedValue } from '../hooks';
10
10
  import { useScreenLayout } from '../../Layout';
11
- import { HeaderBarMetrics } from '../headerLayout';
12
-
13
- const { buttonSize, pillWidth, sidePadding, titleGap } = HeaderBarMetrics;
14
- // help center | home pill and the bar padding right of it
15
- const TOOLKIT_WIDTH = pillWidth + sidePadding;
16
- // the iPhone Duo side bar keeps its right header width
17
- const DUO_TOOLKIT_WIDTH = 73;
11
+ import { DuoMetrics } from '../../Layout/utils';
18
12
 
19
13
  /**
20
14
  * Header search bar whose fill turns from surface to default once scrolled, with
@@ -34,21 +28,15 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
34
28
  const { theme, navigator } = useContext(ApplicationContext);
35
29
  const context = useContext<any>(MiniAppContext);
36
30
  const layout = useScreenLayout();
37
- let defaultRightWidth = TOOLKIT_WIDTH;
38
- let searchSize: InputSearchProps['size'] = 'header';
39
- if (layout.sideBar) {
40
- defaultRightWidth = DUO_TOOLKIT_WIDTH;
41
- searchSize = 'default';
42
- }
31
+ // the iPhone Duo status bar row keeps a side bar sized back button
32
+ const BACK_WIDTH = layout.statusBarClearance ? DuoMetrics.controlSize : 28;
43
33
 
44
34
  const sharedValue = useNormalizedSharedValue(animatedValue);
45
- const defaultLeft = buttonSize + sidePadding + titleGap;
46
- const leftPosition = props?.leftPosition ?? defaultLeft;
47
- const headerRightWidth = props?.headerRightWidth ?? defaultRightWidth;
35
+ const leftPosition = props?.leftPosition ?? BACK_WIDTH + 20;
36
+ const headerRightWidth = props?.headerRightWidth ?? 73;
48
37
 
49
38
  // iPhone Duo side bar holds back: the search shares the content width with the buttons only
50
- const rowWidth = layout.width - leftPosition - sidePadding;
51
- let searchMaxWidth = rowWidth - headerRightWidth;
39
+ let searchMaxWidth = layout.width - leftPosition - 12 - headerRightWidth;
52
40
  if (layout.sideBar) {
53
41
  searchMaxWidth = layout.contentWidth - Spacing.M * 2 - headerRightWidth;
54
42
  }
@@ -117,7 +105,6 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
117
105
  <InputSearch
118
106
  ref={ref}
119
107
  {...props}
120
- size={searchSize}
121
108
  backgroundColor={'transparent'}
122
109
  showButtonText={false}
123
110
  />