@momo-kits/foundation 0.169.16 → 0.169.17-beta.10
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.
- package/Application/modalLayout.ts +12 -4
- package/Layout/Screen.tsx +11 -5
- package/Layout/Section.tsx +14 -3
- package/Layout/__tests__/screenFooter.test.ts +56 -0
- package/Layout/screenFooter.tsx +181 -21
- package/Layout/screenTypes.ts +16 -1
- package/Layout/styles.ts +10 -0
- package/Layout/types.ts +6 -0
- package/package.json +1 -1
|
@@ -78,6 +78,14 @@ const clamp = (value: number, min: number, max: number) => {
|
|
|
78
78
|
return Math.min(Math.max(value, min), max);
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
/**
|
|
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.
|
|
84
|
+
*/
|
|
85
|
+
const isFoldableWindow = (width: number, height: number) => {
|
|
86
|
+
return Math.min(width, height) >= FOLDABLE_MIN_WIDTH;
|
|
87
|
+
};
|
|
88
|
+
|
|
81
89
|
/**
|
|
82
90
|
* Modal geometry for a window, pure so it can be tested without a device.
|
|
83
91
|
*/
|
|
@@ -88,10 +96,9 @@ const getModalLayout = ({
|
|
|
88
96
|
isDuo,
|
|
89
97
|
hinge,
|
|
90
98
|
}: ModalLayoutInput): ModalLayout => {
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
const isDuoOuter = isDuo && shortSide < FOLDABLE_MIN_WIDTH;
|
|
99
|
+
const isWideWindow = isFoldableWindow(width, height);
|
|
100
|
+
const isFoldable = isDuo || isWideWindow;
|
|
101
|
+
const isDuoOuter = isDuo && !isWideWindow;
|
|
95
102
|
const hingeRight = hinge ? hinge.x + hinge.width : 0;
|
|
96
103
|
const hasHinge = !!hinge && hinge.x > 0;
|
|
97
104
|
const isHingeInWindow = hingeRight < width - insets.right;
|
|
@@ -166,6 +173,7 @@ const useModalLayout = (): ModalLayout => {
|
|
|
166
173
|
|
|
167
174
|
export {
|
|
168
175
|
getModalLayout,
|
|
176
|
+
isFoldableWindow,
|
|
169
177
|
useModalLayout,
|
|
170
178
|
POPUP_MAX_WIDTH,
|
|
171
179
|
POPUP_MIN_WIDTH,
|
package/Layout/Screen.tsx
CHANGED
|
@@ -31,7 +31,11 @@ import { BottomTabInsetContext } from '../Application/BottomTab/BottomTabInset';
|
|
|
31
31
|
import { ScreenProps } from './screenTypes';
|
|
32
32
|
import { renderAnimatedHeader, renderContent } from './screenContent';
|
|
33
33
|
import { createScrollHandlers } from './screenScroll';
|
|
34
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
renderFooterSpacer,
|
|
36
|
+
ScreenFooter,
|
|
37
|
+
useFooterLayout,
|
|
38
|
+
} from './screenFooter';
|
|
35
39
|
import { useScreenHeader } from './screenHeader';
|
|
36
40
|
import { useScreenQuickReturn } from './screenQuickReturn';
|
|
37
41
|
|
|
@@ -53,6 +57,8 @@ const Screen = forwardRef(
|
|
|
53
57
|
headerComponent: Header,
|
|
54
58
|
footerComponent: Footer,
|
|
55
59
|
marginFooter = true,
|
|
60
|
+
footerStyle,
|
|
61
|
+
footerHasImageBackground: hasImageFooter,
|
|
56
62
|
layoutOffset = -56,
|
|
57
63
|
headerRightWidth,
|
|
58
64
|
backgroundColor,
|
|
@@ -78,6 +84,7 @@ const Screen = forwardRef(
|
|
|
78
84
|
const insets = useSafeAreaInsets();
|
|
79
85
|
const frame = useSafeAreaFrame();
|
|
80
86
|
const heightHeader = useHeaderHeight();
|
|
87
|
+
const footerLayout = useFooterLayout(layout, footerStyle, hasImageFooter);
|
|
81
88
|
|
|
82
89
|
const animatedValue = useRef<Animated.Value>(
|
|
83
90
|
customAnimatedValue ?? new Animated.Value(0),
|
|
@@ -195,7 +202,7 @@ const Screen = forwardRef(
|
|
|
195
202
|
|
|
196
203
|
let floatingButtonBottom = bottomInset + Spacing.S;
|
|
197
204
|
if (Footer) {
|
|
198
|
-
floatingButtonBottom = 12;
|
|
205
|
+
floatingButtonBottom = 12 + footerLayout.overlap;
|
|
199
206
|
} else if (isTab) {
|
|
200
207
|
floatingButtonBottom = 12 + duoTabInset;
|
|
201
208
|
}
|
|
@@ -285,6 +292,7 @@ const Screen = forwardRef(
|
|
|
285
292
|
)}
|
|
286
293
|
|
|
287
294
|
{useGridLayout ? renderContent(children, layout) : children}
|
|
295
|
+
{renderFooterSpacer(footerLayout.overlap)}
|
|
288
296
|
</Component>
|
|
289
297
|
|
|
290
298
|
{floatingButtonProps && (
|
|
@@ -306,9 +314,7 @@ const Screen = forwardRef(
|
|
|
306
314
|
<ScreenFooter
|
|
307
315
|
footer={Footer}
|
|
308
316
|
marginFooter={marginFooter}
|
|
309
|
-
|
|
310
|
-
insetRight={layout.insetRight}
|
|
311
|
-
hasContentInset={hasContentInset}
|
|
317
|
+
layout={footerLayout}
|
|
312
318
|
isTab={isTab}
|
|
313
319
|
duoTabInset={duoTabInset}
|
|
314
320
|
bottomInset={bottomInset}
|
package/Layout/Section.tsx
CHANGED
|
@@ -24,16 +24,22 @@ 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;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
/**
|
|
30
|
-
* Content-wide grid row (12 or 24 columns) with optional side margins
|
|
31
|
-
* themselves from its GridContext.
|
|
35
|
+
* Content-wide grid row (12 or 24 columns) with optional side margins, capped by
|
|
36
|
+
* `maxWidth`; child Items size themselves from its GridContext.
|
|
32
37
|
*/
|
|
33
38
|
const Section: React.FC<SectionProps> = ({
|
|
34
39
|
children,
|
|
35
40
|
useMargin = true,
|
|
36
41
|
backgroundImage,
|
|
42
|
+
maxWidth,
|
|
37
43
|
style,
|
|
38
44
|
...props
|
|
39
45
|
}) => {
|
|
@@ -45,7 +51,11 @@ const Section: React.FC<SectionProps> = ({
|
|
|
45
51
|
if (useMargin) {
|
|
46
52
|
margin = 12;
|
|
47
53
|
}
|
|
48
|
-
const
|
|
54
|
+
const isCapped = maxWidth !== undefined;
|
|
55
|
+
let widthSection = contentWidth - margin * 2;
|
|
56
|
+
if (isCapped) {
|
|
57
|
+
widthSection = Math.min(widthSection, maxWidth);
|
|
58
|
+
}
|
|
49
59
|
|
|
50
60
|
const columnsWidth = widthSection - gutterSize * (numberOfColumns - 1);
|
|
51
61
|
const sizePerSpan = columnsWidth / numberOfColumns - 1 / numberOfColumns;
|
|
@@ -68,6 +78,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
68
78
|
style,
|
|
69
79
|
styles.protectedStyle,
|
|
70
80
|
styles.rowWrap,
|
|
81
|
+
isCapped && styles.centered,
|
|
71
82
|
{
|
|
72
83
|
width: widthSection,
|
|
73
84
|
marginHorizontal: margin,
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
});
|
package/Layout/screenFooter.tsx
CHANGED
|
@@ -1,15 +1,54 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
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';
|
|
3
5
|
import { Spacing } from '../Consts';
|
|
6
|
+
import { ScreenLayout } from './layoutTypes';
|
|
7
|
+
import { ScreenFooterStyle } from './types';
|
|
4
8
|
import Section from './Section';
|
|
5
9
|
import styles from './styles';
|
|
6
10
|
|
|
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
|
+
/**
|
|
36
|
+
* `false` on a foldable with an image background, so the screen's image shows through.
|
|
37
|
+
*/
|
|
38
|
+
hasSurface: boolean;
|
|
39
|
+
insetLeft: number;
|
|
40
|
+
insetRight: number;
|
|
41
|
+
/**
|
|
42
|
+
* Height the sheet overlaps the body by; 0 while the footer sits below the body.
|
|
43
|
+
*/
|
|
44
|
+
overlap: number;
|
|
45
|
+
handleLayout: (event: LayoutChangeEvent) => void;
|
|
46
|
+
};
|
|
47
|
+
|
|
7
48
|
type ScreenFooterProps = {
|
|
8
49
|
footer: ReactNode;
|
|
9
50
|
marginFooter: boolean;
|
|
10
|
-
|
|
11
|
-
insetRight: number;
|
|
12
|
-
hasContentInset: boolean;
|
|
51
|
+
layout: FooterLayout;
|
|
13
52
|
isTab: boolean;
|
|
14
53
|
duoTabInset: number;
|
|
15
54
|
bottomInset: number;
|
|
@@ -17,47 +56,168 @@ type ScreenFooterProps = {
|
|
|
17
56
|
};
|
|
18
57
|
|
|
19
58
|
/**
|
|
20
|
-
*
|
|
21
|
-
|
|
59
|
+
* The screen prop wins over the host's design system config; anything else is `anchored`.
|
|
60
|
+
*/
|
|
61
|
+
const getFooterStyle = (
|
|
62
|
+
footerStyle?: ScreenFooterStyle,
|
|
63
|
+
configured?: unknown,
|
|
64
|
+
): ScreenFooterStyle => {
|
|
65
|
+
if ((footerStyle ?? configured) === 'sheet') {
|
|
66
|
+
return 'sheet';
|
|
67
|
+
}
|
|
68
|
+
return 'anchored';
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Footer kind and width (anchored content or sheet) for a window, pure so it can be
|
|
73
|
+
* tested without a device. Phones, iPhone Duo outer included, keep the shadowed bar.
|
|
74
|
+
*/
|
|
75
|
+
const getFooterGeometry = ({
|
|
76
|
+
width,
|
|
77
|
+
height,
|
|
78
|
+
contentWidth,
|
|
79
|
+
footerStyle,
|
|
80
|
+
hasImageBackground,
|
|
81
|
+
}: FooterGeometryInput): FooterGeometry => {
|
|
82
|
+
if (!isFoldableWindow(width, height)) {
|
|
83
|
+
return { kind: 'phone', width: contentWidth };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let maxWidth = FOOTER_MAX_WIDTH;
|
|
87
|
+
if (width >= FOOTER_WIDE_WINDOW_MIN_WIDTH) {
|
|
88
|
+
maxWidth = FOOTER_WIDE_MAX_WIDTH;
|
|
89
|
+
}
|
|
90
|
+
const footerWidth = Math.min(contentWidth - Spacing.M * 2, maxWidth);
|
|
91
|
+
// an image background spans the window, so it never sits in a sheet
|
|
92
|
+
const isSheet = footerStyle === 'sheet' && !hasImageBackground;
|
|
93
|
+
return { kind: isSheet ? 'sheet' : 'anchored', width: footerWidth };
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Footer layout for the screen layout. A sheet overlaps the body, so its measured
|
|
98
|
+
* height comes back as `overlap` for the body to pad its end by.
|
|
99
|
+
*/
|
|
100
|
+
const useFooterLayout = (
|
|
101
|
+
layout: ScreenLayout,
|
|
102
|
+
footerStyle?: ScreenFooterStyle,
|
|
103
|
+
hasImageBackground = false,
|
|
104
|
+
): FooterLayout => {
|
|
105
|
+
const context: DesignSystemContext | undefined = useContext(MiniAppContext);
|
|
106
|
+
const [height, setHeight] = useState(0);
|
|
107
|
+
const handleLayout = useCallback((event: LayoutChangeEvent) => {
|
|
108
|
+
setHeight(event.nativeEvent.layout.height);
|
|
109
|
+
}, []);
|
|
110
|
+
|
|
111
|
+
const configured = context?.designSystemConfig?.config?.footerStyle;
|
|
112
|
+
const geometry = getFooterGeometry({
|
|
113
|
+
width: layout.width,
|
|
114
|
+
height: layout.height,
|
|
115
|
+
contentWidth: layout.contentWidth,
|
|
116
|
+
footerStyle: getFooterStyle(footerStyle, configured),
|
|
117
|
+
hasImageBackground,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
let overlap = 0;
|
|
121
|
+
if (geometry.kind === 'sheet') {
|
|
122
|
+
overlap = height;
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
...geometry,
|
|
126
|
+
hasBorder: geometry.kind === 'anchored' && !hasImageBackground,
|
|
127
|
+
hasSurface: geometry.kind === 'phone' || !hasImageBackground,
|
|
128
|
+
insetLeft: layout.insetLeft,
|
|
129
|
+
insetRight: layout.insetRight,
|
|
130
|
+
overlap,
|
|
131
|
+
handleLayout,
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Spacer at the end of the body so a sheet footer does not cover its last element.
|
|
137
|
+
*/
|
|
138
|
+
const renderFooterSpacer = (overlap: number) => {
|
|
139
|
+
if (!overlap) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
return <View style={{ height: overlap }} />;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Screen footer on the surface color above the home indicator or the floating tab bar.
|
|
147
|
+
* Phones keep the top shadow; foldables cap the content under a full-width bar with a
|
|
148
|
+
* top border (`anchored`) or in a centered sheet over the body (`sheet`).
|
|
22
149
|
*/
|
|
23
|
-
|
|
150
|
+
const ScreenFooter = ({
|
|
24
151
|
footer,
|
|
25
152
|
marginFooter,
|
|
26
|
-
|
|
27
|
-
insetRight,
|
|
28
|
-
hasContentInset,
|
|
153
|
+
layout,
|
|
29
154
|
isTab,
|
|
30
155
|
duoTabInset,
|
|
31
156
|
bottomInset,
|
|
32
157
|
surfaceColor,
|
|
33
158
|
}: ScreenFooterProps) => {
|
|
159
|
+
const { theme } = useContext(ApplicationContext);
|
|
34
160
|
let bottomSpace = bottomInset;
|
|
35
161
|
if (isTab && duoTabInset) {
|
|
36
162
|
bottomSpace = duoTabInset;
|
|
37
163
|
}
|
|
38
164
|
|
|
165
|
+
const { kind, insetLeft, insetRight } = layout;
|
|
166
|
+
const hasContentInset = insetLeft > 0 || insetRight > 0;
|
|
167
|
+
const margin = marginFooter ? Spacing.M : 0;
|
|
168
|
+
|
|
169
|
+
// one view tree for every kind, so folding keeps the footer content's state
|
|
170
|
+
let containerStyle: StyleProp<ViewStyle> = [
|
|
171
|
+
kind === 'phone' && hasContentInset && styles.footerClip,
|
|
172
|
+
{ marginLeft: insetLeft, marginRight: insetRight },
|
|
173
|
+
];
|
|
174
|
+
let surfaceStyle: StyleProp<ViewStyle> = styles.shadow;
|
|
175
|
+
let sectionMaxWidth: number | undefined;
|
|
176
|
+
if (kind === 'anchored') {
|
|
177
|
+
surfaceStyle = [
|
|
178
|
+
styles.footerBar,
|
|
179
|
+
layout.hasBorder && {
|
|
180
|
+
borderTopWidth: FOOTER_BORDER_WIDTH,
|
|
181
|
+
borderTopColor: theme.colors.border.default,
|
|
182
|
+
},
|
|
183
|
+
];
|
|
184
|
+
sectionMaxWidth = layout.width;
|
|
185
|
+
}
|
|
186
|
+
if (kind === 'sheet') {
|
|
187
|
+
containerStyle = [containerStyle, { marginTop: -layout.overlap }];
|
|
188
|
+
surfaceStyle = [styles.footerSheet, { width: layout.width }];
|
|
189
|
+
sectionMaxWidth = layout.width - margin * 2;
|
|
190
|
+
}
|
|
191
|
+
|
|
39
192
|
return (
|
|
40
193
|
<View
|
|
41
194
|
pointerEvents={'box-none'}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
marginLeft: insetLeft,
|
|
46
|
-
marginRight: insetRight,
|
|
47
|
-
},
|
|
48
|
-
]}
|
|
195
|
+
onLayout={layout.handleLayout}
|
|
196
|
+
style={containerStyle}
|
|
49
197
|
>
|
|
50
198
|
<View
|
|
51
199
|
style={[
|
|
52
|
-
|
|
200
|
+
surfaceStyle,
|
|
53
201
|
{
|
|
54
202
|
paddingBottom: bottomSpace + Spacing.S,
|
|
55
|
-
backgroundColor: surfaceColor,
|
|
203
|
+
backgroundColor: layout.hasSurface ? surfaceColor : undefined,
|
|
56
204
|
},
|
|
57
205
|
]}
|
|
58
206
|
>
|
|
59
|
-
<Section useMargin={marginFooter}
|
|
207
|
+
<Section useMargin={marginFooter} maxWidth={sectionMaxWidth}>
|
|
208
|
+
{footer}
|
|
209
|
+
</Section>
|
|
60
210
|
</View>
|
|
61
211
|
</View>
|
|
62
212
|
);
|
|
63
213
|
};
|
|
214
|
+
|
|
215
|
+
export type { FooterLayout };
|
|
216
|
+
|
|
217
|
+
export {
|
|
218
|
+
ScreenFooter,
|
|
219
|
+
getFooterGeometry,
|
|
220
|
+
getFooterStyle,
|
|
221
|
+
renderFooterSpacer,
|
|
222
|
+
useFooterLayout,
|
|
223
|
+
};
|
package/Layout/screenTypes.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SearchHeaderProps,
|
|
8
8
|
} from '../Application/types';
|
|
9
9
|
import { FloatingButtonProps } from './FloatingButton';
|
|
10
|
-
import { HeaderType } from './types';
|
|
10
|
+
import { HeaderType, ScreenFooterStyle } from './types';
|
|
11
11
|
import { InputRef } from '../Input';
|
|
12
12
|
import type { HeaderContentLayout } from '../Application/headerLayout';
|
|
13
13
|
|
|
@@ -65,6 +65,21 @@ 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 screen draws an image behind the footer: on foldables the
|
|
78
|
+
* footer drops its surface fill, sheet and top border so the image shows through.
|
|
79
|
+
* Defaults to `false`.
|
|
80
|
+
*/
|
|
81
|
+
footerHasImageBackground?: boolean;
|
|
82
|
+
|
|
68
83
|
/**
|
|
69
84
|
* Optional. Background color of the screen.
|
|
70
85
|
*/
|
package/Layout/styles.ts
CHANGED
|
@@ -91,6 +91,15 @@ 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
|
+
},
|
|
94
103
|
footerClip: {
|
|
95
104
|
marginTop: -Spacing.XL,
|
|
96
105
|
paddingTop: Spacing.XL,
|
|
@@ -98,5 +107,6 @@ export default StyleSheet.create({
|
|
|
98
107
|
},
|
|
99
108
|
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
100
109
|
expanded: { flex: 1 },
|
|
110
|
+
centered: { alignSelf: 'center' },
|
|
101
111
|
rowWrap: { flexDirection: 'row', flexWrap: 'wrap' },
|
|
102
112
|
});
|
package/Layout/types.ts
CHANGED
|
@@ -2,6 +2,12 @@ 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
|
+
|
|
5
11
|
export type ScreenRef = {
|
|
6
12
|
/**
|
|
7
13
|
* Applies navigation options to the screen's header.
|