@momo-kits/foundation 0.169.8 → 0.169.9-beta.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 (32) hide show
  1. package/Application/BottomTab/ActiveIndicator.tsx +1 -5
  2. package/Application/BottomTab/BottomTabBar.styles.ts +1 -18
  3. package/Application/BottomTab/BottomTabBar.tsx +10 -8
  4. package/Application/BottomTab/CurvedContainer.tsx +2 -8
  5. package/Application/BottomTab/CustomBottomTabItem.tsx +2 -2
  6. package/Application/BottomTab/DuoTabBar.tsx +3 -15
  7. package/Application/BottomTab/metrics.ts +3 -23
  8. package/Application/Components/HeaderAnimated.tsx +38 -13
  9. package/Application/Components/HeaderBackground.tsx +16 -3
  10. package/Application/Components/HeaderExtendHeader.tsx +41 -28
  11. package/Application/Components/HeaderLeft.tsx +4 -18
  12. package/Application/Components/HeaderRight.styles.ts +15 -13
  13. package/Application/Components/HeaderTitle.shared.ts +10 -11
  14. package/Application/Components/HeaderToolkitAction.tsx +12 -37
  15. package/Application/Components/NavigationButton.tsx +9 -6
  16. package/Application/Components/SearchHeader.tsx +20 -7
  17. package/Application/StackScreen.tsx +9 -0
  18. package/Application/headerLayout.ts +165 -0
  19. package/Application/index.ts +11 -1
  20. package/Application/modalLayout.ts +0 -3
  21. package/Application/navigationOptions.tsx +6 -15
  22. package/Application/types.header.ts +7 -2
  23. package/Application/types.tabs.ts +1 -0
  24. package/Application/types.ts +7 -0
  25. package/Input/InputSearch.tsx +18 -2
  26. package/Input/index.tsx +7 -1
  27. package/Layout/Screen.tsx +3 -0
  28. package/Layout/screenHeader.tsx +55 -52
  29. package/Layout/screenTypes.ts +10 -2
  30. package/Popup/PopupNotify.tsx +1 -1
  31. package/Popup/utils.ts +4 -7
  32. package/package.json +1 -1
@@ -5,7 +5,6 @@ import Animated, {
5
5
  useSharedValue,
6
6
  withTiming,
7
7
  } from 'react-native-reanimated';
8
- import { defaultTheme } from '../../Consts';
9
8
  import { ApplicationContext } from '../../Context';
10
9
  import { getIndicatorShadow, TabBarMotion } from './metrics';
11
10
 
