@momo-kits/foundation 0.169.7-beta.6 → 0.169.7-beta.7
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/Components/HeaderExtendHeader.tsx +5 -13
- package/Application/Components/HeaderLeft.tsx +2 -17
- package/Application/Components/HeaderRight.styles.ts +0 -4
- package/Application/Components/HeaderTitle.shared.ts +3 -9
- package/Application/Components/HeaderToolkitAction.tsx +1 -35
- package/Application/Components/SearchHeader.tsx +3 -9
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import BackgroundImageView from './BackgroundImageView';
|
|
|
17
17
|
import { type AnimatedCompatValue } from '../utils';
|
|
18
18
|
import { useNormalizedSharedValue } from '../hooks';
|
|
19
19
|
import { useScreenLayout } from '../../Layout';
|
|
20
|
-
import {
|
|
20
|
+
import { HeaderMetrics } from '../../Layout/utils';
|
|
21
21
|
import {
|
|
22
22
|
HeaderBarMetrics,
|
|
23
23
|
type HeaderContentLayout,
|
|
@@ -66,17 +66,10 @@ const HeaderExtendHeader: React.FC<{
|
|
|
66
66
|
// the stretch frame pulls the search in from both bar edges
|
|
67
67
|
const frameShift = headerLayout.frameInset - sidePadding;
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
let toolkitWidth = TOOLKIT_WIDTH;
|
|
71
|
-
// the iPhone Duo status bar row keeps side bar sized back and toolkit
|
|
72
|
-
if (layout.statusBarClearance) {
|
|
73
|
-
backWidth = DuoMetrics.controlSize;
|
|
74
|
-
toolkitWidth = DuoMetrics.itemPitch * 2 + SCREEN_PADDING;
|
|
75
|
-
}
|
|
76
|
-
const backLeft = backWidth + sidePadding + titleGap;
|
|
69
|
+
const backLeft = buttonSize + sidePadding + titleGap;
|
|
77
70
|
const defaultLeft = layout.sideBar ? SCREEN_PADDING : backLeft;
|
|
78
71
|
const leftPosition = inputSearchProps?.leftPosition || defaultLeft;
|
|
79
|
-
const defaultRightWidth = layout.sideBar ? 0 :
|
|
72
|
+
const defaultRightWidth = layout.sideBar ? 0 : TOOLKIT_WIDTH;
|
|
80
73
|
const headerRightWidth = customHeaderRightWidth ?? defaultRightWidth;
|
|
81
74
|
const contentLeft = layout.insetLeft + SCREEN_PADDING + frameShift;
|
|
82
75
|
const contentRight = layout.insetLeft + layout.contentWidth - frameShift;
|
|
@@ -92,9 +85,8 @@ const HeaderExtendHeader: React.FC<{
|
|
|
92
85
|
const titleRowHeight = layout.headerHeight - layout.headerStatusBarHeight;
|
|
93
86
|
const collapsedRaise = (titleRowHeight - HeaderMetrics.barHeight) / 2;
|
|
94
87
|
|
|
95
|
-
// the iPhone Duo side bar
|
|
96
|
-
const
|
|
97
|
-
const searchSize = isDuoRow ? 'default' : 'header';
|
|
88
|
+
// the iPhone Duo side bar keeps the content search size
|
|
89
|
+
const searchSize = layout.sideBar ? 'default' : 'header';
|
|
98
90
|
|
|
99
91
|
let useShadowHeader = useShadowHeaderProp;
|
|
100
92
|
if (inputSearchProps && Platform.OS === 'android') {
|
|
@@ -6,13 +6,13 @@ import { PopupNotify } from '../../Popup';
|
|
|
6
6
|
import { NavigationButton } from './NavigationButton';
|
|
7
7
|
import { SideBarButton } from './SideBarButton';
|
|
8
8
|
import Animated from 'react-native-reanimated';
|
|
9
|
-
import {
|
|
9
|
+
import { useSideBarItemStyle } from '../../Layout/utils';
|
|
10
10
|
import { useSideBarCounterStyle } from './DuoQuickReturnHeader';
|
|
11
11
|
import { HeaderBarMetrics } from '../headerLayout';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Header back button, also bound to the Android hardware back. `preventBack`
|
|
15
|
-
* confirms in a popup first; the iPhone Duo
|
|
15
|
+
* confirms in a popup first; the iPhone Duo side bar uses the 48pt side bar button.
|
|
16
16
|
*/
|
|
17
17
|
const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
18
18
|
tintColor,
|
|
@@ -25,7 +25,6 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
25
25
|
const { navigator } = useContext(ApplicationContext);
|
|
26
26
|
const sideBarStyle = useSideBarItemStyle('left', 0);
|
|
27
27
|
const counterStyle = useSideBarCounterStyle();
|
|
28
|
-
const { statusBarClearance } = useScreenLayout();
|
|
29
28
|
|
|
30
29
|
const goBack = useCallback(() => {
|
|
31
30
|
const canGoBack = navigator?.ref?.current?.canGoBack?.();
|
|
@@ -98,20 +97,6 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
98
97
|
);
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
// on the status bar row the controls keep the side bar size
|
|
102
|
-
if (statusBarClearance) {
|
|
103
|
-
return (
|
|
104
|
-
<View style={styles.headerLeft}>
|
|
105
|
-
<SideBarButton
|
|
106
|
-
accessibilityLabel="btn_navigation_back"
|
|
107
|
-
icon="arrow-back"
|
|
108
|
-
tintColor={tintColor}
|
|
109
|
-
onPress={goBackSafe}
|
|
110
|
-
/>
|
|
111
|
-
</View>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
100
|
return (
|
|
116
101
|
<View style={styles.headerLeft}>
|
|
117
102
|
<NavigationButton
|
|
@@ -23,28 +23,22 @@ const useHeaderFontFamily = (): string => {
|
|
|
23
23
|
const HEADER_ACTIONS_WIDTH =
|
|
24
24
|
sidePadding * 2 + buttonSize + titleGap * 2 + clusterWidth;
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* extra width the 48pt back and toolkit take on the iPhone Duo status bar row
|
|
28
|
-
*/
|
|
29
|
-
const STATUS_BAR_ROW_ACTIONS_EXTRA = 43;
|
|
30
|
-
|
|
31
26
|
/**
|
|
32
27
|
* Max header title width. The iPhone Duo side bar takes back and toolkit out of
|
|
33
|
-
* the bar, so the title gets the content width; otherwise it shares the bar with
|
|
28
|
+
* the bar, so the title gets the content width; otherwise it shares the bar with
|
|
29
|
+
* them, minus the status bar clusters on the iPhone Duo inner portrait row.
|
|
34
30
|
*/
|
|
35
31
|
const useTitleMaxWidth = () => {
|
|
36
32
|
const layout = useScreenLayout();
|
|
37
33
|
const { width, contentWidth, sideBar, statusBarClearance } = layout;
|
|
38
34
|
let clearance = 0;
|
|
39
|
-
let rowActionsExtra = 0;
|
|
40
35
|
if (statusBarClearance) {
|
|
41
36
|
clearance = statusBarClearance.left + statusBarClearance.right;
|
|
42
|
-
rowActionsExtra = STATUS_BAR_ROW_ACTIONS_EXTRA;
|
|
43
37
|
}
|
|
44
38
|
if (sideBar) {
|
|
45
39
|
return contentWidth - Spacing.M * 2 - clearance;
|
|
46
40
|
}
|
|
47
|
-
return width - HEADER_ACTIONS_WIDTH -
|
|
41
|
+
return width - HEADER_ACTIONS_WIDTH - clearance;
|
|
48
42
|
};
|
|
49
43
|
|
|
50
44
|
export { useHeaderFontFamily, HEADER_ACTIONS_WIDTH, useTitleMaxWidth };
|
|
@@ -4,7 +4,7 @@ import { NavigationButton } from './NavigationButton';
|
|
|
4
4
|
import { MiniAppContext } from '../../Context';
|
|
5
5
|
import { Colors, Spacing, Styles } from '../../Consts';
|
|
6
6
|
import { Icon } from '../../Icon';
|
|
7
|
-
import { DuoMetrics
|
|
7
|
+
import { DuoMetrics } from '../../Layout/utils';
|
|
8
8
|
import { SideBarButton, SideBarGroup, SideBarGroupItem } from './SideBarButton';
|
|
9
9
|
import { useDuoBarCompression } from '../BottomTab/DuoBarCompression';
|
|
10
10
|
import { styles } from './HeaderRight.styles';
|
|
@@ -32,7 +32,6 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
32
32
|
const compression = useDuoBarCompression();
|
|
33
33
|
const { toolbarCompressed, toolbarHidden } = compression;
|
|
34
34
|
const { expandToolbar, setToolbarHeight } = compression;
|
|
35
|
-
const { statusBarClearance } = useScreenLayout();
|
|
36
35
|
const {
|
|
37
36
|
isLoading,
|
|
38
37
|
iconShortcut,
|
|
@@ -132,39 +131,6 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
132
131
|
);
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
// on the status bar row the controls keep the side bar size
|
|
136
|
-
if (statusBarClearance) {
|
|
137
|
-
return (
|
|
138
|
-
<View style={styles.sideBarRow}>
|
|
139
|
-
{useShortcut && (
|
|
140
|
-
<SideBarButton
|
|
141
|
-
disabled={isLoading}
|
|
142
|
-
icon={iconShortcut}
|
|
143
|
-
onPress={shortcutOnPress}
|
|
144
|
-
tintColor={tintColor}
|
|
145
|
-
showBadge={showBadge}
|
|
146
|
-
/>
|
|
147
|
-
)}
|
|
148
|
-
<SideBarGroup tintColor={tintColor} horizontal>
|
|
149
|
-
{useHelpCenter && (
|
|
150
|
-
<SideBarGroupItem
|
|
151
|
-
accessibilityLabel={'btn_navigation_help_center'}
|
|
152
|
-
icon={'help_center'}
|
|
153
|
-
tintColor={tintColor}
|
|
154
|
-
onPress={onPressHelpCenter}
|
|
155
|
-
/>
|
|
156
|
-
)}
|
|
157
|
-
<SideBarGroupItem
|
|
158
|
-
accessibilityLabel={'btn_navigation_close'}
|
|
159
|
-
icon={closeIcon}
|
|
160
|
-
tintColor={tintColor}
|
|
161
|
-
onPress={onClose}
|
|
162
|
-
/>
|
|
163
|
-
</SideBarGroup>
|
|
164
|
-
</View>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
134
|
return (
|
|
169
135
|
<View style={Styles.row}>
|
|
170
136
|
{useShortcut && (
|
|
@@ -8,13 +8,12 @@ import { ApplicationContext, MiniAppContext } from '../../Context';
|
|
|
8
8
|
import { Text } from '../../Text';
|
|
9
9
|
import { useNormalizedSharedValue } from '../hooks';
|
|
10
10
|
import { useScreenLayout } from '../../Layout';
|
|
11
|
-
import { DuoMetrics } from '../../Layout/utils';
|
|
12
11
|
import { HeaderBarMetrics } from '../headerLayout';
|
|
13
12
|
|
|
14
13
|
const { buttonSize, pillWidth, sidePadding, titleGap } = HeaderBarMetrics;
|
|
15
14
|
// help center | home pill and the bar padding right of it
|
|
16
15
|
const TOOLKIT_WIDTH = pillWidth + sidePadding;
|
|
17
|
-
// the iPhone Duo side bar
|
|
16
|
+
// the iPhone Duo side bar keeps its right header width
|
|
18
17
|
const DUO_TOOLKIT_WIDTH = 73;
|
|
19
18
|
|
|
20
19
|
/**
|
|
@@ -35,20 +34,15 @@ const SearchHeader = React.forwardRef<InputRef, SearchHeaderProps>(
|
|
|
35
34
|
const { theme, navigator } = useContext(ApplicationContext);
|
|
36
35
|
const context = useContext<any>(MiniAppContext);
|
|
37
36
|
const layout = useScreenLayout();
|
|
38
|
-
// the iPhone Duo status bar row keeps a side bar sized back button
|
|
39
|
-
let backWidth = buttonSize;
|
|
40
|
-
if (layout.statusBarClearance) {
|
|
41
|
-
backWidth = DuoMetrics.controlSize;
|
|
42
|
-
}
|
|
43
37
|
let defaultRightWidth = TOOLKIT_WIDTH;
|
|
44
38
|
let searchSize: InputSearchProps['size'] = 'header';
|
|
45
|
-
if (layout.sideBar
|
|
39
|
+
if (layout.sideBar) {
|
|
46
40
|
defaultRightWidth = DUO_TOOLKIT_WIDTH;
|
|
47
41
|
searchSize = 'default';
|
|
48
42
|
}
|
|
49
43
|
|
|
50
44
|
const sharedValue = useNormalizedSharedValue(animatedValue);
|
|
51
|
-
const defaultLeft =
|
|
45
|
+
const defaultLeft = buttonSize + sidePadding + titleGap;
|
|
52
46
|
const leftPosition = props?.leftPosition ?? defaultLeft;
|
|
53
47
|
const headerRightWidth = props?.headerRightWidth ?? defaultRightWidth;
|
|
54
48
|
|