@momo-kits/foundation 0.169.6 → 0.169.7-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/BottomSheet.hooks.ts +8 -8
- package/Application/BottomSheet.parts.tsx +34 -44
- package/Application/BottomSheet.tsx +37 -40
- package/Application/BottomTab/ActiveIndicator.tsx +14 -15
- package/Application/BottomTab/BottomTabBar.tsx +62 -49
- package/Application/BottomTab/BottomTabInset.tsx +4 -8
- package/Application/BottomTab/CurvedContainer.tsx +12 -14
- package/Application/BottomTab/CustomBottomTabItem.tsx +13 -13
- package/Application/BottomTab/DuoBarCompression.tsx +19 -13
- package/Application/BottomTab/DuoRailTabBar.tsx +24 -20
- package/Application/BottomTab/DuoTabBar.tsx +10 -8
- package/Application/BottomTab/TabBarIcon.tsx +29 -15
- package/Application/BottomTab/TabScreen.tsx +5 -1
- package/Application/BottomTab/index.tsx +30 -33
- package/Application/BottomTab/metrics.ts +23 -23
- package/Application/BottomTab/tabItems.ts +1 -1
- package/Application/BottomTab/usePressLift.ts +2 -2
- package/Application/Components/BackgroundImageView.tsx +0 -4
- package/Application/Components/DuoGlassBackground.tsx +4 -5
- package/Application/Components/HeaderAnimated.tsx +0 -4
- package/Application/Components/HeaderBackground.tsx +0 -4
- package/Application/Components/HeaderExtendHeader.tsx +10 -11
- package/Application/Components/HeaderLeft.tsx +1 -2
- package/Application/Components/HeaderRight.tsx +1 -2
- package/Application/Components/HeaderTitle.shared.ts +9 -11
- package/Application/Components/HeaderTitle.tsx +3 -4
- package/Application/Components/HeaderToolkitAction.tsx +20 -17
- package/Application/Components/NavigationButton.tsx +1 -2
- package/Application/Components/SearchHeader.tsx +10 -17
- package/Application/Components/TitleJourney.tsx +2 -2
- package/Application/Components/TitleLocation.tsx +2 -2
- package/Application/Components/TitleUser.tsx +2 -2
- package/Application/Components/useToolkitActions.tsx +32 -17
- package/Application/KitAdoption/AdoptionBadge.tsx +119 -0
- package/Application/KitAdoption/AdoptionProbe.tsx +166 -0
- package/Application/KitAdoption/AdoptionStore.ts +80 -0
- package/Application/KitAdoption/Authorship/utils.ts +137 -0
- package/Application/KitAdoption/Slots/utils.ts +68 -0
- package/Application/KitAdoption/constants.ts +120 -0
- package/Application/KitAdoption/index.ts +12 -0
- package/Application/KitAdoption/styles.ts +55 -0
- package/Application/KitAdoption/types.ts +61 -0
- package/Application/KitAdoption/utils.ts +376 -0
- package/Application/Localize.ts +0 -7
- package/Application/ModalScreen.tsx +10 -10
- package/Application/Navigation.ts +16 -14
- package/Application/NavigationContainer.tsx +18 -19
- package/Application/Navigator.ts +48 -20
- package/Application/ScaleSizeProvider.tsx +6 -13
- package/Application/StackScreen.tracking.ts +33 -11
- package/Application/StackScreen.tsx +54 -10
- package/Application/TooltipPortal.tsx +5 -12
- package/Application/WidgetContainer.tsx +4 -10
- package/Application/__tests__/KitAdoption.integration.test.tsx +253 -0
- package/Application/__tests__/KitAdoption.test.ts +283 -0
- package/Application/__tests__/KitAdoptionAuthorship.test.ts +132 -0
- package/Application/__tests__/KitAdoptionStore.test.ts +110 -0
- package/Application/__tests__/KitAdoptionStructural.test.ts +193 -0
- package/Application/__tests__/modalLayout.test.ts +128 -0
- package/Application/modalLayout.ts +14 -13
- package/Application/navigationOptions.tsx +17 -21
- package/Badge/Badge.tsx +0 -5
- package/Badge/BadgeDot.tsx +0 -1
- package/Badge/BadgeDotAnimation.tsx +7 -15
- package/Badge/BadgeRibbon.tsx +38 -46
- package/Badge/Shape.tsx +0 -2
- package/Badge/types.ts +2 -2
- package/Button/index.tsx +16 -5
- package/Button/utils.ts +15 -9
- package/CheckBox/index.tsx +0 -4
- package/Consts/theme.ts +10 -10
- package/Context/index.ts +1 -5
- package/Divider/DashDivider.tsx +0 -1
- package/Divider/index.tsx +0 -4
- package/FoundationList/index.tsx +0 -4
- package/Icon/index.tsx +6 -6
- package/Icon/types.ts +1 -1
- package/IconButton/index.tsx +12 -4
- package/Image/index.tsx +7 -9
- package/Input/Input.tsx +9 -8
- package/Input/InputDropDown.tsx +12 -10
- package/Input/InputMoney.tsx +8 -12
- package/Input/InputMoneyView.tsx +7 -14
- package/Input/InputOTP.tsx +33 -35
- package/Input/InputPhoneNumber.tsx +9 -8
- package/Input/InputSearch.tsx +6 -4
- package/Input/InputTextArea.tsx +0 -4
- package/Input/SearchTextTyping.tsx +0 -4
- package/Input/SystemTextInput.tsx +2 -7
- package/Input/TextTyping.tsx +0 -4
- package/Input/common.tsx +12 -26
- package/Input/index.tsx +20 -17
- package/Input/moneyUtils.ts +4 -10
- package/Input/styles.ts +5 -0
- package/Input/utils.ts +12 -14
- package/Layout/Card.tsx +13 -16
- package/Layout/FloatingButton.tsx +0 -4
- package/Layout/Item.tsx +2 -6
- package/Layout/ItemList.tsx +7 -9
- package/Layout/ItemSectionList.tsx +1 -2
- package/Layout/ReservedRegions.tsx +25 -25
- package/Layout/Screen.tsx +58 -56
- package/Layout/Section.tsx +13 -17
- package/Layout/TrackingScope.tsx +0 -1
- package/Layout/constants.ts +19 -0
- package/Layout/screenContent.tsx +2 -4
- package/Layout/screenFooter.tsx +18 -28
- package/Layout/screenHeader.tsx +31 -34
- package/Layout/screenQuickReturn.tsx +20 -17
- package/Layout/screenScroll.ts +7 -4
- package/Layout/screenTypes.ts +2 -3
- package/Layout/types.ts +41 -3
- package/Layout/useGridSystem.ts +49 -0
- package/Layout/utils.ts +37 -38
- package/Loader/DotLoader.tsx +0 -4
- package/Loader/Loader.tsx +0 -4
- package/Loader/ProgressBar.tsx +0 -1
- package/Loader/Spinner.tsx +0 -4
- package/Loader/utils.ts +7 -11
- package/Pagination/Dot.tsx +0 -4
- package/Pagination/PaginationDot.tsx +0 -1
- package/Pagination/PaginationNumber.tsx +3 -5
- package/Pagination/PaginationScroll.tsx +0 -5
- package/Pagination/PaginationWhiteDot.tsx +0 -1
- package/Pagination/index.tsx +0 -4
- package/Pagination/types.ts +2 -2
- package/Popup/PopupNotify.tsx +48 -44
- package/Popup/PopupPromotion.tsx +7 -4
- package/Popup/types.ts +4 -4
- package/Popup/utils.ts +0 -4
- package/Radio/index.tsx +0 -4
- package/Skeleton/index.tsx +0 -8
- package/Switch/index.tsx +0 -1
- package/Tag/index.tsx +1 -5
- package/Tag/types.ts +3 -3
- package/Text/index.tsx +3 -14
- package/Text/styles.ts +1 -1
- package/Text/types.ts +6 -1
- package/Text/utils.ts +4 -20
- package/Title/index.tsx +32 -41
- package/ViewBoundary/index.tsx +2 -4
- package/index.ts +6 -0
- package/package.json +1 -1
package/Layout/Card.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { View, ViewProps } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { GRID_GUTTER, GRID_MARGIN } from './constants';
|
|
4
|
+
import { useGridSystem } from './useGridSystem';
|
|
4
5
|
import { GridContextProps } from './types';
|
|
5
6
|
import { GridContext } from './index';
|
|
6
7
|
import { Image } from '../Image';
|
|
7
8
|
import { ApplicationContext } from '../Context';
|
|
8
9
|
import styles from './styles';
|
|
9
|
-
import { Radius, Shadow
|
|
10
|
+
import { Radius, Shadow } from '../Consts';
|
|
10
11
|
|
|
11
12
|
export interface CardProps extends ViewProps {
|
|
12
13
|
/**
|
|
@@ -20,10 +21,6 @@ export interface CardProps extends ViewProps {
|
|
|
20
21
|
useShadow?: boolean;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
/**
|
|
24
|
-
* Surface card across the content width minus 12pt margins, with its own grid for child
|
|
25
|
-
* Items; optional background image and light shadow.
|
|
26
|
-
*/
|
|
27
24
|
const Card: React.FC<CardProps> = ({
|
|
28
25
|
children,
|
|
29
26
|
style,
|
|
@@ -32,19 +29,19 @@ const Card: React.FC<CardProps> = ({
|
|
|
32
29
|
...props
|
|
33
30
|
}) => {
|
|
34
31
|
const { theme } = useContext(ApplicationContext);
|
|
35
|
-
const { numberOfColumns } = useGridSystem();
|
|
36
|
-
const { contentWidth } = useScreenLayout();
|
|
32
|
+
const { numberOfColumns, gridWidth, gridOffset } = useGridSystem();
|
|
37
33
|
|
|
38
|
-
const gutterSize =
|
|
39
|
-
const margin =
|
|
40
|
-
const widthSection =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
const gutterSize = GRID_GUTTER;
|
|
35
|
+
const margin = GRID_MARGIN;
|
|
36
|
+
const widthSection = gridWidth - margin * 2;
|
|
37
|
+
let sizePerSpan =
|
|
38
|
+
(widthSection - margin * 2 - gutterSize * (numberOfColumns - 1)) /
|
|
39
|
+
numberOfColumns -
|
|
40
|
+
1 / numberOfColumns;
|
|
44
41
|
|
|
45
42
|
const gridContext: GridContextProps = {
|
|
46
43
|
numberOfColumns,
|
|
47
|
-
gutterSize:
|
|
44
|
+
gutterSize: GRID_GUTTER,
|
|
48
45
|
sizePerSpan,
|
|
49
46
|
getSizeSpan: span => {
|
|
50
47
|
return sizePerSpan * span + gutterSize * (span - 1);
|
|
@@ -63,7 +60,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
63
60
|
styles.card,
|
|
64
61
|
{
|
|
65
62
|
width: widthSection,
|
|
66
|
-
marginHorizontal: margin,
|
|
63
|
+
marginHorizontal: gridOffset + margin,
|
|
67
64
|
gap: gutterSize,
|
|
68
65
|
},
|
|
69
66
|
!!backgroundImage && { backgroundColor: undefined },
|
|
@@ -31,10 +31,6 @@ export interface FloatingButtonProps {
|
|
|
31
31
|
renderComponent?: () => React.ReactNode;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* Floating action button above the screen bottom. With a label and a scroll value it
|
|
36
|
-
* shrinks to its icon while scrolling down and expands again on scroll up.
|
|
37
|
-
*/
|
|
38
34
|
export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
39
35
|
renderComponent,
|
|
40
36
|
label = '',
|
package/Layout/Item.tsx
CHANGED
|
@@ -7,20 +7,16 @@ import { SpanNumber } from './types';
|
|
|
7
7
|
|
|
8
8
|
export interface ItemProps extends ViewProps {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Represents the width of the Card component in terms of span numbers (1-36, out of the grid's 12, 24 or 36 columns).
|
|
11
11
|
*/
|
|
12
12
|
widthSpan?: SpanNumber;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Optional.
|
|
15
|
+
* Optional. Represents the height of the Card component in terms of span numbers (1-36, out of the grid's 12, 24 or 36 columns).
|
|
16
16
|
*/
|
|
17
17
|
heightSpan?: SpanNumber;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Grid cell sized from the enclosing GridContext; outlined when the mini app turns on
|
|
22
|
-
* the baseline debug feature.
|
|
23
|
-
*/
|
|
24
20
|
const Item: React.FC<ItemProps> = ({
|
|
25
21
|
widthSpan,
|
|
26
22
|
heightSpan,
|
package/Layout/ItemList.tsx
CHANGED
|
@@ -7,16 +7,12 @@ import { SpanNumber } from './types';
|
|
|
7
7
|
|
|
8
8
|
export interface ItemListProps extends FlatListProps<any> {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Represents the width of the Card component in terms of span numbers (1-12).
|
|
11
11
|
*/
|
|
12
12
|
widthSpan?: SpanNumber;
|
|
13
13
|
data: any[];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* FlatList on the grid: `widthSpan` sets how many items share a row, and every item but
|
|
18
|
-
* the first of a row gets the gutter on its left.
|
|
19
|
-
*/
|
|
20
16
|
const ItemList = forwardRef(
|
|
21
17
|
(
|
|
22
18
|
{
|
|
@@ -34,9 +30,6 @@ const ItemList = forwardRef(
|
|
|
34
30
|
const indexBegin = props?.data?.map(
|
|
35
31
|
(_i: any, index: number) => index * numColumns,
|
|
36
32
|
);
|
|
37
|
-
const defaultKeyExtractor = (item: any, index: number) => {
|
|
38
|
-
return (item?.id ?? item?.key ?? index).toString();
|
|
39
|
-
};
|
|
40
33
|
const _renderItem = (item: any) => {
|
|
41
34
|
if (indexBegin?.includes(item?.index)) {
|
|
42
35
|
return <Item widthSpan={widthItem}>{renderItem?.(item)}</Item>;
|
|
@@ -53,7 +46,12 @@ const ItemList = forwardRef(
|
|
|
53
46
|
ref={ref as React.RefObject<FlatList>}
|
|
54
47
|
{...props}
|
|
55
48
|
key={`ItemList-${numColumns}`}
|
|
56
|
-
keyExtractor={
|
|
49
|
+
keyExtractor={
|
|
50
|
+
// prefer caller's keyExtractor; fallback to common id/key/index
|
|
51
|
+
(props as any)?.keyExtractor ??
|
|
52
|
+
((item: any, index: number) =>
|
|
53
|
+
(item?.id ?? item?.key ?? index).toString())
|
|
54
|
+
}
|
|
57
55
|
numColumns={numColumns}
|
|
58
56
|
renderItem={_renderItem}
|
|
59
57
|
horizontal={false}
|
|
@@ -7,12 +7,11 @@ import { SpanNumber } from './types';
|
|
|
7
7
|
|
|
8
8
|
export interface ItemSectionListProps extends SectionListProps<any> {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Represents the width of the Card component in terms of span numbers (1-12).
|
|
11
11
|
*/
|
|
12
12
|
widthSpan?: SpanNumber;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
/** SectionList whose items sit on the grid, `widthSpan` columns wide, a gutter apart. */
|
|
16
15
|
const ItemSectionList: FC<ItemSectionListProps> = ({
|
|
17
16
|
renderItem,
|
|
18
17
|
widthSpan,
|
|
@@ -19,43 +19,43 @@ try {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* the root view so they line up with window coordinates
|
|
22
|
+
* screen regions the system currently occludes, relative to the provider, which fills
|
|
23
|
+
* the root view so they line up with window coordinates
|
|
24
24
|
*/
|
|
25
25
|
const ReservedRegionsContext = createContext<ReservedRegion[]>([]);
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
* half folded. `undefined` while the display is flat or the system reports none
|
|
28
|
+
* vertical seam splitting the display into left and right halves, e.g. iPhone Duo
|
|
29
|
+
* half folded. `undefined` while the display is flat or the system reports none
|
|
30
30
|
*/
|
|
31
31
|
const HingeContext = createContext<ReservedRegion | undefined>(undefined);
|
|
32
32
|
|
|
33
|
-
/** Frame of the vertical hinge (see HingeContext), `undefined` while the display is flat. */
|
|
34
33
|
const useHinge = () => useContext(HingeContext);
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
|
-
*
|
|
38
|
-
* provider.
|
|
36
|
+
* keeps the occlusion regions and the vertical division reported by the native provider
|
|
39
37
|
*/
|
|
40
38
|
const OcclusionRegions: React.FC<{
|
|
41
39
|
useRegions: NativeReservedRegions['useReservedRegions'];
|
|
42
40
|
children: ReactNode;
|
|
43
41
|
}> = ({ useRegions, children }) => {
|
|
44
42
|
const regions = useRegions();
|
|
45
|
-
const occlusion = useMemo(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
const occlusion = useMemo(
|
|
44
|
+
() =>
|
|
45
|
+
regions
|
|
46
|
+
.filter(region => region.kind === 'occlusion')
|
|
47
|
+
.map(region => region.frame),
|
|
48
|
+
[regions],
|
|
49
|
+
);
|
|
50
|
+
const hinge = useMemo(
|
|
51
|
+
() =>
|
|
52
|
+
regions.find(
|
|
53
|
+
region =>
|
|
54
|
+
region.kind === 'division' &&
|
|
55
|
+
region.frame.height > region.frame.width,
|
|
56
|
+
)?.frame,
|
|
57
|
+
[regions],
|
|
58
|
+
);
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
61
|
<ReservedRegionsContext.Provider value={occlusion}>
|
|
@@ -65,8 +65,8 @@ const OcclusionRegions: React.FC<{
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
* cluster growing for a call or a Live Activity
|
|
68
|
+
* tracks the system occlusion regions (iOS 27.1+), e.g. the iPhone Duo status bar
|
|
69
|
+
* cluster growing for a call or a Live Activity
|
|
70
70
|
*/
|
|
71
71
|
const ReservedRegionsProvider: React.FC<{ children: ReactNode }> = ({
|
|
72
72
|
children,
|
|
@@ -75,8 +75,8 @@ const ReservedRegionsProvider: React.FC<{ children: ReactNode }> = ({
|
|
|
75
75
|
return <>{children}</>;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
const NativeProvider =
|
|
79
|
-
|
|
78
|
+
const { ReservedRegionsProvider: NativeProvider, useReservedRegions } =
|
|
79
|
+
nativeLib;
|
|
80
80
|
return (
|
|
81
81
|
<NativeProvider style={styles.container}>
|
|
82
82
|
<OcclusionRegions useRegions={useReservedRegions}>
|
package/Layout/Screen.tsx
CHANGED
|
@@ -37,10 +37,6 @@ import { useScreenQuickReturn } from './screenQuickReturn';
|
|
|
37
37
|
|
|
38
38
|
export type { ScreenProps };
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* Screen container: sets the navigation header, lays children on the grid, and adds the
|
|
42
|
-
* scroll view, floating button and footer, with iPhone Duo side bar and tab bar insets.
|
|
43
|
-
*/
|
|
44
40
|
const Screen = forwardRef(
|
|
45
41
|
(
|
|
46
42
|
{
|
|
@@ -112,12 +108,14 @@ const Screen = forwardRef(
|
|
|
112
108
|
const isIOS = Platform.OS === 'ios';
|
|
113
109
|
const bottomInset = isIOS ? Math.min(insets.bottom, 21) : insets.bottom;
|
|
114
110
|
const hasSideBar = !!layout.sideBar;
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
const useDuoGlass =
|
|
112
|
+
hasSideBar &&
|
|
113
|
+
(headerType === 'default' || headerType === 'extended') &&
|
|
114
|
+
!animatedHeader &&
|
|
115
|
+
!inputSearchProps;
|
|
118
116
|
|
|
119
|
-
const
|
|
120
|
-
|
|
117
|
+
const useQuickReturn =
|
|
118
|
+
hasSideBar && scrollable && (useDuoGlass || !!animatedHeader);
|
|
121
119
|
const { quickReturnOptions, snapQuickReturnHeader } = useScreenQuickReturn(
|
|
122
120
|
sharedValue,
|
|
123
121
|
useQuickReturn,
|
|
@@ -125,10 +123,18 @@ const Screen = forwardRef(
|
|
|
125
123
|
);
|
|
126
124
|
|
|
127
125
|
let keyboardOffset = heightHeader - bottomInset;
|
|
128
|
-
if (
|
|
126
|
+
if (
|
|
127
|
+
headerType === 'extended' ||
|
|
128
|
+
animatedHeader ||
|
|
129
|
+
inputSearchProps ||
|
|
130
|
+
useDuoGlass
|
|
131
|
+
) {
|
|
129
132
|
keyboardOffset = -bottomInset;
|
|
130
133
|
}
|
|
131
134
|
|
|
135
|
+
/**
|
|
136
|
+
* inject params for screen tracking
|
|
137
|
+
*/
|
|
132
138
|
screen?.onSetParams?.(trackingParams);
|
|
133
139
|
|
|
134
140
|
const { setSearchHeader, currentTint } = useScreenHeader({
|
|
@@ -146,7 +152,9 @@ const Screen = forwardRef(
|
|
|
146
152
|
layoutOffset,
|
|
147
153
|
});
|
|
148
154
|
|
|
149
|
-
|
|
155
|
+
/**
|
|
156
|
+
* expose ref for screen
|
|
157
|
+
*/
|
|
150
158
|
useImperativeHandle(ref, () => {
|
|
151
159
|
return Object.assign(screenRef.current || {}, {
|
|
152
160
|
setOptions: (params: NavigationOptions) => {
|
|
@@ -157,18 +165,19 @@ const Screen = forwardRef(
|
|
|
157
165
|
});
|
|
158
166
|
});
|
|
159
167
|
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
const { handleScroll, handleScrollEnd, handleMomentumScrollEnd } =
|
|
169
|
+
createScrollHandlers({
|
|
170
|
+
scrollable,
|
|
171
|
+
animatedValue: animatedValue.current,
|
|
172
|
+
sharedValue,
|
|
173
|
+
scrollViewProps,
|
|
174
|
+
animatedHeader,
|
|
175
|
+
inputSearchProps,
|
|
176
|
+
currentTint,
|
|
177
|
+
navigation,
|
|
178
|
+
snapQuickReturnHeader,
|
|
179
|
+
ref,
|
|
180
|
+
});
|
|
172
181
|
const Component: any = scrollable ? Animated.ScrollView : View;
|
|
173
182
|
|
|
174
183
|
const getHeight = () => {
|
|
@@ -198,35 +207,6 @@ const Screen = forwardRef(
|
|
|
198
207
|
floatingButtonBottom = 12 + duoTabInset;
|
|
199
208
|
}
|
|
200
209
|
|
|
201
|
-
const renderHeaderLayer = () => {
|
|
202
|
-
if (useDuoGlass) {
|
|
203
|
-
return (
|
|
204
|
-
<DuoScrollGradient
|
|
205
|
-
animatedValue={sharedValue}
|
|
206
|
-
gradientColor={gradientColor}
|
|
207
|
-
headerBackground={headerBackground}
|
|
208
|
-
heightHeader={heightHeader}
|
|
209
|
-
extended={headerType === 'extended'}
|
|
210
|
-
followScroll={useQuickReturn}
|
|
211
|
-
/>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
return (
|
|
215
|
-
<HeaderExtendHeader
|
|
216
|
-
headerType={headerType}
|
|
217
|
-
heightHeader={heightHeader}
|
|
218
|
-
headerRightWidth={headerRightWidth}
|
|
219
|
-
animatedValue={sharedValue}
|
|
220
|
-
inputSearchProps={inputSearchProps}
|
|
221
|
-
navigation={navigation}
|
|
222
|
-
inputSearchRef={inputSearchRef}
|
|
223
|
-
useShadowHeader={useShadowHeader}
|
|
224
|
-
gradientColor={gradientColor}
|
|
225
|
-
headerBackground={headerBackground}
|
|
226
|
-
/>
|
|
227
|
-
);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
210
|
return (
|
|
231
211
|
<View
|
|
232
212
|
style={[
|
|
@@ -237,7 +217,29 @@ const Screen = forwardRef(
|
|
|
237
217
|
},
|
|
238
218
|
]}
|
|
239
219
|
>
|
|
240
|
-
{
|
|
220
|
+
{useDuoGlass ? (
|
|
221
|
+
<DuoScrollGradient
|
|
222
|
+
animatedValue={sharedValue}
|
|
223
|
+
gradientColor={gradientColor}
|
|
224
|
+
headerBackground={headerBackground}
|
|
225
|
+
heightHeader={heightHeader}
|
|
226
|
+
extended={headerType === 'extended'}
|
|
227
|
+
followScroll={useQuickReturn}
|
|
228
|
+
/>
|
|
229
|
+
) : (
|
|
230
|
+
<HeaderExtendHeader
|
|
231
|
+
headerType={headerType}
|
|
232
|
+
heightHeader={heightHeader}
|
|
233
|
+
headerRightWidth={headerRightWidth}
|
|
234
|
+
animatedValue={sharedValue}
|
|
235
|
+
inputSearchProps={inputSearchProps}
|
|
236
|
+
navigation={navigation}
|
|
237
|
+
inputSearchRef={inputSearchRef}
|
|
238
|
+
useShadowHeader={useShadowHeader}
|
|
239
|
+
gradientColor={gradientColor}
|
|
240
|
+
headerBackground={headerBackground}
|
|
241
|
+
/>
|
|
242
|
+
)}
|
|
241
243
|
|
|
242
244
|
<KeyboardAvoidingView
|
|
243
245
|
style={[
|
|
@@ -257,9 +259,9 @@ const Screen = forwardRef(
|
|
|
257
259
|
{...scrollViewProps}
|
|
258
260
|
ref={screenRef}
|
|
259
261
|
showsVerticalScrollIndicator={false}
|
|
260
|
-
onScroll={
|
|
261
|
-
onScrollEndDrag={
|
|
262
|
-
onMomentumScrollEnd={
|
|
262
|
+
onScroll={handleScroll}
|
|
263
|
+
onScrollEndDrag={handleScrollEnd}
|
|
264
|
+
onMomentumScrollEnd={handleMomentumScrollEnd}
|
|
263
265
|
scrollEventThrottle={16}
|
|
264
266
|
style={[
|
|
265
267
|
Styles.flex,
|
package/Layout/Section.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, ViewProps } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { GRID_GUTTER, GRID_MARGIN } from './constants';
|
|
4
|
+
import { useGridSystem } from './useGridSystem';
|
|
4
5
|
import { GridContextProps } from './types';
|
|
5
6
|
import { GridContext } from './index';
|
|
6
7
|
import styles from './styles';
|
|
7
8
|
import { Image } from '../Image';
|
|
8
|
-
import { Spacing } from '../Consts';
|
|
9
9
|
|
|
10
10
|
export interface SectionProps extends ViewProps {
|
|
11
11
|
/**
|
|
@@ -15,8 +15,8 @@ export interface SectionProps extends ViewProps {
|
|
|
15
15
|
expanded?: boolean;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Optional. If `true`,
|
|
19
|
-
* Defaults to `
|
|
18
|
+
* Optional. If `true`, margin will be applied to the Section component.
|
|
19
|
+
* Defaults to `false` if not provided.
|
|
20
20
|
*/
|
|
21
21
|
useMargin?: boolean;
|
|
22
22
|
|
|
@@ -26,10 +26,6 @@ export interface SectionProps extends ViewProps {
|
|
|
26
26
|
backgroundImage?: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Content-wide grid row (12 or 24 columns) with optional side margins; child Items size
|
|
31
|
-
* themselves from its GridContext.
|
|
32
|
-
*/
|
|
33
29
|
const Section: React.FC<SectionProps> = ({
|
|
34
30
|
children,
|
|
35
31
|
useMargin = true,
|
|
@@ -37,22 +33,22 @@ const Section: React.FC<SectionProps> = ({
|
|
|
37
33
|
style,
|
|
38
34
|
...props
|
|
39
35
|
}) => {
|
|
40
|
-
const { numberOfColumns } = useGridSystem();
|
|
41
|
-
const { contentWidth } = useScreenLayout();
|
|
36
|
+
const { numberOfColumns, gridWidth, gridOffset } = useGridSystem();
|
|
42
37
|
|
|
43
|
-
const gutterSize =
|
|
38
|
+
const gutterSize = GRID_GUTTER;
|
|
44
39
|
let margin = 0;
|
|
45
40
|
if (useMargin) {
|
|
46
|
-
margin =
|
|
41
|
+
margin = GRID_MARGIN;
|
|
47
42
|
}
|
|
48
|
-
const widthSection =
|
|
43
|
+
const widthSection = gridWidth - margin * 2;
|
|
49
44
|
|
|
50
|
-
const
|
|
51
|
-
|
|
45
|
+
const sizePerSpan =
|
|
46
|
+
(widthSection - gutterSize * (numberOfColumns - 1)) / numberOfColumns -
|
|
47
|
+
1 / numberOfColumns;
|
|
52
48
|
|
|
53
49
|
const gridContext: GridContextProps = {
|
|
54
50
|
numberOfColumns,
|
|
55
|
-
gutterSize:
|
|
51
|
+
gutterSize: GRID_GUTTER,
|
|
56
52
|
sizePerSpan,
|
|
57
53
|
getSizeSpan: span => {
|
|
58
54
|
return span * sizePerSpan + gutterSize * (span - 1);
|
|
@@ -70,7 +66,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
70
66
|
styles.rowWrap,
|
|
71
67
|
{
|
|
72
68
|
width: widthSection,
|
|
73
|
-
marginHorizontal: margin,
|
|
69
|
+
marginHorizontal: gridOffset + margin,
|
|
74
70
|
gap: gutterSize,
|
|
75
71
|
},
|
|
76
72
|
]}
|
package/Layout/TrackingScope.tsx
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const GRID_MARGIN = 12;
|
|
2
|
+
const GRID_GUTTER = 12;
|
|
3
|
+
const GRID_PHONE_MAX_WIDTH = 600;
|
|
4
|
+
const GRID_TABLET_MIN_WIDTH = 800;
|
|
5
|
+
const GRID_DESKTOP_MIN_WIDTH = 1100;
|
|
6
|
+
const GRID_PHONE_COLUMNS = 12;
|
|
7
|
+
const GRID_TABLET_COLUMNS = 24;
|
|
8
|
+
const GRID_DESKTOP_COLUMNS = 36;
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
GRID_DESKTOP_COLUMNS,
|
|
12
|
+
GRID_DESKTOP_MIN_WIDTH,
|
|
13
|
+
GRID_GUTTER,
|
|
14
|
+
GRID_MARGIN,
|
|
15
|
+
GRID_PHONE_COLUMNS,
|
|
16
|
+
GRID_PHONE_MAX_WIDTH,
|
|
17
|
+
GRID_TABLET_COLUMNS,
|
|
18
|
+
GRID_TABLET_MIN_WIDTH,
|
|
19
|
+
};
|
package/Layout/screenContent.tsx
CHANGED
|
@@ -9,8 +9,7 @@ import { AnimatedHeader } from '../Application/types';
|
|
|
9
9
|
type ContentInset = { insetLeft: number; insetRight: number };
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* and side insets; a child with `useMargin: false` gets no top spacing.
|
|
12
|
+
* build content for screen for grid rule
|
|
14
13
|
*/
|
|
15
14
|
export const renderContent = (content: any, layout: ContentInset): any => {
|
|
16
15
|
const results = validateChildren(content, [undefined]);
|
|
@@ -65,8 +64,7 @@ export const renderContent = (content: any, layout: ContentInset): any => {
|
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
/**
|
|
68
|
-
*
|
|
69
|
-
* `layoutOffset`. Nothing without a component.
|
|
67
|
+
* render top navigation banner
|
|
70
68
|
*/
|
|
71
69
|
export const renderAnimatedHeader = (
|
|
72
70
|
animatedHeader: AnimatedHeader | undefined,
|
package/Layout/screenFooter.tsx
CHANGED
|
@@ -16,10 +16,6 @@ type ScreenFooterProps = {
|
|
|
16
16
|
surfaceColor: string;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
/**
|
|
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.
|
|
22
|
-
*/
|
|
23
19
|
export const ScreenFooter = ({
|
|
24
20
|
footer,
|
|
25
21
|
marginFooter,
|
|
@@ -30,34 +26,28 @@ export const ScreenFooter = ({
|
|
|
30
26
|
duoTabInset,
|
|
31
27
|
bottomInset,
|
|
32
28
|
surfaceColor,
|
|
33
|
-
}: ScreenFooterProps) =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
}: ScreenFooterProps) => (
|
|
30
|
+
<View
|
|
31
|
+
pointerEvents={'box-none'}
|
|
32
|
+
style={[
|
|
33
|
+
hasContentInset && styles.footerClip,
|
|
34
|
+
{
|
|
35
|
+
marginLeft: insetLeft,
|
|
36
|
+
marginRight: insetRight,
|
|
37
|
+
},
|
|
38
|
+
]}
|
|
39
|
+
>
|
|
40
40
|
<View
|
|
41
|
-
pointerEvents={'box-none'}
|
|
42
41
|
style={[
|
|
43
|
-
|
|
42
|
+
styles.shadow,
|
|
44
43
|
{
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
paddingBottom:
|
|
45
|
+
(isTab && duoTabInset ? duoTabInset : bottomInset) + Spacing.S,
|
|
46
|
+
backgroundColor: surfaceColor,
|
|
47
47
|
},
|
|
48
48
|
]}
|
|
49
49
|
>
|
|
50
|
-
<
|
|
51
|
-
style={[
|
|
52
|
-
styles.shadow,
|
|
53
|
-
{
|
|
54
|
-
paddingBottom: bottomSpace + Spacing.S,
|
|
55
|
-
backgroundColor: surfaceColor,
|
|
56
|
-
},
|
|
57
|
-
]}
|
|
58
|
-
>
|
|
59
|
-
<Section useMargin={marginFooter}>{footer}</Section>
|
|
60
|
-
</View>
|
|
50
|
+
<Section useMargin={marginFooter}>{footer}</Section>
|
|
61
51
|
</View>
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
</View>
|
|
53
|
+
);
|