@momo-kits/foundation 0.169.17-beta.9 → 0.169.17

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,50 +1,15 @@
1
- import React, { ReactNode, useCallback, useContext, useState } from 'react';
2
- import { LayoutChangeEvent, StyleProp, View, ViewStyle } from 'react-native';
3
- import { isFoldableWindow } from '../Application/modalLayout';
4
- import { ApplicationContext, MiniAppContext } from '../Context';
1
+ import React, { ReactNode } from 'react';
2
+ import { View } from 'react-native';
5
3
  import { Spacing } from '../Consts';
6
- import { ScreenLayout } from './layoutTypes';
7
- import { ScreenFooterStyle } from './types';
8
4
  import Section from './Section';
9
5
  import styles from './styles';
10
6
 
11
- // Foldable footer spec, shared with the Compose / SwiftUI kits
12
- const FOOTER_MAX_WIDTH = 600;
13
- const FOOTER_WIDE_MAX_WIDTH = 800;
14
- const FOOTER_WIDE_WINDOW_MIN_WIDTH = 800;
15
- const FOOTER_BORDER_WIDTH = 1;
16
-
17
- type FooterKind = 'phone' | 'anchored' | 'sheet';
18
-
19
- type FooterGeometry = { kind: FooterKind; width: number };
20
-
21
- type DesignSystemContext = {
22
- designSystemConfig?: { config?: { footerStyle?: unknown } };
23
- };
24
-
25
- type FooterGeometryInput = {
26
- width: number;
27
- height: number;
28
- contentWidth: number;
29
- footerStyle: ScreenFooterStyle;
30
- hasImageBackground: boolean;
31
- };
32
-
33
- type FooterLayout = FooterGeometry & {
34
- hasBorder: boolean;
35
- insetLeft: number;
36
- insetRight: number;
37
- /**
38
- * Height the sheet overlaps the body by; 0 while the footer sits below the body.
39
- */
40
- overlap: number;
41
- handleLayout: (event: LayoutChangeEvent) => void;
42
- };
43
-
44
7
  type ScreenFooterProps = {
45
8
  footer: ReactNode;
46
9
  marginFooter: boolean;
47
- layout: FooterLayout;
10
+ insetLeft: number;
11
+ insetRight: number;
12
+ hasContentInset: boolean;
48
13
  isTab: boolean;
49
14
  duoTabInset: number;
50
15
  bottomInset: number;
@@ -52,167 +17,47 @@ type ScreenFooterProps = {
52
17
  };
53
18
 
54
19
  /**
55
- * The screen prop wins over the host's design system config; anything else is `anchored`.
56
- */
57
- const getFooterStyle = (
58
- footerStyle?: ScreenFooterStyle,
59
- configured?: unknown,
60
- ): ScreenFooterStyle => {
61
- if ((footerStyle ?? configured) === 'sheet') {
62
- return 'sheet';
63
- }
64
- return 'anchored';
65
- };
66
-
67
- /**
68
- * Footer kind and width (anchored content or sheet) for a window, pure so it can be
69
- * tested without a device. Phones, iPhone Duo outer included, keep the shadowed bar.
70
- */
71
- const getFooterGeometry = ({
72
- width,
73
- height,
74
- contentWidth,
75
- footerStyle,
76
- hasImageBackground,
77
- }: FooterGeometryInput): FooterGeometry => {
78
- if (!isFoldableWindow(width, height)) {
79
- return { kind: 'phone', width: contentWidth };
80
- }
81
-
82
- let maxWidth = FOOTER_MAX_WIDTH;
83
- if (width >= FOOTER_WIDE_WINDOW_MIN_WIDTH) {
84
- maxWidth = FOOTER_WIDE_MAX_WIDTH;
85
- }
86
- const footerWidth = Math.min(contentWidth - Spacing.M * 2, maxWidth);
87
- // an image background spans the window, so it never sits in a sheet
88
- const isSheet = footerStyle === 'sheet' && !hasImageBackground;
89
- return { kind: isSheet ? 'sheet' : 'anchored', width: footerWidth };
90
- };
91
-
92
- /**
93
- * Footer layout for the screen layout. A sheet overlaps the body, so its measured
94
- * height comes back as `overlap` for the body to pad its end by.
95
- */
96
- const useFooterLayout = (
97
- layout: ScreenLayout,
98
- footerStyle?: ScreenFooterStyle,
99
- hasImageBackground = false,
100
- ): FooterLayout => {
101
- const context: DesignSystemContext | undefined = useContext(MiniAppContext);
102
- const [height, setHeight] = useState(0);
103
- const handleLayout = useCallback((event: LayoutChangeEvent) => {
104
- setHeight(event.nativeEvent.layout.height);
105
- }, []);
106
-
107
- const configured = context?.designSystemConfig?.config?.footerStyle;
108
- const geometry = getFooterGeometry({
109
- width: layout.width,
110
- height: layout.height,
111
- contentWidth: layout.contentWidth,
112
- footerStyle: getFooterStyle(footerStyle, configured),
113
- hasImageBackground,
114
- });
115
-
116
- let overlap = 0;
117
- if (geometry.kind === 'sheet') {
118
- overlap = height;
119
- }
120
- return {
121
- ...geometry,
122
- hasBorder: geometry.kind === 'anchored' && !hasImageBackground,
123
- insetLeft: layout.insetLeft,
124
- insetRight: layout.insetRight,
125
- overlap,
126
- handleLayout,
127
- };
128
- };
129
-
130
- /**
131
- * Spacer at the end of the body so a sheet footer does not cover its last element.
132
- */
133
- const renderFooterSpacer = (overlap: number) => {
134
- if (!overlap) {
135
- return null;
136
- }
137
- return <View style={{ height: overlap }} />;
138
- };
139
-
140
- /**
141
- * Screen footer on the surface color above the home indicator or the floating tab bar.
142
- * Phones keep the top shadow; foldables cap the content under a full-width bar with a
143
- * top border (`anchored`) or in a centered sheet over the body (`sheet`).
20
+ * Screen footer on the surface color with a top shadow, padded above the home indicator,
21
+ * or above the floating tab bar on a tab screen.
144
22
  */
145
- const ScreenFooter = ({
23
+ export const ScreenFooter = ({
146
24
  footer,
147
25
  marginFooter,
148
- layout,
26
+ insetLeft,
27
+ insetRight,
28
+ hasContentInset,
149
29
  isTab,
150
30
  duoTabInset,
151
31
  bottomInset,
152
32
  surfaceColor,
153
33
  }: ScreenFooterProps) => {
154
- const { theme } = useContext(ApplicationContext);
155
34
  let bottomSpace = bottomInset;
156
35
  if (isTab && duoTabInset) {
157
36
  bottomSpace = duoTabInset;
158
37
  }
159
38
 
160
- const { kind, insetLeft, insetRight } = layout;
161
- const hasContentInset = insetLeft > 0 || insetRight > 0;
162
- const margin = marginFooter ? Spacing.M : 0;
163
-
164
- // one view tree for every kind, so folding keeps the footer content's state
165
- let containerStyle: StyleProp<ViewStyle> = [
166
- kind === 'phone' && hasContentInset && styles.footerClip,
167
- { marginLeft: insetLeft, marginRight: insetRight },
168
- ];
169
- let surfaceStyle: StyleProp<ViewStyle> = styles.shadow;
170
- let sectionMaxWidth: number | undefined;
171
- if (kind === 'anchored') {
172
- surfaceStyle = [
173
- styles.footerBar,
174
- layout.hasBorder && {
175
- borderTopWidth: FOOTER_BORDER_WIDTH,
176
- borderTopColor: theme.colors.border.default,
177
- },
178
- ];
179
- sectionMaxWidth = layout.width;
180
- }
181
- if (kind === 'sheet') {
182
- containerStyle = [containerStyle, { marginTop: -layout.overlap }];
183
- surfaceStyle = [styles.footerSheet, { width: layout.width }];
184
- sectionMaxWidth = layout.width - margin * 2;
185
- }
186
-
187
39
  return (
188
40
  <View
189
41
  pointerEvents={'box-none'}
190
- onLayout={layout.handleLayout}
191
- style={containerStyle}
42
+ style={[
43
+ hasContentInset && styles.footerClip,
44
+ {
45
+ marginLeft: insetLeft,
46
+ marginRight: insetRight,
47
+ },
48
+ ]}
192
49
  >
193
50
  <View
194
51
  style={[
195
- surfaceStyle,
52
+ styles.shadow,
196
53
  {
197
54
  paddingBottom: bottomSpace + Spacing.S,
198
55
  backgroundColor: surfaceColor,
199
56
  },
200
57
  ]}
201
58
  >
202
- <Section useMargin={marginFooter} maxWidth={sectionMaxWidth}>
203
- {footer}
204
- </Section>
59
+ <Section useMargin={marginFooter}>{footer}</Section>
205
60
  </View>
206
61
  </View>
207
62
  );
208
63
  };
209
-
210
- export type { FooterLayout };
211
-
212
- export {
213
- ScreenFooter,
214
- getFooterGeometry,
215
- getFooterStyle,
216
- renderFooterSpacer,
217
- useFooterLayout,
218
- };
@@ -13,13 +13,9 @@ import {
13
13
  SearchHeader,
14
14
  } from '../Application';
15
15
  import { DuoGlassBackground } from '../Application/Components/DuoGlassBackground';
16
- import {
17
- type HeaderContentLayout,
18
- useHeaderFrameOptions,
19
- useHeaderLayout,
20
- } from '../Application/headerLayout';
16
+ import { type HeaderContentLayout } from '../Application/headerLayout';
21
17
  import { getHeaderMargin } from './utils';
22
- import { ANIMATED_BANNER_HEIGHT } from './screenTypes';
18
+ import { useHeaderBarOptions } from './useHeaderBarOptions';
23
19
  import { HeaderType } from './types';
24
20
 
25
21
  type ScreenHeaderParams = {
@@ -34,18 +30,20 @@ type ScreenHeaderParams = {
34
30
  useShadowHeader: boolean;
35
31
  gradientColor?: string;
36
32
  headerBackground?: string;
37
- layoutOffset: number;
33
+ bannerBottom: number;
38
34
  contentLayout?: HeaderContentLayout;
39
35
  };
40
36
 
41
37
  /**
42
38
  * Transparent header for an `inputSearchProps` Screen: its title fades out over the
43
- * first 50pt of scroll while the search collapses into the bar.
39
+ * first 50pt of scroll while the search collapses into the bar (`searchTitleOptions`).
44
40
  */
45
41
  const getSearchTitleOptions = (
46
42
  sharedValue: SharedValue<number>,
43
+ searchTitleOptions: StackNavigationOptions,
47
44
  ): StackNavigationOptions => {
48
45
  return {
46
+ ...searchTitleOptions,
49
47
  headerShown: true,
50
48
  headerTransparent: true,
51
49
  headerBackground: () => null,
@@ -79,14 +77,14 @@ export const useScreenHeader = ({
79
77
  useShadowHeader,
80
78
  gradientColor,
81
79
  headerBackground,
82
- layoutOffset,
80
+ bannerBottom,
83
81
  contentLayout,
84
82
  }: ScreenHeaderParams) => {
85
83
  const currentTint = useRef<string | undefined>(undefined);
86
84
  const appliedHeaderMode = useRef<string | undefined>(undefined);
87
85
  const searchHeaderParams = useRef<SearchHeaderProps | undefined>(undefined);
88
- const headerLayout = useHeaderLayout(contentLayout);
89
- const frameOptions = useHeaderFrameOptions(contentLayout);
86
+ const headerBarOptions = useHeaderBarOptions(layout, contentLayout);
87
+ const { barOptions, searchTitleOptions, searchOptions } = headerBarOptions;
90
88
 
91
89
  // keepTitle leaves a title the screen set itself when the same type is re-applied
92
90
  const setHeaderType = useCallback(
@@ -115,7 +113,7 @@ export const useScreenHeader = ({
115
113
  headerTitle: (props: any) => <HeaderTitle {...props} />,
116
114
  };
117
115
  if (inputSearchProps) {
118
- options = getSearchTitleOptions(sharedValue);
116
+ options = getSearchTitleOptions(sharedValue, searchTitleOptions);
119
117
  }
120
118
  break;
121
119
 
@@ -149,7 +147,7 @@ export const useScreenHeader = ({
149
147
  headerTitle: (props: any) => <HeaderTitle {...props} />,
150
148
  };
151
149
  if (inputSearchProps) {
152
- options = getSearchTitleOptions(sharedValue);
150
+ options = getSearchTitleOptions(sharedValue, searchTitleOptions);
153
151
  }
154
152
  }
155
153
 
@@ -159,7 +157,7 @@ export const useScreenHeader = ({
159
157
 
160
158
  navigation?.instance?.setOptions({
161
159
  header: undefined,
162
- ...frameOptions,
160
+ ...barOptions,
163
161
  ...options,
164
162
  });
165
163
  },
@@ -172,7 +170,8 @@ export const useScreenHeader = ({
172
170
  useShadowHeader,
173
171
  hasSideBar,
174
172
  quickReturnOptions,
175
- frameOptions,
173
+ barOptions,
174
+ searchTitleOptions,
176
175
  ],
177
176
  );
178
177
 
@@ -193,7 +192,7 @@ export const useScreenHeader = ({
193
192
  return (
194
193
  <DuoGlassBackground
195
194
  animatedValue={sharedValue}
196
- bannerBottom={ANIMATED_BANNER_HEIGHT + layoutOffset}
195
+ bannerBottom={bannerBottom}
197
196
  />
198
197
  );
199
198
  }
@@ -220,7 +219,7 @@ export const useScreenHeader = ({
220
219
  };
221
220
  }
222
221
 
223
- navigation?.instance?.setOptions({ ...frameOptions, ...options });
222
+ navigation?.instance?.setOptions({ ...barOptions, ...options });
224
223
  },
225
224
  [
226
225
  gradientColor,
@@ -229,24 +228,20 @@ export const useScreenHeader = ({
229
228
  sharedValue,
230
229
  useShadowHeader,
231
230
  hasSideBar,
232
- layoutOffset,
231
+ bannerBottom,
233
232
  quickReturnOptions,
234
- frameOptions,
233
+ barOptions,
235
234
  ],
236
235
  );
237
236
 
238
237
  const setAnimatedSearch = useCallback(() => {
239
- const options = getSearchTitleOptions(sharedValue);
240
- navigation?.instance?.setOptions({
241
- header: undefined,
242
- ...frameOptions,
243
- ...options,
244
- });
245
- }, [navigation?.instance, sharedValue, frameOptions]);
238
+ const options = getSearchTitleOptions(sharedValue, searchTitleOptions);
239
+ navigation?.instance?.setOptions({ header: undefined, ...options });
240
+ }, [navigation?.instance, sharedValue, searchTitleOptions]);
246
241
 
247
- // the search field spans the content (or the stretch frame), clear of the side bar
248
- // and status bar clusters; kept as numbers so the setter below stays stable
249
- let searchWidth = headerLayout.frameWidth;
242
+ // the search field spans the content, clear of the side bar and status bar
243
+ // clusters; kept as numbers so the setter below stays stable
244
+ let searchWidth = layout.width - Spacing.M * 2;
250
245
  let searchLeft = Spacing.M;
251
246
  if (layout.sideBar) {
252
247
  searchWidth = layout.contentWidth - Spacing.M * 2;
@@ -265,7 +260,7 @@ export const useScreenHeader = ({
265
260
  (params: SearchHeaderProps) => {
266
261
  searchHeaderParams.current = params;
267
262
  const options: StackNavigationOptions = {
268
- ...frameOptions,
263
+ ...searchOptions,
269
264
  headerRight: undefined,
270
265
  headerTitleContainerStyle: {
271
266
  width: searchWidth,
@@ -291,7 +286,7 @@ export const useScreenHeader = ({
291
286
 
292
287
  navigation?.instance?.setOptions(options);
293
288
  },
294
- [navigation?.instance, sharedValue, frameOptions, searchWidth, searchLeft],
289
+ [navigation?.instance, sharedValue, searchOptions, searchWidth, searchLeft],
295
290
  );
296
291
 
297
292
  useEffect(() => {
@@ -7,7 +7,7 @@ import {
7
7
  SearchHeaderProps,
8
8
  } from '../Application/types';
9
9
  import { FloatingButtonProps } from './FloatingButton';
10
- import { HeaderType, ScreenFooterStyle } from './types';
10
+ import { HeaderType } from './types';
11
11
  import { InputRef } from '../Input';
12
12
  import type { HeaderContentLayout } from '../Application/headerLayout';
13
13
 
@@ -65,21 +65,6 @@ export interface ScreenProps extends ViewProps {
65
65
  */
66
66
  marginFooter?: boolean;
67
67
 
68
- /**
69
- * Optional. Footer look on foldable inner displays and wide windows: `anchored`, a
70
- * full-width bar with a top border, or `sheet`, a centered sheet over the body. Content
71
- * is capped at 600pt (800pt on windows from 800pt). Defaults to the host's design
72
- * system config (`footerStyle`), else `anchored`. Phones keep the current footer.
73
- */
74
- footerStyle?: ScreenFooterStyle;
75
-
76
- /**
77
- * Optional. If `true`, the footer draws its own full-width image background, so a
78
- * `sheet` footer falls back to the `anchored` layout, without the top border.
79
- * Defaults to `false`.
80
- */
81
- footerHasImageBackground?: boolean;
82
-
83
68
  /**
84
69
  * Optional. Background color of the screen.
85
70
  */
@@ -98,9 +83,9 @@ export interface ScreenProps extends ViewProps {
98
83
  headerRightWidth?: 0 | 84 | 124 | number;
99
84
 
100
85
  /**
101
- * Optional. `stretch` centers back, title or search and the right cluster of the
102
- * header in a 600pt frame on wide windows (foldable inner display, tablet); the
103
- * background and status bar stay full width. Defaults to `grid`.
86
+ * Optional. `stretch` centers back, title and the right cluster of the header in a
87
+ * 600pt frame on wide windows (foldable inner display, tablet); the background,
88
+ * status bar and a search header stay full width. Defaults to `grid`.
104
89
  */
105
90
  contentLayout?: HeaderContentLayout;
106
91
 
package/Layout/styles.ts CHANGED
@@ -91,15 +91,6 @@ export default StyleSheet.create({
91
91
  },
92
92
  }),
93
93
  },
94
- footerBar: {
95
- paddingTop: Spacing.S,
96
- },
97
- footerSheet: {
98
- paddingTop: Spacing.S,
99
- alignSelf: 'center',
100
- borderTopLeftRadius: Radius.XL,
101
- borderTopRightRadius: Radius.XL,
102
- },
103
94
  footerClip: {
104
95
  marginTop: -Spacing.XL,
105
96
  paddingTop: Spacing.XL,
@@ -107,6 +98,5 @@ export default StyleSheet.create({
107
98
  },
108
99
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
109
100
  expanded: { flex: 1 },
110
- centered: { alignSelf: 'center' },
111
101
  rowWrap: { flexDirection: 'row', flexWrap: 'wrap' },
112
102
  });
package/Layout/types.ts CHANGED
@@ -2,12 +2,6 @@ import { NavigationOptions, SearchHeaderProps } from '../Application/types';
2
2
 
3
3
  export type HeaderType = 'default' | 'extended' | 'none';
4
4
 
5
- /**
6
- * Screen footer look on foldable inner displays and wide windows: `anchored` is a
7
- * full-width bar with a top border, `sheet` a centered sheet over the body.
8
- */
9
- export type ScreenFooterStyle = 'anchored' | 'sheet';
10
-
11
5
  export type ScreenRef = {
12
6
  /**
13
7
  * Applies navigation options to the screen's header.
@@ -0,0 +1,54 @@
1
+ import { useMemo } from 'react';
2
+ import type { StackNavigationOptions } from '@react-navigation/stack';
3
+ import {
4
+ getSearchHeaderHeight,
5
+ type HeaderContentLayout,
6
+ useHeaderFrameOptions,
7
+ } from '../Application/headerLayout';
8
+ import type { ScreenLayout } from './layoutTypes';
9
+
10
+ type HeaderBarOptions = {
11
+ barOptions: StackNavigationOptions;
12
+ searchTitleOptions: StackNavigationOptions;
13
+ searchOptions: StackNavigationOptions;
14
+ };
15
+
16
+ /**
17
+ * Header row options for the Screen setters: the plain bar and the taller title row
18
+ * above an `inputSearchProps` search, both in the `contentLayout` frame, and the
19
+ * search header row, which spans the window and leaves the frame.
20
+ */
21
+ const useHeaderBarOptions = (
22
+ layout: ScreenLayout,
23
+ contentLayout?: HeaderContentLayout,
24
+ ): HeaderBarOptions => {
25
+ const frameOptions = useHeaderFrameOptions(contentLayout);
26
+ // the search header fills the bar, so it keeps the bar-edge row with either layout
27
+ let searchLayout: HeaderContentLayout | undefined;
28
+ if (contentLayout) {
29
+ searchLayout = 'grid';
30
+ }
31
+ const edgeOptions = useHeaderFrameOptions(searchLayout);
32
+ const { headerHeight, headerStatusBarHeight } = layout;
33
+ const searchHeight = getSearchHeaderHeight(
34
+ headerHeight,
35
+ headerStatusBarHeight,
36
+ );
37
+
38
+ // the height is re-applied on every header type, so a former search row does not stay
39
+ const barOptions = useMemo((): StackNavigationOptions => {
40
+ return { ...frameOptions, headerStyle: { height: headerHeight } };
41
+ }, [frameOptions, headerHeight]);
42
+
43
+ const searchTitleOptions = useMemo((): StackNavigationOptions => {
44
+ return { ...frameOptions, headerStyle: { height: searchHeight } };
45
+ }, [frameOptions, searchHeight]);
46
+
47
+ const searchOptions = useMemo((): StackNavigationOptions => {
48
+ return { ...edgeOptions, headerStyle: { height: searchHeight } };
49
+ }, [edgeOptions, searchHeight]);
50
+
51
+ return { barOptions, searchTitleOptions, searchOptions };
52
+ };
53
+
54
+ export { useHeaderBarOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.169.17-beta.9",
3
+ "version": "0.169.17",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -1,56 +0,0 @@
1
- import { getFooterGeometry, getFooterStyle } from '../screenFooter';
2
-
3
- // the grid row pulls in every foundation component; geometry does not render
4
- jest.mock('../Section', () => ({ __esModule: true, default: () => null }));
5
-
6
- const PHONE = { width: 390, height: 844, contentWidth: 390 };
7
- const FOLD_PORTRAIT = { width: 760, height: 900, contentWidth: 760 };
8
- const FOLD_LANDSCAPE = { width: 860, height: 700, contentWidth: 860 };
9
- const TABLET = { width: 1194, height: 834, contentWidth: 1194 };
10
- const ANCHORED = {
11
- footerStyle: 'anchored' as const,
12
- hasImageBackground: false,
13
- };
14
- const SHEET = { footerStyle: 'sheet' as const, hasImageBackground: false };
15
-
16
- describe('getFooterGeometry', () => {
17
- it('keeps the phone footer below 600pt, landscape included', () => {
18
- expect(getFooterGeometry({ ...PHONE, ...SHEET }).kind).toBe('phone');
19
- const landscape = { width: 844, height: 390, contentWidth: 844 };
20
- expect(getFooterGeometry({ ...landscape, ...SHEET }).kind).toBe('phone');
21
- });
22
-
23
- it('caps the width at 600pt below an 800pt window, 800pt from it', () => {
24
- expect(getFooterGeometry({ ...FOLD_PORTRAIT, ...ANCHORED })).toEqual({
25
- kind: 'anchored',
26
- width: 600,
27
- });
28
- expect(getFooterGeometry({ ...FOLD_LANDSCAPE, ...SHEET })).toEqual({
29
- kind: 'sheet',
30
- width: 800,
31
- });
32
- expect(getFooterGeometry({ ...TABLET, ...SHEET }).width).toBe(800);
33
- });
34
-
35
- it('keeps the width inside the content area minus its margins', () => {
36
- const duoInner = { width: 669, height: 900, contentWidth: 585 };
37
- expect(getFooterGeometry({ ...duoInner, ...ANCHORED }).width).toBe(561);
38
- });
39
-
40
- it('drops the sheet for an image background', () => {
41
- const input = { ...FOLD_LANDSCAPE, ...SHEET, hasImageBackground: true };
42
- expect(getFooterGeometry(input).kind).toBe('anchored');
43
- });
44
- });
45
-
46
- describe('getFooterStyle', () => {
47
- it('lets the screen prop win over the host config', () => {
48
- expect(getFooterStyle('anchored', 'sheet')).toBe('anchored');
49
- expect(getFooterStyle(undefined, 'sheet')).toBe('sheet');
50
- });
51
-
52
- it('falls back to anchored for a missing or unknown value', () => {
53
- expect(getFooterStyle()).toBe('anchored');
54
- expect(getFooterStyle(undefined, 'floating')).toBe('anchored');
55
- });
56
- });