@momo-kits/foundation 0.169.18-beta.3 → 0.170.4

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.
@@ -2,14 +2,18 @@ import { useMemo } from 'react';
2
2
  import { useWindowDimensions, type ViewStyle } from 'react-native';
3
3
  import type { StackNavigationOptions } from '@react-navigation/stack';
4
4
  import { Spacing } from '../Consts';
5
- import { getHeaderMargin } from '../Layout/utils';
5
+ import {
6
+ getHeaderMargin,
7
+ getHeaderRowOptions,
8
+ useScreenLayout,
9
+ } from '../Layout/utils';
6
10
  import { FOLDABLE_MIN_WIDTH } from './modalLayout';
7
11
  import { isIPhoneDuo } from './utils';
8
12
 
9
13
  // Top navigation spec, shared with the Compose / SwiftUI kits
10
14
  const HEADER_FRAME_MAX_WIDTH = 600;
11
- // stretch frame on hold until design confirms it: `stretch` lays out like `grid`
12
- const IS_STRETCH_FRAME_ENABLED = false;
15
+ // banner image on wide windows and the iPhone Duo inner display: phone (375) × 1.2
16
+ const WIDE_BANNER_SCALE = 1.2;
13
17
 
14
18
  /**
15
19
  * Top navigation geometry on every device
@@ -17,10 +21,11 @@ const IS_STRETCH_FRAME_ENABLED = false;
17
21
  * - pillWidth / pillHeight: help center | home capsule
18
22
  * - clusterWidth: shortcut, gap and pill on the right of the bar
19
23
  * - searchHeight: search field inside the header
24
+ * - searchBarHeight: header row holding the search, taller than the plain bar
20
25
  * - titleGap: space between back and the title, and the title and the right cluster
21
26
  * - sidePadding: bar edge to back and to the right cluster
22
27
  * - gradientHeight: header gradient, kept at the phone height on wide windows
23
- * - bannerWidth: animated banner image, kept at the phone width on wide windows
28
+ * - bannerWidth: animated banner image on wide windows, centered (phone × 1.2)
24
29
  */
