@momo-kits/foundation 0.168.1-beta.39 → 0.168.1-beta.40
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.tsx +398 -86
- package/Application/BottomTab/BottomTabBar.tsx +275 -215
- package/Application/BottomTab/CustomBottomTabItem.tsx +107 -131
- package/Application/BottomTab/DuoBarCompression.tsx +28 -14
- package/Application/BottomTab/DuoTabBar.tsx +540 -32
- package/Application/BottomTab/TabBarIcon.tsx +72 -146
- package/Application/BottomTab/index.tsx +353 -89
- package/Application/BottomTab/useLiquidSelection.ts +374 -0
- package/Application/Components/BackgroundImageView.tsx +0 -4
- package/Application/Components/DuoGlassBackground.tsx +5 -7
- package/Application/Components/HeaderAnimated.tsx +13 -41
- package/Application/Components/HeaderBackground.tsx +3 -20
- package/Application/Components/HeaderExtendHeader.tsx +46 -66
- package/Application/Components/HeaderLeft.tsx +18 -5
- package/Application/Components/HeaderRight.tsx +529 -8
- package/Application/Components/HeaderTitle.tsx +579 -16
- package/Application/Components/NavigationButton.tsx +11 -18
- package/Application/Components/SearchHeader.tsx +18 -38
- package/Application/Localize.ts +0 -7
- package/Application/ModalScreen.tsx +18 -41
- package/Application/Navigation.ts +17 -15
- package/Application/NavigationContainer.tsx +21 -23
- package/Application/Navigator.ts +48 -20
- package/Application/ScaleSizeProvider.tsx +6 -13
- package/Application/StackScreen.tsx +172 -27
- package/Application/TooltipPortal.tsx +5 -12
- package/Application/WidgetContainer.tsx +7 -20
- package/Application/device.ts +52 -0
- package/Application/index.ts +1 -23
- package/Application/types.ts +242 -17
- package/Application/utils.tsx +493 -0
- package/Badge/Badge.tsx +0 -5
- package/Badge/BadgeDot.tsx +0 -1
- package/Badge/BadgeDotAnimation.tsx +7 -15
- package/Badge/BadgeRibbon.tsx +39 -47
- package/Badge/Shape.tsx +0 -2
- package/Badge/styles.ts +0 -2
- package/Badge/types.ts +2 -2
- package/Button/index.tsx +152 -21
- package/Button/styles.ts +1 -1
- package/CheckBox/index.tsx +6 -5
- package/Consts/theme.ts +10 -10
- package/Context/index.ts +1 -5
- package/Divider/DashDivider.tsx +11 -11
- package/Divider/index.tsx +7 -21
- 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 +12 -10
- package/Input/InputDropDown.tsx +13 -10
- package/Input/InputMoney.tsx +152 -45
- package/Input/InputOTP.tsx +34 -36
- package/Input/InputPhoneNumber.tsx +5 -8
- package/Input/InputSearch.tsx +111 -19
- package/Input/InputTextArea.tsx +5 -5
- package/Input/SystemTextInput.tsx +2 -7
- package/Input/TextTyping.tsx +0 -4
- package/Input/common.tsx +17 -31
- package/Input/index.tsx +21 -24
- package/Input/styles.ts +5 -25
- package/Input/utils.ts +12 -14
- package/Layout/Card.tsx +4 -7
- package/Layout/FloatingButton.tsx +21 -26
- package/Layout/Item.tsx +2 -6
- package/Layout/ItemList.tsx +7 -9
- package/Layout/ItemSectionList.tsx +1 -2
- package/Layout/ReservedRegions.tsx +17 -34
- package/Layout/Screen.tsx +696 -122
- package/Layout/Section.tsx +7 -9
- package/Layout/TrackingScope.tsx +0 -1
- package/Layout/index.ts +4 -10
- package/Layout/styles.ts +0 -2
- package/Layout/types.ts +4 -2
- package/Layout/utils.ts +181 -40
- package/Loader/DotLoader.tsx +3 -11
- package/Loader/Loader.tsx +0 -4
- package/Loader/ProgressBar.tsx +6 -3
- package/Loader/Spinner.tsx +3 -11
- package/Loader/styles.ts +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 +102 -94
- package/Popup/PopupPromotion.tsx +11 -9
- package/Popup/types.ts +4 -11
- package/Popup/utils.ts +18 -50
- package/Radio/index.tsx +10 -6
- package/Radio/styles.ts +0 -6
- package/Skeleton/index.tsx +9 -9
- package/Skeleton/styles.ts +0 -1
- package/Switch/index.tsx +0 -1
- package/Tag/index.tsx +4 -8
- package/Tag/types.ts +3 -3
- package/Text/index.tsx +5 -25
- package/Text/styles.ts +1 -1
- package/Text/types.ts +6 -1
- package/Text/utils.ts +4 -20
- package/Title/index.tsx +40 -42
- package/Title/styles.ts +0 -6
- package/ViewBoundary/index.tsx +2 -4
- package/index.ts +6 -0
- package/package.json +1 -2
- package/Application/BottomSheet.hooks.ts +0 -195
- package/Application/BottomSheet.parts.tsx +0 -157
- package/Application/BottomSheet.styles.ts +0 -43
- package/Application/BottomTab/ActiveIndicator.tsx +0 -91
- package/Application/BottomTab/BottomTabBar.styles.ts +0 -65
- package/Application/BottomTab/BottomTabInset.tsx +0 -18
- package/Application/BottomTab/CurvedContainer.tsx +0 -155
- package/Application/BottomTab/DuoRailTabBar.tsx +0 -223
- package/Application/BottomTab/DuoTabBar.styles.ts +0 -81
- package/Application/BottomTab/TabScreen.tsx +0 -160
- package/Application/BottomTab/metrics.ts +0 -164
- package/Application/BottomTab/tabItems.ts +0 -46
- package/Application/BottomTab/usePressLift.ts +0 -32
- package/Application/Components/HeaderRight.styles.ts +0 -146
- package/Application/Components/HeaderTitle.shared.ts +0 -44
- package/Application/Components/HeaderTitle.styles.ts +0 -125
- package/Application/Components/HeaderToolkitAction.tsx +0 -180
- package/Application/Components/SwipeBackHaptic.tsx +0 -95
- package/Application/Components/TitleJourney.tsx +0 -110
- package/Application/Components/TitleLocation.tsx +0 -73
- package/Application/Components/TitleUser.tsx +0 -304
- package/Application/Components/useToolkitActions.tsx +0 -218
- package/Application/ModalIconButton.tsx +0 -66
- package/Application/StackScreen.tracking.ts +0 -143
- package/Application/headerLayout.ts +0 -158
- package/Application/hooks.ts +0 -137
- package/Application/modalLayout.ts +0 -176
- package/Application/navigationOptions.tsx +0 -212
- package/Application/types.header.ts +0 -121
- package/Application/types.tabs.ts +0 -48
- package/Application/types.theme.ts +0 -87
- package/Application/utils.ts +0 -107
- package/Button/utils.ts +0 -133
- package/Input/InputMoneyView.tsx +0 -194
- package/Input/SearchTextTyping.tsx +0 -108
- package/Input/moneyUtils.ts +0 -23
- package/Layout/layoutMetrics.ts +0 -58
- package/Layout/layoutTypes.ts +0 -86
- package/Layout/screenContent.tsx +0 -92
- package/Layout/screenFooter.tsx +0 -63
- package/Layout/screenHeader.tsx +0 -321
- package/Layout/screenQuickReturn.tsx +0 -64
- package/Layout/screenScroll.ts +0 -107
- package/Layout/screenTypes.ts +0 -143
|
@@ -14,24 +14,14 @@ import { Colors, Radius, Spacing } from '../../Consts';
|
|
|
14
14
|
import { Image } from '../../Image';
|
|
15
15
|
import { SearchHeaderProps } from '../types';
|
|
16
16
|
import BackgroundImageView from './BackgroundImageView';
|
|
17
|
-
import {
|
|
18
|
-
import { useNormalizedSharedValue } from '../hooks';
|
|
17
|
+
import { AnimatedCompatValue, useNormalizedSharedValue } from '../utils';
|
|
19
18
|
import { useScreenLayout } from '../../Layout';
|
|
20
|
-
import { HeaderMetrics } from '../../Layout/utils';
|
|
21
|
-
import {
|
|
22
|
-
HeaderBarMetrics,
|
|
23
|
-
type HeaderContentLayout,
|
|
24
|
-
useHeaderLayout,
|
|
25
|
-
} from '../headerLayout';
|
|
19
|
+
import { DuoMetrics, HeaderMetrics } from '../../Layout/utils';
|
|
26
20
|
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const TOOLKIT_WIDTH =
|
|
21
|
+
const SCREEN_PADDING = 12;
|
|
22
|
+
const BACK_WIDTH = 28;
|
|
23
|
+
const TOOLKIT_WIDTH = 73;
|
|
30
24
|
|
|
31
|
-
/**
|
|
32
|
-
* Extended header background: a gradient that collapses on scroll and, with
|
|
33
|
-
* `inputSearchProps`, a full-width search that slides into the bar beside back/toolkit.
|
|
34
|
-
*/
|
|
35
25
|
const HeaderExtendHeader: React.FC<{
|
|
36
26
|
headerType?: HeaderType;
|
|
37
27
|
animatedValue: AnimatedCompatValue;
|
|
@@ -43,7 +33,6 @@ const HeaderExtendHeader: React.FC<{
|
|
|
43
33
|
useShadowHeader?: boolean;
|
|
44
34
|
gradientColor?: string;
|
|
45
35
|
headerBackground?: string;
|
|
46
|
-
contentLayout?: HeaderContentLayout;
|
|
47
36
|
}> = ({
|
|
48
37
|
headerType = 'default',
|
|
49
38
|
animatedValue,
|
|
@@ -54,7 +43,6 @@ const HeaderExtendHeader: React.FC<{
|
|
|
54
43
|
useShadowHeader: useShadowHeaderProp = true,
|
|
55
44
|
gradientColor: customGradientColor,
|
|
56
45
|
headerBackground: customBackground,
|
|
57
|
-
contentLayout,
|
|
58
46
|
}) => {
|
|
59
47
|
const { theme } = useContext(ApplicationContext);
|
|
60
48
|
const context = useContext<any>(MiniAppContext);
|
|
@@ -62,31 +50,31 @@ const HeaderExtendHeader: React.FC<{
|
|
|
62
50
|
const gradientColor = customGradientColor ?? theme.colors.gradient;
|
|
63
51
|
const headerBackground = customBackground ?? theme.assets?.headerBackground;
|
|
64
52
|
const layout = useScreenLayout();
|
|
65
|
-
const headerLayout = useHeaderLayout(contentLayout);
|
|
66
|
-
// the stretch frame pulls the search in from both bar edges
|
|
67
|
-
const frameShift = headerLayout.frameInset - sidePadding;
|
|
68
53
|
|
|
69
|
-
|
|
70
|
-
const
|
|
54
|
+
// the iPhone Duo status bar row keeps side bar sized back and toolkit
|
|
55
|
+
const isStatusBarRow = !!layout.statusBarClearance;
|
|
56
|
+
const duoToolkitWidth = DuoMetrics.itemPitch * 2 + SCREEN_PADDING;
|
|
57
|
+
const backWidth = isStatusBarRow ? DuoMetrics.controlSize : BACK_WIDTH;
|
|
58
|
+
const toolkitWidth = isStatusBarRow ? duoToolkitWidth : TOOLKIT_WIDTH;
|
|
59
|
+
const defaultLeft = layout.sideBar ? SCREEN_PADDING : backWidth + 20;
|
|
71
60
|
const leftPosition = inputSearchProps?.leftPosition || defaultLeft;
|
|
72
|
-
const defaultRightWidth = layout.sideBar ? 0 :
|
|
61
|
+
const defaultRightWidth = layout.sideBar ? 0 : toolkitWidth;
|
|
73
62
|
const headerRightWidth = customHeaderRightWidth ?? defaultRightWidth;
|
|
74
|
-
const contentLeft = layout.insetLeft + SCREEN_PADDING
|
|
75
|
-
const contentRight = layout.insetLeft + layout.contentWidth
|
|
63
|
+
const contentLeft = layout.insetLeft + SCREEN_PADDING;
|
|
64
|
+
const contentRight = layout.insetLeft + layout.contentWidth;
|
|
76
65
|
// collapsed on the status bar row, the search stays between its clusters
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
const collapsedSearchWidth = collapsedRight - collapsedLeft - SCREEN_PADDING;
|
|
66
|
+
const collapsedLeft =
|
|
67
|
+
layout.insetLeft + leftPosition + (layout.statusBarClearance?.left ?? 0);
|
|
68
|
+
const collapsedRight = contentRight - (layout.statusBarClearance?.right ?? 0);
|
|
69
|
+
const searchWidth = layout.contentWidth - SCREEN_PADDING * 2;
|
|
70
|
+
const collapsedSearchWidth =
|
|
71
|
+
collapsedRight - collapsedLeft - SCREEN_PADDING - headerRightWidth;
|
|
84
72
|
// a row taller than barHeight (iPhone Duo) centers the collapsed search on the title
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
const collapsedRaise =
|
|
74
|
+
(layout.headerHeight -
|
|
75
|
+
layout.headerStatusBarHeight -
|
|
76
|
+
HeaderMetrics.barHeight) /
|
|
77
|
+
2;
|
|
90
78
|
|
|
91
79
|
let useShadowHeader = useShadowHeaderProp;
|
|
92
80
|
if (inputSearchProps && Platform.OS === 'android') {
|
|
@@ -159,9 +147,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
159
147
|
|
|
160
148
|
if (inputSearchProps) {
|
|
161
149
|
return (
|
|
162
|
-
<View
|
|
163
|
-
style={[styles.container, showBaseLineDebug && styles.debugBaseLine]}
|
|
164
|
-
>
|
|
150
|
+
<View style={[{ zIndex: 0 }, showBaseLineDebug && styles.debugBaseLine]}>
|
|
165
151
|
<Animated.View style={heightStyle} />
|
|
166
152
|
<BackgroundImageView
|
|
167
153
|
useShadowHeader={useShadowHeader}
|
|
@@ -179,7 +165,6 @@ const HeaderExtendHeader: React.FC<{
|
|
|
179
165
|
<Animated.View
|
|
180
166
|
style={[
|
|
181
167
|
styles.extendedHeader,
|
|
182
|
-
headerLayout.isWide && styles.phoneHeight,
|
|
183
168
|
// fade out within the header box, as DuoScrollGradient does
|
|
184
169
|
!!layout.sideBar && styles.fillHeaderBox,
|
|
185
170
|
gradientOpacityStyle,
|
|
@@ -191,10 +176,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
191
176
|
>
|
|
192
177
|
{!!theme.assets?.headerBackground && (
|
|
193
178
|
<Image
|
|
194
|
-
style={
|
|
195
|
-
styles.headerBackground,
|
|
196
|
-
headerLayout.isWide && styles.phoneHeight,
|
|
197
|
-
]}
|
|
179
|
+
style={styles.headerBackground}
|
|
198
180
|
source={{ uri: theme.assets?.headerBackground }}
|
|
199
181
|
loading={false}
|
|
200
182
|
/>
|
|
@@ -203,7 +185,16 @@ const HeaderExtendHeader: React.FC<{
|
|
|
203
185
|
</Animated.View>
|
|
204
186
|
)}
|
|
205
187
|
</Animated.View>
|
|
206
|
-
<Animated.View
|
|
188
|
+
<Animated.View
|
|
189
|
+
style={[
|
|
190
|
+
{
|
|
191
|
+
justifyContent: 'flex-end',
|
|
192
|
+
position: 'absolute',
|
|
193
|
+
zIndex: 2,
|
|
194
|
+
},
|
|
195
|
+
heightStyle,
|
|
196
|
+
]}
|
|
197
|
+
>
|
|
207
198
|
<Animated.View
|
|
208
199
|
style={[{ marginVertical: Spacing.S }, searchTranslateStyle]}
|
|
209
200
|
>
|
|
@@ -213,7 +204,6 @@ const HeaderExtendHeader: React.FC<{
|
|
|
213
204
|
<InputSearch
|
|
214
205
|
{...inputSearchProps}
|
|
215
206
|
ref={inputSearchRef}
|
|
216
|
-
size={searchSize}
|
|
217
207
|
backgroundColor={'transparent'}
|
|
218
208
|
showButtonText={false}
|
|
219
209
|
/>
|
|
@@ -226,9 +216,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
226
216
|
|
|
227
217
|
if (headerType === 'extended') {
|
|
228
218
|
return (
|
|
229
|
-
<View
|
|
230
|
-
style={[styles.container, showBaseLineDebug && styles.debugBaseLine]}
|
|
231
|
-
>
|
|
219
|
+
<View style={[{ zIndex: 0 }, showBaseLineDebug && styles.debugBaseLine]}>
|
|
232
220
|
<BackgroundImageView
|
|
233
221
|
useShadowHeader={useShadowHeader}
|
|
234
222
|
heightHeader={heightHeader}
|
|
@@ -249,10 +237,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
249
237
|
>
|
|
250
238
|
{!!headerBackground && (
|
|
251
239
|
<Image
|
|
252
|
-
style={
|
|
253
|
-
styles.headerBackground,
|
|
254
|
-
headerLayout.isWide && styles.phoneHeight,
|
|
255
|
-
]}
|
|
240
|
+
style={styles.headerBackground}
|
|
256
241
|
source={{ uri: headerBackground }}
|
|
257
242
|
loading={false}
|
|
258
243
|
/>
|
|
@@ -280,11 +265,6 @@ const styles = StyleSheet.create({
|
|
|
280
265
|
position: 'absolute',
|
|
281
266
|
width: '100%',
|
|
282
267
|
},
|
|
283
|
-
// wide windows keep the phone gradient height instead of scaling with the width
|
|
284
|
-
phoneHeight: {
|
|
285
|
-
aspectRatio: undefined,
|
|
286
|
-
height: HeaderBarMetrics.gradientHeight,
|
|
287
|
-
},
|
|
288
268
|
fillHeaderBox: {
|
|
289
269
|
aspectRatio: undefined,
|
|
290
270
|
height: '100%',
|
|
@@ -294,15 +274,15 @@ const styles = StyleSheet.create({
|
|
|
294
274
|
position: 'absolute',
|
|
295
275
|
overflow: 'hidden',
|
|
296
276
|
},
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
justifyContent: 'flex-end',
|
|
277
|
+
verifiedDot: {
|
|
278
|
+
width: 4,
|
|
279
|
+
height: 4,
|
|
280
|
+
borderRadius: 2,
|
|
281
|
+
backgroundColor: Colors.green_03,
|
|
303
282
|
position: 'absolute',
|
|
304
|
-
|
|
283
|
+
alignSelf: 'center',
|
|
305
284
|
},
|
|
285
|
+
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
306
286
|
});
|
|
307
287
|
|
|
308
288
|
export { HeaderExtendHeader };
|
|
@@ -6,13 +6,11 @@ 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 { useSideBarItemStyle } from '../../Layout/utils';
|
|
9
|
+
import { useScreenLayout, useSideBarItemStyle } from '../../Layout/utils';
|
|
10
10
|
import { useSideBarCounterStyle } from './DuoQuickReturnHeader';
|
|
11
|
-
import { HeaderBarMetrics } from '../headerLayout';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
* confirms in a popup first; the iPhone Duo side bar uses the 48pt side bar button.
|
|
13
|
+
* default header left used for nav
|
|
16
14
|
*/
|
|
17
15
|
const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
18
16
|
tintColor,
|
|
@@ -25,6 +23,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
25
23
|
const { navigator } = useContext(ApplicationContext);
|
|
26
24
|
const sideBarStyle = useSideBarItemStyle('left', 0);
|
|
27
25
|
const counterStyle = useSideBarCounterStyle();
|
|
26
|
+
const { statusBarClearance } = useScreenLayout();
|
|
28
27
|
|
|
29
28
|
const goBack = useCallback(() => {
|
|
30
29
|
const canGoBack = navigator?.ref?.current?.canGoBack?.();
|
|
@@ -97,6 +96,20 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
97
96
|
);
|
|
98
97
|
}
|
|
99
98
|
|
|
99
|
+
// on the status bar row the controls keep the side bar size
|
|
100
|
+
if (statusBarClearance) {
|
|
101
|
+
return (
|
|
102
|
+
<View style={styles.headerLeft}>
|
|
103
|
+
<SideBarButton
|
|
104
|
+
accessibilityLabel="btn_navigation_back"
|
|
105
|
+
icon="arrow-back"
|
|
106
|
+
tintColor={tintColor}
|
|
107
|
+
onPress={goBackSafe}
|
|
108
|
+
/>
|
|
109
|
+
</View>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
return (
|
|
101
114
|
<View style={styles.headerLeft}>
|
|
102
115
|
<NavigationButton
|
|
@@ -111,7 +124,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
111
124
|
|
|
112
125
|
const styles = StyleSheet.create({
|
|
113
126
|
headerLeft: {
|
|
114
|
-
marginLeft:
|
|
127
|
+
marginLeft: 12,
|
|
115
128
|
},
|
|
116
129
|
});
|
|
117
130
|
|