@@ -71,10 +70,7 @@ const ActiveIndicator: React.FC<Props> = ({
71
70
  styles.indicator,
72
71
  {
73
72
  borderRadius: radius,
74
- // a mini app's own theme may lack `tonal`; without the fallback the indicator is transparent
75
- backgroundColor:
76
- theme.colors.background.tonal ??
77
- defaultTheme.colors.background.tonal,
73
+ backgroundColor: theme.colors.background.tonal,
78
74
  boxShadow: getIndicatorShadow(theme.colors.primary),
79
75
  },
80
76
  style,
@@ -2,20 +2,6 @@ import { StyleSheet } from 'react-native';
2
2
  import { Colors, Spacing } from '../../Consts';
3
3
  import { CTA_SHADOW, TabBarMetrics } from './metrics';
4
4
 
5
- const ITEM_HEIGHT =
6
- TabBarMetrics.indicatorHeight +
7
- TabBarMetrics.itemIconLabelGap +
8
- TabBarMetrics.labelHeight;
9
- const CONTENT_HEIGHT = TabBarMetrics.height - 2 * TabBarMetrics.paddingVertical;
10
- // the items are centered in the content, so their label starts this far below the content top
11
- const ITEM_LABEL_TOP =
12
- (CONTENT_HEIGHT - ITEM_HEIGHT) / 2 +
13
- TabBarMetrics.indicatorHeight +
14
- TabBarMetrics.itemIconLabelGap;
15
- // the center action column is placed so its label starts on the same line as the tab labels
16
- const CTA_TOP =
17
- ITEM_LABEL_TOP - TabBarMetrics.ctaLabelGap - TabBarMetrics.ctaSize;
18
-
19
5
  export const styles = StyleSheet.create({
20
6
  bar: {
21
7
  position: 'absolute',
@@ -51,7 +37,7 @@ export const styles = StyleSheet.create({
51
37
  position: 'absolute',
52
38
  left: 0,
53
39
  right: 0,
54
- top: CTA_TOP,
40
+ top: -TabBarMetrics.ctaLift - TabBarMetrics.paddingVertical,
55
41
  alignItems: 'center',
56
42
  gap: TabBarMetrics.ctaLabelGap,
57
43
  },
@@ -60,9 +46,6 @@ export const styles = StyleSheet.create({
60
46
  width: TabBarMetrics.ctaSize,
61
47
  height: TabBarMetrics.ctaSize,
62
48
  borderRadius: TabBarMetrics.ctaSize / 2,
63
- // Figma Icon Button border: white 60% hairline
64
- borderWidth: 1,
65
- borderColor: `rgba(255, 255, 255, ${TabBarMetrics.ctaBorderOpacity})`,
66
49
  alignItems: 'center',
67
50
  justifyContent: 'center',
68
51
  },
@@ -181,17 +181,21 @@ const HorizontalTabBar: React.FC<{
181
181
  return renderItems(items);
182
182
  };
183
183
 
184
+ const customContainer = withCta && floatingButton?.container;
185
+
184
186
  return (
185
187
  <View
186
188
  style={[styles.container, { width }]}
187
189
  accessibilityLabel={'bottom_tab_bar'}
188
190
  >
189
- <CurvedContainer
190
- width={width}
191
- height={TabBarMetrics.height}
192
- radius={TabBarMetrics.height / 2}
193
- notchCenterX={withCta ? width / 2 : undefined}
194
- />
191
+ {customContainer || (
192
+ <CurvedContainer
193
+ width={width}
194
+ height={TabBarMetrics.height}
195
+ radius={TabBarMetrics.height / 2}
196
+ notchCenterX={withCta ? width / 2 : undefined}
197
+ />
198
+ )}
195
199
  <View style={styles.content}>
196
200
  <ActiveIndicator
197
201
  axis={'x'}
@@ -224,8 +228,6 @@ export default function BottomTabBar(props: Props) {
224
228
  window.height,
225
229
  insets.left,
226
230
  insets.right,
227
- state.routes.length,
228
- withCta,
229
231
  );
230
232
 
231
233
  return (
@@ -3,7 +3,7 @@ import { StyleSheet } from 'react-native';
3
3
  import Svg, { Defs, FeGaussianBlur, Filter, Path } from 'react-native-svg';
4
4
  import { Colors } from '../../Consts';
5
5
  import { ApplicationContext } from '../../Context';
6
- import { NOTCH_CURVES, NOTCH_HALF_WIDTH, TabBarMetrics } from './metrics';
6
+ import { NOTCH_CURVES, NOTCH_HALF_WIDTH } from './metrics';
7
7
 
8
8
  type Props = {
9
9
  width: number;
@@ -139,13 +139,7 @@ const CurvedContainer: React.FC<Props> = ({
139
139
  filter={'url(#keyShadow)'}
140
140
  />
141
141
  )}
142
- <Path
143
- d={path}
144
- fill={theme.colors.background.surface}
145
- fillOpacity={TabBarMetrics.backgroundOpacity}
146
- stroke={theme.colors.border.default}
147
- strokeWidth={1}
148
- />
142
+ <Path d={path} fill={theme.colors.background.surface} />
149
143
  </Svg>
150
144
  );
151
145
  };
@@ -13,7 +13,7 @@ import Animated, {
13
13
  import { TabBarIcon } from './TabBarIcon';
14
14
  import { Text } from '../../Text';
15
15
  import { MiniAppContext } from '../../Context';
16
- import { Colors } from '../../Consts';
16
+ import { Colors, Spacing } from '../../Consts';
17
17
  import { TabBarMetrics, TabBarMotion } from './metrics';
18
18
 
19
19
  type IconRenderer = (props: {
@@ -143,7 +143,7 @@ const styles = StyleSheet.create({
143
143
  minWidth: 1,
144
144
  alignItems: 'center',
145
145
  justifyContent: 'center',
146
- gap: TabBarMetrics.itemIconLabelGap,
146
+ gap: Spacing.XXS,
147
147
  },
148
148
  slot: {
149
149
  height: TabBarMetrics.indicatorHeight,
@@ -3,11 +3,7 @@ import React from 'react';
3
3
  import { useWindowDimensions, View } from 'react-native';
4
4
  import { useScreenLayout } from '../../Layout/utils';
5
5
  import { FloatingButtonProps } from '../types';
6
- import {
7
- getSystemIndicatorHeight,
8
- hasCenterAction,
9
- HorizontalTabBar,
10
- } from './BottomTabBar';
6
+ import { getSystemIndicatorHeight, HorizontalTabBar } from './BottomTabBar';
11
7
  import { getHorizontalBarWidth, TabBarMetrics } from './metrics';
12
8
  import { getTabItems } from './tabItems';
13
9
  import { DuoRailTabBar } from './DuoRailTabBar';
@@ -38,7 +34,6 @@ const DuoFloatingTabBar: React.FC<DuoTabBarProps> = props => {
38
34
  const { insets } = useScreenLayout();
39
35
  const { width, height } = useWindowDimensions();
40
36
  const { floatingButton, activeTintColor, inactiveTintColor } = props;
41
- const tabItems = getTabItems(props);
42
37
 
43
38
  return (
44
39
  <View
@@ -49,15 +44,8 @@ const DuoFloatingTabBar: React.FC<DuoTabBarProps> = props => {
49
44
  ]}
50
45
  >
51
46
  <HorizontalTabBar
52
- items={tabItems}
53
- width={getHorizontalBarWidth(
54
- width,
55
- height,
56
- insets.left,
57
- insets.right,
58
- tabItems.length,
59
- hasCenterAction(floatingButton, tabItems.length),
60
- )}
47
+ items={getTabItems(props)}
48
+ width={getHorizontalBarWidth(width, height, insets.left, insets.right)}
61
49
  floatingButton={floatingButton}
62
50
  activeTintColor={activeTintColor}
63
51
  inactiveTintColor={inactiveTintColor}
@@ -8,18 +8,11 @@ import { Colors, Radius, Spacing } from '../../Consts';
8
8
  * iPhone Duo rail (center action under the container).
9
9
  */
10
10
  const TabBarMetrics = {
11
- height: 60,
11
+ height: 68,
12
12
  margin: Spacing.S,
13
- paddingVertical: Spacing.XS,
13
+ paddingVertical: Spacing.S,
14
14
  paddingHorizontal: Spacing.M,
15
- itemGap: 1,
16
- // gap between the icon slot and the label inside a tab (Figma: none)
17
- itemIconLabelGap: 0,
18
- // .Nav/Background: no backdrop blur, so use the Figma Blur=Off spec (opacity 95%, no blur) plus the 1px
19
- // border — nearly solid, matching the frosted sample; surface keeps dark-mode support
20
- backgroundOpacity: 0.95,
21
- // white 60% hairline around the center action button (Figma Icon Button border)
22
- ctaBorderOpacity: 0.6,
15
+ itemGap: Spacing.XS,
23
16
  iconSize: 24,
24
17
  // active indicator behind the icon: 24 icon + XS·M padding
25
18
  indicatorPaddingVertical: Spacing.XS,
@@ -32,9 +25,6 @@ const TabBarMetrics = {
32
25
  systemIndicatorHeight: 24,
33
26
  foldableMinShortSide: 600,
34
27
  foldableWidthRatio: 0.65,
35
- // a 2-tab bar doesn't stretch to the full width: each item is this fixed width and the bar is
36
- // sized to its content, centered (Figma Navigation · 2 Tab: item 100, bar ~225)
37
- twoTabItemWidth: 100,
38
28
  ctaSlotWidth: 92,
39
29
  ctaSize: 48,
40
30
  ctaIconSize: 28,
@@ -142,17 +132,7 @@ const getHorizontalBarWidth = (
142
132
  height: number,
143
133
  insetLeft: number,
144
134
  insetRight: number,
145
- itemCount: number,
146
- hasCta: boolean,
147
135
  ) => {
148
- // 2 tabs (no center action) stay content-sized and centered instead of filling the window
149
- if (itemCount === 2 && !hasCta) {
150
- return (
151
- TabBarMetrics.twoTabItemWidth * 2 +
152
- TabBarMetrics.paddingHorizontal * 2 +
153
- TabBarMetrics.itemGap
154
- );
155
- }
156
136
  const shortSide = Math.min(width, height);
157
137
  if (shortSide >= TabBarMetrics.foldableMinShortSide) {
158
138
  return shortSide * TabBarMetrics.foldableWidthRatio;
@@ -1,4 +1,5 @@
1
- import { StyleSheet } from 'react-native';
1
+ import { StyleSheet, View } from 'react-native';
2
+ import LinearGradient from 'react-native-linear-gradient';
2
3
  import Animated, {
3
4
  Extrapolation,
4
5
  interpolate,
@@ -9,6 +10,7 @@ import React from 'react';
9
10
  import { Image } from '../../Image';
10
11
  import { Colors } from '../../Consts';
11
12
  import { useNormalizedSharedValue } from '../hooks';
13
+ import { HeaderBarMetrics, useHeaderLayout } from '../headerLayout';
12
14
 
13
15
  const ASPECT_RATIOS: Record<
14
16
  NonNullable<HeaderAnimatedProps['aspectRatio']>,
@@ -21,16 +23,20 @@ const ASPECT_RATIOS: Record<
21
23
 
22
24
  /**
23
25
  * Parallax header image (or `children`): stretches when pulled down and fades out
24
- * as the content scrolls up.
26
+ * as the content scrolls up. Wide windows and the iPhone Duo inner display keep
27
+ * it at phone size, centered.
25
28
  */
26
29
  const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
27
30
  animatedValue,
28
31
  image,
29
32
  useScale = true,
30
33
  aspectRatio = '16/9',
34
+ bannerBackgroundColor,
31
35
  children,
32
36
  }) => {
33
37
  const sharedValue = useNormalizedSharedValue(animatedValue);
38
+ const { isBannerCentered, bannerWidth } = useHeaderLayout();
39
+ const ratio = ASPECT_RATIOS[aspectRatio];
34
40
  const animatedStyle = useAnimatedStyle(() => {
35
41
  let scale = 1;
36
42
  if (useScale) {
@@ -59,22 +65,36 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
59
65
  };
60
66
  });
61
67
 
68
+ const content = children ?? (
69
+ <Image
70
+ source={{
71
+ uri: image,
72
+ }}
73
+ style={styles.full}
74
+ />
75
+ );
76
+
77
+ if (!isBannerCentered) {
78
+ return (
79
+ <Animated.View
80
+ style={[styles.container, { aspectRatio: ratio }, animatedStyle]}
81
+ >
82
+ {content}
83
+ </Animated.View>
84
+ );
85
+ }
86
+
62
87
  return (
63
88
  <Animated.View
64
- style={[
65
- styles.container,
66
- { aspectRatio: ASPECT_RATIOS[aspectRatio] },
67
- animatedStyle,
68
- ]}
89
+ style={[styles.container, { height: bannerWidth / ratio }, animatedStyle]}
69
90
  >
70
- {children ?? (
71
- <Image
72
- source={{
73
- uri: image,
74
- }}
75
- style={styles.full}
91
+ {!!bannerBackgroundColor && (
92
+ <LinearGradient
93
+ colors={[bannerBackgroundColor, bannerBackgroundColor + '00']}
94
+ style={StyleSheet.absoluteFill}
76
95
  />
77
96
  )}
97
+ <View style={styles.phoneBanner}>{content}</View>
78
98
  </Animated.View>
79
99
  );
80
100
  };
@@ -90,6 +110,11 @@ const styles = StyleSheet.create({
90
110
  alignSelf: 'center',
91
111
  },
92
112
  full: { width: '100%', height: '100%' },
113
+ phoneBanner: {
114
+ width: HeaderBarMetrics.bannerWidth,
115
+ height: '100%',
116
+ alignSelf: 'center',
117
+ },
93
118
  });
94
119
 
95
120
  export { HeaderAnimated };
@@ -8,10 +8,12 @@ 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';
11
12
 
12
13
  /**
13
14
  * Header background: surface and image that fade in on scroll, with an optional
14
- * gradient (custom or theme) on top. Outlined when `showBaseLineDebug` is on.
15
+ * gradient (custom or theme) on top, at phone height on wide windows. Outlined
16
+ * when `showBaseLineDebug` is on.
15
17
  */
16
18
  const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
17
19
  animatedValue,
@@ -25,6 +27,7 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
25
27
  const gradientColor = customGradientColor ?? theme.colors.gradient;
26
28
  const headerImage = headerBackground ?? theme.assets?.headerBackground;
27
29
  const sharedValue = useNormalizedSharedValue(animatedValue);
30
+ const { isWide } = useHeaderLayout();
28
31
 
29
32
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
30
33
 
@@ -38,14 +41,19 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
38
41
  />
39
42
  <View style={styles.gradientContainer}>
40
43
  {useGradient && !!gradientColor && (
41
- <Animated.View style={styles.extendedHeader}>
44
+ <Animated.View
45
+ style={[styles.extendedHeader, isWide && styles.phoneHeight]}
46
+ >
42
47
  <LinearGradient
43
48
  colors={[gradientColor, gradientColor + '00']}
44
49
  style={StyleSheet.absoluteFill}
45
50
  >
46
51
  {!!headerImage && (
47
52
  <Image
48
- style={styles.headerBackground}
53
+ style={[
54
+ styles.headerBackground,
55
+ isWide && styles.phoneHeight,
56
+ ]}
49
57
  source={{ uri: headerImage }}
50
58
  loading={false}
51
59
  />
@@ -75,6 +83,11 @@ const styles = StyleSheet.create({
75
83
  position: 'absolute',
76
84
  aspectRatio: 375 / 154,
77
85
  },
86
+ // wide windows keep the phone gradient height instead of scaling with the width
87
+ phoneHeight: {
88
+ aspectRatio: undefined,
89
+ height: HeaderBarMetrics.gradientHeight,
90
+ },
78
91
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
79
92
  });
80
93
 
@@ -17,11 +17,16 @@ 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 { DuoMetrics, HeaderMetrics } from '../../Layout/utils';
20
+ import { HeaderMetrics } from '../../Layout/utils';
21
+ import {
22
+ HeaderBarMetrics,
23
+ type HeaderContentLayout,
24
+ useHeaderLayout,
25
+ } from '../headerLayout';
21
26
 
22
- const SCREEN_PADDING = 12;
23
- const BACK_WIDTH = 28;
24
- const TOOLKIT_WIDTH = 73;
27
+ const { buttonSize, pillWidth, sidePadding, titleGap } = HeaderBarMetrics;
28
+ const SCREEN_PADDING = sidePadding;
29
+ const TOOLKIT_WIDTH = pillWidth + sidePadding;
25
30
 
26
31
  /**
27
32
  * Extended header background: a gradient that collapses on scroll and, with
@@ -38,6 +43,7 @@ const HeaderExtendHeader: React.FC<{
38
43
  useShadowHeader?: boolean;
39
44
  gradientColor?: string;
40
45
  headerBackground?: string;
46
+ contentLayout?: HeaderContentLayout;
41
47
  }> = ({
42
48
  headerType = 'default',
43
49
  animatedValue,
@@ -48,6 +54,7 @@ const HeaderExtendHeader: React.FC<{
48
54
  useShadowHeader: useShadowHeaderProp = true,
49
55
  gradientColor: customGradientColor,
50
56
  headerBackground: customBackground,
57
+ contentLayout,
51
58
  }) => {
52
59
  const { theme } = useContext(ApplicationContext);
53
60
  const context = useContext<any>(MiniAppContext);
@@ -55,29 +62,32 @@ const HeaderExtendHeader: React.FC<{
55
62
  const gradientColor = customGradientColor ?? theme.colors.gradient;
56
63
  const headerBackground = customBackground ?? theme.assets?.headerBackground;
57
64
  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;
58
68
 
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;
69
+ const backLeft = buttonSize + sidePadding + titleGap;
70
+ const defaultLeft = layout.sideBar ? SCREEN_PADDING : backLeft;
65
71
  const leftPosition = inputSearchProps?.leftPosition || defaultLeft;
66
- const defaultRightWidth = layout.sideBar ? 0 : toolkitWidth;
72
+ const defaultRightWidth = layout.sideBar ? 0 : TOOLKIT_WIDTH;
67
73
  const headerRightWidth = customHeaderRightWidth ?? defaultRightWidth;
68
- const contentLeft = layout.insetLeft + SCREEN_PADDING;
69
- const contentRight = layout.insetLeft + layout.contentWidth;
74
+ const contentLeft = layout.insetLeft + SCREEN_PADDING + frameShift;
75
+ const contentRight = layout.insetLeft + layout.contentWidth - frameShift;
70
76
  // collapsed on the status bar row, the search stays between its clusters
71
77
  const clearanceLeft = layout.statusBarClearance?.left ?? 0;
72
78
  const clearanceRight = layout.statusBarClearance?.right ?? 0;
73
- const collapsedLeft = layout.insetLeft + leftPosition + clearanceLeft;
79
+ const searchLeft = leftPosition + clearanceLeft + frameShift;
80
+ const collapsedLeft = layout.insetLeft + searchLeft;
74
81
  const collapsedRight = contentRight - clearanceRight - headerRightWidth;
75
- const searchWidth = layout.contentWidth - SCREEN_PADDING * 2;
82
+ const searchWidth = contentRight - contentLeft - SCREEN_PADDING;
76
83
  const collapsedSearchWidth = collapsedRight - collapsedLeft - SCREEN_PADDING;
77
84
  // a row taller than barHeight (iPhone Duo) centers the collapsed search on the title
78
85
  const titleRowHeight = layout.headerHeight - layout.headerStatusBarHeight;
79
86
  const collapsedRaise = (titleRowHeight - HeaderMetrics.barHeight) / 2;
80
87
 
88
+ // the iPhone Duo side bar keeps the content search size
89
+ const searchSize = layout.sideBar ? 'default' : 'header';
90
+
81
91
  let useShadowHeader = useShadowHeaderProp;
82
92
  if (inputSearchProps && Platform.OS === 'android') {
83
93
  useShadowHeader = false;
@@ -169,6 +179,7 @@ const HeaderExtendHeader: React.FC<{
169
179
  <Animated.View
170
180
  style={[
171
181
  styles.extendedHeader,
182
+ headerLayout.isWide && styles.phoneHeight,
172
183
  // fade out within the header box, as DuoScrollGradient does
173
184
  !!layout.sideBar && styles.fillHeaderBox,
174
185
  gradientOpacityStyle,
@@ -180,7 +191,10 @@ const HeaderExtendHeader: React.FC<{
180
191
  >
181
192
  {!!theme.assets?.headerBackground && (
182
193
  <Image
183
- style={styles.headerBackground}
194
+ style={[
195
+ styles.headerBackground,
196
+ headerLayout.isWide && styles.phoneHeight,
197
+ ]}
184
198
  source={{ uri: theme.assets?.headerBackground }}
185
199
  loading={false}
186
200
  />
@@ -189,9 +203,7 @@ const HeaderExtendHeader: React.FC<{
189
203
  </Animated.View>
190
204
  )}
191
205
  </Animated.View>
192
- <Animated.View
193
- style={[styles.searchContainer, heightStyle]}
194
- >
206
+ <Animated.View style={[styles.searchContainer, heightStyle]}>
195
207
  <Animated.View
196
208
  style={[{ marginVertical: Spacing.S }, searchTranslateStyle]}
197
209
  >
@@ -201,6 +213,7 @@ const HeaderExtendHeader: React.FC<{
201
213
  <InputSearch
202
214
  {...inputSearchProps}
203
215
  ref={inputSearchRef}
216
+ size={searchSize}
204
217
  backgroundColor={'transparent'}
205
218
  showButtonText={false}
206
219
  />
@@ -236,7 +249,10 @@ const HeaderExtendHeader: React.FC<{
236
249
  >
237
250
  {!!headerBackground && (
238
251
  <Image
239
- style={styles.headerBackground}
252
+ style={[
253
+ styles.headerBackground,
254
+ headerLayout.isWide && styles.phoneHeight,
255
+ ]}
240
256
  source={{ uri: headerBackground }}
241
257
  loading={false}
242
258
  />
@@ -264,6 +280,11 @@ const styles = StyleSheet.create({
264
280
  position: 'absolute',
265
281
  width: '100%',
266
282
  },
283
+ // wide windows keep the phone gradient height instead of scaling with the width
284
+ phoneHeight: {
285
+ aspectRatio: undefined,
286
+ height: HeaderBarMetrics.gradientHeight,
287
+ },
267
288
  fillHeaderBox: {
268
289
  aspectRatio: undefined,
269
290
  height: '100%',
@@ -273,14 +294,6 @@ const styles = StyleSheet.create({
273
294
  position: 'absolute',
274
295
  overflow: 'hidden',
275
296
  },
276
- verifiedDot: {
277
- width: 4,
278
- height: 4,
279
- borderRadius: 2,
280
- backgroundColor: Colors.green_03,
281
- position: 'absolute',
282
- alignSelf: 'center',
283
- },
284
297
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
285
298
  container: {
286
299
  zIndex: 0,
@@ -6,12 +6,13 @@ 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 { useScreenLayout, useSideBarItemStyle } from '../../Layout/utils';
9
+ import { useSideBarItemStyle } from '../../Layout/utils';
10
10
  import { useSideBarCounterStyle } from './DuoQuickReturnHeader';
11
+ import { HeaderBarMetrics } from '../headerLayout';
11
12
 
12
13
  /**
13
14
  * Header back button, also bound to the Android hardware back. `preventBack`
14
- * confirms in a popup first; the iPhone Duo layouts use the 48pt side bar button.
15
+ * confirms in a popup first; the iPhone Duo side bar uses the 48pt side bar button.
15
16
  */
16
17
  const HeaderLeft: React.FC<HeaderBackProps> = ({
17
18
  tintColor,
@@ -24,7 +25,6 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
24
25
  const { navigator } = useContext(ApplicationContext);
25
26
  const sideBarStyle = useSideBarItemStyle('left', 0);
26
27
  const counterStyle = useSideBarCounterStyle();
27
- const { statusBarClearance } = useScreenLayout();
28
28
 
29
29
  const goBack = useCallback(() => {
30
30
  const canGoBack = navigator?.ref?.current?.canGoBack?.();
@@ -97,20 +97,6 @@ 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
-
114
100
  return (
115
101
  <View style={styles.headerLeft}>
116
102
  <NavigationButton
@@ -125,7 +111,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
125
111
 
126
112
  const styles = StyleSheet.create({
127
113
  headerLeft: {
128
- marginLeft: 12,
114
+ marginLeft: HeaderBarMetrics.sidePadding,
129
115
  },
130
116
  });
131
117
 
@@ -1,11 +1,14 @@
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;
3
6
 
4
7
  export const styles = StyleSheet.create({
5
8
  navigationButton: {
6
- height: 28,
7
- width: 28,
8
- borderRadius: 14,
9
+ height: buttonSize,
10
+ width: buttonSize,
11
+ borderRadius: buttonSize / 2,
9
12
  justifyContent: 'center',
10
13
  alignItems: 'center',
11
14
  backgroundColor: Colors.black_01 + '99',
@@ -45,11 +48,11 @@ export const styles = StyleSheet.create({
45
48
  flexDirection: 'row',
46
49
  justifyContent: 'center',
47
50
  alignItems: 'center',
48
- paddingRight: Spacing.M,
51
+ paddingRight: sidePadding,
49
52
  },
50
53
  toolkitContainer: {
51
- height: 28,
52
- borderRadius: 14,
54
+ height: pillHeight,
55
+ borderRadius: pillHeight / 2,
53
56
  justifyContent: 'center',
54
57
  alignItems: 'center',
55
58
  flexDirection: 'row',
@@ -59,7 +62,10 @@ export const styles = StyleSheet.create({
59
62
  marginLeft: Spacing.S,
60
63
  },
61
64
  toolkitButton: {
62
- padding: 4,
65
+ flex: 1,
66
+ height: '100%',
67
+ justifyContent: 'center',
68
+ alignItems: 'center',
63
69
  },
64
70
  divider: {
65
71
  width: 0.5,
@@ -68,10 +74,6 @@ export const styles = StyleSheet.create({
68
74
  sideBarColumn: {
69
75
  gap: Spacing.M,
70
76
  },
71
- sideBarRow: {
72
- flexDirection: 'row',
73
- gap: Spacing.M,
74
- },
75
77
  headerLeft: {
76
78
  marginLeft: 12,
77
79
  },
@@ -136,9 +138,9 @@ export const styles = StyleSheet.create({
136
138
  marginRight: Spacing.M,
137
139
  },
138
140
  toolkitWide: {
139
- width: 65,
141
+ width: pillWidth,
140
142
  },
141
143
  toolkitNarrow: {
142
- width: 28,
144
+ width: buttonSize,
143
145
  },
144
146
  });