25
30
  const HeaderBarMetrics = {
26
31
  buttonSize: 32,
@@ -28,17 +33,17 @@ const HeaderBarMetrics = {
28
33
  pillWidth: 72,
29
34
  pillHeight: 32,
30
35
  clusterWidth: 112,
31
- searchHeight: 32,
36
+ searchHeight: 40,
37
+ searchBarHeight: 56,
32
38
  titleGap: Spacing.S,
33
39
  sidePadding: Spacing.M,
34
40
  gradientHeight: 154,
35
- bannerWidth: 375,
41
+ bannerWidth: 450,
36
42
  };
37
43
 
38
44
  /**
39
45
  * `grid` keeps the header row at the bar edges, `stretch` centers it in a 600pt
40
- * frame on wide windows (on hold: same as `grid` for now). Background and status
41
- * bar always span the window.
46
+ * frame on wide windows. Background, status bar and the search always span the window.
42
47
  */
43
48
  type HeaderContentLayout = 'grid' | 'stretch';
44
49
 
@@ -53,6 +58,10 @@ type HeaderLayout = typeof HeaderBarMetrics & {
53
58
  * inner display, portrait and landscape.
54
59
  */
55
60
  isBannerCentered: boolean;
61
+ /**
62
+ * Banner size against the phone banner: `WIDE_BANNER_SCALE` when centered, else 1.
63
+ */
64
+ bannerScale: number;
56
65
  /**
57
66
  * Window edge to back and to the right cluster: `sidePadding`, or centering the
58
67
  * row in the 600pt frame with `stretch` on a wide window.
@@ -71,6 +80,18 @@ type HeaderLayoutInput = {
71
80
  contentLayout?: HeaderContentLayout;
72
81
  };
73
82
 
83
+ type EdgePadding = { left: number; right: number };
84
+
85
+ type HeaderFrameInput = {
86
+ layout: HeaderLayout;
87
+ isDuo: boolean;
88
+ // side margin @react-navigation/elements already adds to the row
89
+ headerMargin: number;
90
+ // padding of the plain row containers: the iPhone Duo status bar clearance, else 0
91
+ edgePadding: EdgePadding;
92
+ contentLayout?: HeaderContentLayout;
93
+ };
94
+
74
95
  /**
75
96
  * Header geometry for a window, pure so it can be tested without a device.
76
97
  */
@@ -84,15 +105,19 @@ const getHeaderLayout = ({
84
105
  const isLargeWindow = Math.min(width, height) >= FOLDABLE_MIN_WIDTH;
85
106
  const isWide = !isDuo && isLargeWindow;
86
107
  let frameInset = sidePadding;
87
- const isStretch = IS_STRETCH_FRAME_ENABLED && contentLayout === 'stretch';
88
- if (isWide && isStretch) {
108
+ if (isWide && contentLayout === 'stretch') {
89
109
  const centered = (width - HEADER_FRAME_MAX_WIDTH) / 2;
90
110
  frameInset = Math.max(sidePadding, centered);
91
111
  }
112
+ let bannerScale = 1;
113
+ if (isLargeWindow) {
114
+ bannerScale = WIDE_BANNER_SCALE;
115
+ }
92
116
  return {
93
117
  ...HeaderBarMetrics,
94
118
  isWide,
95
119
  isBannerCentered: isLargeWindow,
120
+ bannerScale,
96
121
  frameInset,
97
122
  frameWidth: width - frameInset * 2,
98
123
  };
@@ -117,6 +142,19 @@ const useHeaderLayout = (contentLayout?: HeaderContentLayout): HeaderLayout => {
117
142
  }, [width, height, isDuo, contentLayout]);
118
143
  };
119
144
 
145
+ /**
146
+ * Header height once the search sits in its row: the row grows to `searchBarHeight`,
147
+ * a taller row (iPhone landscape, iPhone Duo) keeps its height.
148
+ */
149
+ const getSearchHeaderHeight = (
150
+ headerHeight: number,
151
+ statusBarHeight: number,
152
+ ) => {
153
+ const rowHeight = headerHeight - statusBarHeight;
154
+ const { searchBarHeight } = HeaderBarMetrics;
155
+ return statusBarHeight + Math.max(rowHeight, searchBarHeight);
156
+ };
157
+
120
158
  const TITLE_CONTAINER_RESET: ViewStyle = {
121
159
  marginLeft: 0,
122
160
  marginEnd: 0,
@@ -127,33 +165,77 @@ const TITLE_CONTAINER_RESET: ViewStyle = {
127
165
  };
128
166
 
129
167
  /**
130
- * React Navigation container styles that keep back, title and the right cluster
131
- * in the `stretch` frame. `undefined` for `grid`, and on iPhone Duo, which keeps
132
- * its own header row.
168
+ * Container styles of the bar-edge row, set explicitly: options are merged, so a
169
+ * former `stretch` frame would otherwise stay after a layout switch or a fold.
170
+ */
171
+ const getEdgeFrameOptions = (
172
+ edgePadding: EdgePadding,
173
+ ): StackNavigationOptions => {
174
+ return {
175
+ headerLeftContainerStyle: { paddingLeft: edgePadding.left },
176
+ headerRightContainerStyle: { paddingRight: edgePadding.right },
177
+ headerTitleContainerStyle: {
178
+ ...TITLE_CONTAINER_RESET,
179
+ left: HeaderBarMetrics.titleGap,
180
+ },
181
+ };
182
+ };
183
+
184
+ /**
185
+ * React Navigation container styles placing back, title and the right cluster for
186
+ * `contentLayout`: the 600pt frame with `stretch`, else the bar edges (also iPhone
187
+ * Duo). `undefined` when the screen leaves `contentLayout` unset.
188
+ */
189
+ const getHeaderFrameOptions = ({
190
+ layout,
191
+ isDuo,
192
+ headerMargin,
193
+ edgePadding,
194
+ contentLayout,
195
+ }: HeaderFrameInput): StackNavigationOptions | undefined => {
196
+ if (!contentLayout) {
197
+ return undefined;
198
+ }
199
+ if (contentLayout !== 'stretch' || isDuo) {
200
+ return getEdgeFrameOptions(edgePadding);
201
+ }
202
+ // the header content row already sits this far in on large iOS windows
203
+ const shift = layout.frameInset - layout.sidePadding;
204
+ const containerShift = Math.max(0, shift - headerMargin);
205
+ return {
206
+ headerLeftContainerStyle: { paddingLeft: containerShift },
207
+ headerRightContainerStyle: { paddingRight: containerShift },
208
+ headerTitleContainerStyle: {
209
+ ...TITLE_CONTAINER_RESET,
210
+ left: layout.titleGap,
211
+ maxWidth: getTitleBudget(layout),
212
+ },
213
+ };
214
+ };
215
+
216
+ /**
217
+ * Container styles for `contentLayout` on the current window, re-computed on fold,
218
+ * unfold and rotation; see `getHeaderFrameOptions`.
133
219
  */
134
220
  const useHeaderFrameOptions = (
135
221
  contentLayout?: HeaderContentLayout,
136
222
  ): StackNavigationOptions | undefined => {
137
223
  const layout = useHeaderLayout(contentLayout);
138
- const { width } = useWindowDimensions();
224
+ const screenLayout = useScreenLayout();
225
+ const rowOptions = getHeaderRowOptions(screenLayout);
226
+ const edgeLeft = rowOptions.headerLeftContainerStyle?.paddingLeft ?? 0;
227
+ const edgeRight = rowOptions.headerRightContainerStyle?.paddingRight ?? 0;
228
+ const headerMargin = getHeaderMargin(screenLayout.width);
139
229
  const isDuo = isIPhoneDuo();
140
230
  return useMemo(() => {
141
- if (!IS_STRETCH_FRAME_ENABLED || contentLayout !== 'stretch' || isDuo) {
142
- return undefined;
143
- }
144
- // the header content row already sits this far in on large iOS windows
145
- const shift = layout.frameInset - layout.sidePadding;
146
- const containerShift = Math.max(0, shift - getHeaderMargin(width));
147
- return {
148
- headerLeftContainerStyle: { paddingLeft: containerShift },
149
- headerRightContainerStyle: { paddingRight: containerShift },
150
- headerTitleContainerStyle: {
151
- ...TITLE_CONTAINER_RESET,
152
- left: layout.titleGap,
153
- maxWidth: getTitleBudget(layout),
154
- },
155
- };
156
- }, [contentLayout, isDuo, layout, width]);
231
+ return getHeaderFrameOptions({
232
+ layout,
233
+ isDuo,
234
+ headerMargin,
235
+ edgePadding: { left: edgeLeft, right: edgeRight },
236
+ contentLayout,
237
+ });
238
+ }, [contentLayout, isDuo, layout, headerMargin, edgeLeft, edgeRight]);
157
239
  };
158
240
 
159
241
  export type { HeaderContentLayout, HeaderLayout };
@@ -162,7 +244,9 @@ export {
162
244
  HeaderBarMetrics,
163
245
  HEADER_FRAME_MAX_WIDTH,
164
246
  TITLE_CONTAINER_RESET,
247
+ getHeaderFrameOptions,
165
248
  getHeaderLayout,
249
+ getSearchHeaderHeight,
166
250
  getTitleBudget,
167
251
  useHeaderLayout,
168
252
  useHeaderFrameOptions,
@@ -8,7 +8,7 @@ import { isIPhoneDuo } from './utils';
8
8
  const POPUP_MAX_WIDTH = 450;
9
9
  const POPUP_MIN_WIDTH = 280;
10
10
  const POPUP_MAX_HEIGHT = 600;
11
- const SHEET_MAX_WIDTH = 653;
11
+ const SHEET_MAX_WIDTH = 600;
12
12
  const SHEET_MIN_WIDTH = 296;
13
13
  const SHEET_MIN_HEIGHT = 230;
14
14
  const FOLDABLE_MIN_WIDTH = 600;
@@ -46,6 +46,12 @@ export type ModalLayout = {
46
46
  maxHeight?: number;
47
47
  margin: number;
48
48
  radius: number;
49
+ /**
50
+ * Window x of the left edge of a `width` wide popup, `undefined` on phones.
51
+ * Centered on the window, but a margin clear of the iPhone Duo control
52
+ * column / system insets; half folded it is centered in the right half.
53
+ */
54
+ x?: number;
49
55
  };
50
56
 
51
57
  sheet: {
@@ -53,6 +59,12 @@ export type ModalLayout = {
53
59
  * `undefined` on phones, the sheet spans the window.
54
60
  */
55
61
  width?: number;
62
+ /**
63
+ * Window x of the sheet's left edge, `undefined` on phones. Centered on the
64
+ * window, but kept a margin clear of the iPhone Duo control column / system
65
+ * insets; half folded it is centered in the right half.
66
+ */
67
+ x?: number;
56
68
  maxHeight?: number;
57
69
  minHeight?: number;
58
70
  margin: number;
@@ -79,11 +91,22 @@ const clamp = (value: number, min: number, max: number) => {
79
91
  };
80
92
 
81
93
  /**
82
- * True when the window's short side reaches a foldable inner display (Galaxy Z Fold,
83
- * Pixel Fold, iPhone Duo inner); short side, so a phone in landscape stays a phone.
94
+ * Window x of a `boxWidth` wide overlay: centered on `center` (the window, so
95
+ * an inset on one side does not push it off center) but `margin` inside the
96
+ * placement; centered in the placement when it does not fit with the margins.
84
97
  */
85
- const isFoldableWindow = (width: number, height: number) => {
86
- return Math.min(width, height) >= FOLDABLE_MIN_WIDTH;
98
+ const overlayX = (
99
+ center: number,
100
+ placement: ModalRect,
101
+ boxWidth: number,
102
+ margin: number,
103
+ ) => {
104
+ const min = placement.x + margin;
105
+ const max = placement.x + placement.width - margin - boxWidth;
106
+ if (max < min) {
107
+ return placement.x + (placement.width - boxWidth) / 2;
108
+ }
109
+ return clamp(center - boxWidth / 2, min, max);
87
110
  };
88
111
 
89
112
  /**
@@ -96,9 +119,10 @@ const getModalLayout = ({
96
119
  isDuo,
97
120
  hinge,
98
121
  }: ModalLayoutInput): ModalLayout => {
99
- const isWideWindow = isFoldableWindow(width, height);
100
- const isFoldable = isDuo || isWideWindow;
101
- const isDuoOuter = isDuo && !isWideWindow;
122
+ const shortSide = Math.min(width, height);
123
+ // short side, so a phone in landscape stays a phone
124
+ const isFoldable = isDuo || shortSide >= FOLDABLE_MIN_WIDTH;
125
+ const isDuoOuter = isDuo && shortSide < FOLDABLE_MIN_WIDTH;
102
126
  const hingeRight = hinge ? hinge.x + hinge.width : 0;
103
127
  const hasHinge = !!hinge && hinge.x > 0;
104
128
  const isHingeInWindow = hingeRight < width - insets.right;
@@ -137,12 +161,20 @@ const getModalLayout = ({
137
161
  const sheetSpace = placement.width - sheetMargin * 2;
138
162
  const sheetMinWidth = Math.min(SHEET_MIN_WIDTH, sheetSpace);
139
163
  const sheetMaxHeight = height - insets.top - Spacing.M;
164
+ const sheetWidth = clamp(sheetSpace, sheetMinWidth, SHEET_MAX_WIDTH);
165
+ const popupWidth = clamp(popupSpace, popupMinWidth, POPUP_MAX_WIDTH);
166
+ // the window center; half folded, the right half's
167
+ let overlayCenter = width / 2;
168
+ if (isHalfFolded) {
169
+ overlayCenter = placement.x + placement.width / 2;
170
+ }
140
171
 
141
172
  return {
142
173
  isFoldable,
143
174
  placement,
144
175
  popup: {
145
- width: clamp(popupSpace, popupMinWidth, POPUP_MAX_WIDTH),
176
+ width: popupWidth,
177
+ x: overlayX(overlayCenter, placement, popupWidth, popupMargin),
146
178
  minWidth: popupMinWidth,
147
179
  maxWidth: POPUP_MAX_WIDTH,
148
180
  maxHeight: Math.min(POPUP_MAX_HEIGHT, placement.height - Spacing.XL * 2),
@@ -150,7 +182,8 @@ const getModalLayout = ({
150
182
  radius: Radius.XL,
151
183
  },
152
184
  sheet: {
153
- width: clamp(sheetSpace, sheetMinWidth, SHEET_MAX_WIDTH),
185
+ width: sheetWidth,
186
+ x: overlayX(overlayCenter, placement, sheetWidth, sheetMargin),
154
187
  maxHeight: sheetMaxHeight,
155
188
  minHeight: Math.min(SHEET_MIN_HEIGHT, sheetMaxHeight),
156
189
  margin: sheetMargin,
@@ -173,7 +206,6 @@ const useModalLayout = (): ModalLayout => {
173
206
 
174
207
  export {
175
208
  getModalLayout,
176
- isFoldableWindow,
177
209
  useModalLayout,
178
210
  POPUP_MAX_WIDTH,
179
211
  POPUP_MIN_WIDTH,
@@ -99,10 +99,16 @@ export interface HeaderAnimatedProps extends ViewProps {
99
99
  useScale?: boolean;
100
100
  aspectRatio?: '16/9' | '3/2' | '1/1';
101
101
  /**
102
- * Optional. On wide windows the image keeps its phone width, centered; this
102
+ * Optional. On wide windows the image is centered at phone width × 1.2; this
103
103
  * color fills the sides and fades to transparent downward. No fill when unset.
104
+ * `bannerGradientColors` wins when both are set.
104
105
  */
105
106
  bannerBackgroundColor?: string;
107
+ /**
108
+ * Optional. Side fill behind the centered banner on wide windows, from the top
109
+ * color to the bottom one: `[start, end]`. A single color fills solid.
110
+ */
111
+ bannerGradientColors?: string[];
106
112
  }
107
113
 
108
114
  export type AnimatedHeader = {
@@ -45,7 +45,7 @@ const ErrorView: FC<ErrorViewProps> = ({
45
45
  color={messageColor}
46
46
  typography={'description_default_regular'}
47
47
  >
48
- {errorMessage ?? hintTextDefault}
48
+ {errorMessage || hintTextDefault}
49
49
  </Text>
50
50
  </View>
51
51
  );
@@ -53,8 +53,8 @@ type InputMoneyViewProps = Pick<
53
53
  };
54
54
 
55
55
  /**
56
- * Presentational body of InputMoney: bordered field, currency suffix (kept
57
- * after a placeholder that ends with it) and the clear/trailing icons.
56
+ * Presentational body of InputMoney: bordered field, currency suffix (shown
57
+ * once there is a value) and the clear/trailing icons.
58
58
  */
59
59
  export const InputMoneyView = ({
60
60
  size,
@@ -101,13 +101,8 @@ export const InputMoneyView = ({
101
101
  fontSize: scaledFontSize,
102
102
  fontFamily: inputFontFamily,
103
103
  };
104
- const hasCurrencyInPlaceholder = placeholder.endsWith(currency);
105
- const shouldShowCurrency = !!displayValue || hasCurrencyInPlaceholder;
104
+ const hasValue = displayValue.length > 0;
106
105
  const shouldShowClearIcon = !!(showClearIcon && focused && displayValue);
107
- let inputPlaceholder = placeholder;
108
- if (hasCurrencyInPlaceholder) {
109
- inputPlaceholder = placeholder.slice(0, -currency.length);
110
- }
111
106
  return (
112
107
  <View
113
108
  style={[
@@ -148,18 +143,15 @@ export const InputMoneyView = ({
148
143
  onChangeText={onChangeText}
149
144
  onFocus={onFocus}
150
145
  onBlur={onBlur}
151
- placeholder={inputPlaceholder}
146
+ placeholder={placeholder}
152
147
  selectionColor={theme.colors.primary}
153
148
  placeholderTextColor={placeholderColor}
154
149
  keyboardType={'numeric'}
155
150
  maxLength={undefined}
156
151
  />
157
- {shouldShowCurrency && (
152
+ {hasValue && (
158
153
  <Text
159
- style={[
160
- textStyle,
161
- { color: displayValue ? textColor : placeholderColor },
162
- ]}
154
+ style={[textStyle, { color: textColor }]}
163
155
  allowFontScaling={false}
164
156
  >
165
157
  {currency}
package/Layout/Screen.tsx CHANGED
@@ -28,14 +28,11 @@ import { useScreenLayout } from './utils';
28
28
  import { HeaderExtendHeader } from '../Application';
29
29
  import { DuoScrollGradient } from '../Application/Components/DuoGlassBackground';
30
30
  import { BottomTabInsetContext } from '../Application/BottomTab/BottomTabInset';
31
- import { ScreenProps } from './screenTypes';
31
+ import { useHeaderLayout } from '../Application/headerLayout';
32
+ import { ANIMATED_BANNER_HEIGHT, ScreenProps } from './screenTypes';
32
33
  import { renderAnimatedHeader, renderContent } from './screenContent';
33
34
  import { createScrollHandlers } from './screenScroll';
34
- import {
35
- renderFooterSpacer,
36
- ScreenFooter,
37
- useFooterLayout,
38
- } from './screenFooter';
35
+ import { ScreenFooter } from './screenFooter';
39
36
  import { useScreenHeader } from './screenHeader';
40
37
  import { useScreenQuickReturn } from './screenQuickReturn';
41
38
 
@@ -57,9 +54,6 @@ const Screen = forwardRef(
57
54
  headerComponent: Header,
58
55
  footerComponent: Footer,
59
56
  marginFooter = true,
60
- footerStyle,
61
- footerSeparator,
62
- footerHasImageBackground: hasImageFooter,
63
57
  layoutOffset = -56,
64
58
  headerRightWidth,
65
59
  backgroundColor,
@@ -85,7 +79,9 @@ const Screen = forwardRef(
85
79
  const insets = useSafeAreaInsets();
86
80
  const frame = useSafeAreaFrame();
87
81
  const heightHeader = useHeaderHeight();
88
- const footerLayout = useFooterLayout(layout, footerStyle, hasImageFooter);
82
+ const { bannerScale } = useHeaderLayout(contentLayout);
83
+ // the banner grows with its image on wide windows, the content keeps its overlap
84
+ const bannerBottom = ANIMATED_BANNER_HEIGHT * bannerScale + layoutOffset;
89
85
 
90
86
  const animatedValue = useRef<Animated.Value>(
91
87
  customAnimatedValue ?? new Animated.Value(0),
@@ -152,7 +148,7 @@ const Screen = forwardRef(
152
148
  useShadowHeader,
153
149
  gradientColor,
154
150
  headerBackground,
155
- layoutOffset,
151
+ bannerBottom,
156
152
  contentLayout,
157
153
  });
158
154
 
@@ -203,7 +199,7 @@ const Screen = forwardRef(
203
199
 
204
200
  let floatingButtonBottom = bottomInset + Spacing.S;
205
201
  if (Footer) {
206
- floatingButtonBottom = 12 + footerLayout.overlap;
202
+ floatingButtonBottom = 12;
207
203
  } else if (isTab) {
208
204
  floatingButtonBottom = 12 + duoTabInset;
209
205
  }
@@ -287,13 +283,12 @@ const Screen = forwardRef(
287
283
  >
288
284
  {renderAnimatedHeader(
289
285
  animatedHeader,
290
- layoutOffset,
286
+ bannerBottom,
291
287
  animatedValue.current,
292
288
  sharedValue,
293
289
  )}
294
290
 
295
291
  {useGridLayout ? renderContent(children, layout) : children}
296
- {renderFooterSpacer(footerLayout.overlap)}
297
292
  </Component>
298
293
 
299
294
  {floatingButtonProps && (
@@ -315,11 +310,13 @@ const Screen = forwardRef(
315
310
  <ScreenFooter
316
311
  footer={Footer}
317
312
  marginFooter={marginFooter}
318
- layout={footerLayout}
319
- separator={footerSeparator}
313
+ insetLeft={layout.insetLeft}
314
+ insetRight={layout.insetRight}
315
+ hasContentInset={hasContentInset}
320
316
  isTab={isTab}
321
317
  duoTabInset={duoTabInset}
322
318
  bottomInset={bottomInset}
319
+ surfaceColor={theme.colors.background.surface}
323
320
  />
324
321
  )}
325
322
  </KeyboardAvoidingView>
@@ -24,22 +24,16 @@ export interface SectionProps extends ViewProps {
24
24
  * Optional. Background image for the Section component.
25
25
  */
26
26
  backgroundImage?: string;
27
-
28
- /**
29
- * Optional. Caps the row width, side margins excluded; a capped row is centered.
30
- */
31
- maxWidth?: number;
32
27
  }
33
28
 
34
29
  /**
35
- * Content-wide grid row (12 or 24 columns) with optional side margins, capped by
36
- * `maxWidth`; child Items size themselves from its GridContext.
30
+ * Content-wide grid row (12 or 24 columns) with optional side margins; child Items size
31
+ * themselves from its GridContext.
37
32
  */
38
33
  const Section: React.FC<SectionProps> = ({
39
34
  children,
40
35
  useMargin = true,
41
36
  backgroundImage,
42
- maxWidth,
43
37
  style,
44
38
  ...props
45
39
  }) => {
@@ -51,11 +45,7 @@ const Section: React.FC<SectionProps> = ({
51
45
  if (useMargin) {
52
46
  margin = 12;
53
47
  }
54
- const isCapped = maxWidth !== undefined;
55
- let widthSection = contentWidth - margin * 2;
56
- if (isCapped) {
57
- widthSection = Math.min(widthSection, maxWidth);
58
- }
48
+ const widthSection = contentWidth - margin * 2;
59
49
 
60
50
  const columnsWidth = widthSection - gutterSize * (numberOfColumns - 1);
61
51
  const sizePerSpan = columnsWidth / numberOfColumns - 1 / numberOfColumns;
@@ -78,7 +68,6 @@ const Section: React.FC<SectionProps> = ({
78
68
  style,
79
69
  styles.protectedStyle,
80
70
  styles.rowWrap,
81
- isCapped && styles.centered,
82
71
  {
83
72
  width: widthSection,
84
73
  marginHorizontal: margin,
@@ -1,7 +1,7 @@
1
1
  /** Header geometry. */
2
2
  export const HeaderMetrics = {
3
- /** Navigation bar row below the status bar. */
4
- barHeight: 52,
3
+ /** Navigation bar row below the status bar; a search row is taller (searchBarHeight). */
4
+ barHeight: 48,
5
5
  /** Header never shorter than this on iPhone (landscape, iPhone Duo). */
6
6
  iPhoneMinHeight: 72,
7
7
  /** A smaller top inset means the status bar is not on the top edge. */
@@ -3,7 +3,6 @@ import { Animated, View } from 'react-native';
3
3
  import { Spacing } from '../Consts';
4
4
  import styles from './styles';
5
5
  import { validateChildren } from './utils';
6
- import { ANIMATED_BANNER_HEIGHT } from './screenTypes';
7
6
  import { AnimatedHeader } from '../Application/types';
8
7
 
9
8
  type ContentInset = { insetLeft: number; insetRight: number };
@@ -65,23 +64,18 @@ export const renderContent = (content: any, layout: ContentInset): any => {
65
64
  };
66
65
 
67
66
  /**
68
- * Animated banner from `animatedHeader.component`, clipped to the banner height plus
69
- * `layoutOffset`. Nothing without a component.
67
+ * Animated banner from `animatedHeader.component`, clipped at `bannerBottom` (banner
68
+ * height plus `layoutOffset`). Nothing without a component.
70
69
  */
71
70
  export const renderAnimatedHeader = (
72
71
  animatedHeader: AnimatedHeader | undefined,
73
- layoutOffset: number,
72
+ bannerBottom: number,
74
73
  animatedValue: Animated.Value,
75
74
  sharedValue: any,
76
75
  ) => {
77
76
  if (typeof animatedHeader?.component === 'function') {
78
77
  return (
79
- <View
80
- style={[
81
- styles.screenBanner,
82
- { maxHeight: ANIMATED_BANNER_HEIGHT + layoutOffset },
83
- ]}
84
- >
78
+ <View style={[styles.screenBanner, { maxHeight: bannerBottom }]}>
85
79
  {animatedHeader?.component({
86
80
  animatedValue,
87
81
  sharedValue,