@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.
Files changed (153) hide show
  1. package/Application/BottomSheet.tsx +398 -86
  2. package/Application/BottomTab/BottomTabBar.tsx +275 -215
  3. package/Application/BottomTab/CustomBottomTabItem.tsx +107 -131
  4. package/Application/BottomTab/DuoBarCompression.tsx +28 -14
  5. package/Application/BottomTab/DuoTabBar.tsx +540 -32
  6. package/Application/BottomTab/TabBarIcon.tsx +72 -146
  7. package/Application/BottomTab/index.tsx +353 -89
  8. package/Application/BottomTab/useLiquidSelection.ts +374 -0
  9. package/Application/Components/BackgroundImageView.tsx +0 -4
  10. package/Application/Components/DuoGlassBackground.tsx +5 -7
  11. package/Application/Components/HeaderAnimated.tsx +13 -41
  12. package/Application/Components/HeaderBackground.tsx +3 -20
  13. package/Application/Components/HeaderExtendHeader.tsx +46 -66
  14. package/Application/Components/HeaderLeft.tsx +18 -5
  15. package/Application/Components/HeaderRight.tsx +529 -8
  16. package/Application/Components/HeaderTitle.tsx +579 -16
  17. package/Application/Components/NavigationButton.tsx +11 -18
  18. package/Application/Components/SearchHeader.tsx +18 -38
  19. package/Application/Localize.ts +0 -7
  20. package/Application/ModalScreen.tsx +18 -41
  21. package/Application/Navigation.ts +17 -15
  22. package/Application/NavigationContainer.tsx +21 -23
  23. package/Application/Navigator.ts +48 -20
  24. package/Application/ScaleSizeProvider.tsx +6 -13
  25. package/Application/StackScreen.tsx +172 -27
  26. package/Application/TooltipPortal.tsx +5 -12
  27. package/Application/WidgetContainer.tsx +7 -20
  28. package/Application/device.ts +52 -0
  29. package/Application/index.ts +1 -23
  30. package/Application/types.ts +242 -17
  31. package/Application/utils.tsx +493 -0
  32. package/Badge/Badge.tsx +0 -5
  33. package/Badge/BadgeDot.tsx +0 -1
  34. package/Badge/BadgeDotAnimation.tsx +7 -15
  35. package/Badge/BadgeRibbon.tsx +39 -47
  36. package/Badge/Shape.tsx +0 -2
  37. package/Badge/styles.ts +0 -2
  38. package/Badge/types.ts +2 -2
  39. package/Button/index.tsx +152 -21
  40. package/Button/styles.ts +1 -1
  41. package/CheckBox/index.tsx +6 -5
  42. package/Consts/theme.ts +10 -10
  43. package/Context/index.ts +1 -5
  44. package/Divider/DashDivider.tsx +11 -11
  45. package/Divider/index.tsx +7 -21
  46. package/FoundationList/index.tsx +0 -4
  47. package/Icon/index.tsx +6 -6
  48. package/Icon/types.ts +1 -1
  49. package/IconButton/index.tsx +12 -4
  50. package/Image/index.tsx +7 -9
  51. package/Input/Input.tsx +12 -10
  52. package/Input/InputDropDown.tsx +13 -10
  53. package/Input/InputMoney.tsx +152 -45
  54. package/Input/InputOTP.tsx +34 -36
  55. package/Input/InputPhoneNumber.tsx +5 -8
  56. package/Input/InputSearch.tsx +111 -19
  57. package/Input/InputTextArea.tsx +5 -5
  58. package/Input/SystemTextInput.tsx +2 -7
  59. package/Input/TextTyping.tsx +0 -4
  60. package/Input/common.tsx +17 -31
  61. package/Input/index.tsx +21 -24
  62. package/Input/styles.ts +5 -25
  63. package/Input/utils.ts +12 -14
  64. package/Layout/Card.tsx +4 -7
  65. package/Layout/FloatingButton.tsx +21 -26
  66. package/Layout/Item.tsx +2 -6
  67. package/Layout/ItemList.tsx +7 -9
  68. package/Layout/ItemSectionList.tsx +1 -2
  69. package/Layout/ReservedRegions.tsx +17 -34
  70. package/Layout/Screen.tsx +696 -122
  71. package/Layout/Section.tsx +7 -9
  72. package/Layout/TrackingScope.tsx +0 -1
  73. package/Layout/index.ts +4 -10
  74. package/Layout/styles.ts +0 -2
  75. package/Layout/types.ts +4 -2
  76. package/Layout/utils.ts +181 -40
  77. package/Loader/DotLoader.tsx +3 -11
  78. package/Loader/Loader.tsx +0 -4
  79. package/Loader/ProgressBar.tsx +6 -3
  80. package/Loader/Spinner.tsx +3 -11
  81. package/Loader/styles.ts +0 -4
  82. package/Loader/utils.ts +7 -11
  83. package/Pagination/Dot.tsx +0 -4
  84. package/Pagination/PaginationDot.tsx +0 -1
  85. package/Pagination/PaginationNumber.tsx +3 -5
  86. package/Pagination/PaginationScroll.tsx +0 -5
  87. package/Pagination/PaginationWhiteDot.tsx +0 -1
  88. package/Pagination/index.tsx +0 -4
  89. package/Pagination/types.ts +2 -2
  90. package/Popup/PopupNotify.tsx +102 -94
  91. package/Popup/PopupPromotion.tsx +11 -9
  92. package/Popup/types.ts +4 -11
  93. package/Popup/utils.ts +18 -50
  94. package/Radio/index.tsx +10 -6
  95. package/Radio/styles.ts +0 -6
  96. package/Skeleton/index.tsx +9 -9
  97. package/Skeleton/styles.ts +0 -1
  98. package/Switch/index.tsx +0 -1
  99. package/Tag/index.tsx +4 -8
  100. package/Tag/types.ts +3 -3
  101. package/Text/index.tsx +5 -25
  102. package/Text/styles.ts +1 -1
  103. package/Text/types.ts +6 -1
  104. package/Text/utils.ts +4 -20
  105. package/Title/index.tsx +40 -42
  106. package/Title/styles.ts +0 -6
  107. package/ViewBoundary/index.tsx +2 -4
  108. package/index.ts +6 -0
  109. package/package.json +1 -2
  110. package/Application/BottomSheet.hooks.ts +0 -195
  111. package/Application/BottomSheet.parts.tsx +0 -157
  112. package/Application/BottomSheet.styles.ts +0 -43
  113. package/Application/BottomTab/ActiveIndicator.tsx +0 -91
  114. package/Application/BottomTab/BottomTabBar.styles.ts +0 -65
  115. package/Application/BottomTab/BottomTabInset.tsx +0 -18
  116. package/Application/BottomTab/CurvedContainer.tsx +0 -155
  117. package/Application/BottomTab/DuoRailTabBar.tsx +0 -223
  118. package/Application/BottomTab/DuoTabBar.styles.ts +0 -81
  119. package/Application/BottomTab/TabScreen.tsx +0 -160
  120. package/Application/BottomTab/metrics.ts +0 -164
  121. package/Application/BottomTab/tabItems.ts +0 -46
  122. package/Application/BottomTab/usePressLift.ts +0 -32
  123. package/Application/Components/HeaderRight.styles.ts +0 -146
  124. package/Application/Components/HeaderTitle.shared.ts +0 -44
  125. package/Application/Components/HeaderTitle.styles.ts +0 -125
  126. package/Application/Components/HeaderToolkitAction.tsx +0 -180
  127. package/Application/Components/SwipeBackHaptic.tsx +0 -95
  128. package/Application/Components/TitleJourney.tsx +0 -110
  129. package/Application/Components/TitleLocation.tsx +0 -73
  130. package/Application/Components/TitleUser.tsx +0 -304
  131. package/Application/Components/useToolkitActions.tsx +0 -218
  132. package/Application/ModalIconButton.tsx +0 -66
  133. package/Application/StackScreen.tracking.ts +0 -143
  134. package/Application/headerLayout.ts +0 -158
  135. package/Application/hooks.ts +0 -137
  136. package/Application/modalLayout.ts +0 -176
  137. package/Application/navigationOptions.tsx +0 -212
  138. package/Application/types.header.ts +0 -121
  139. package/Application/types.tabs.ts +0 -48
  140. package/Application/types.theme.ts +0 -87
  141. package/Application/utils.ts +0 -107
  142. package/Button/utils.ts +0 -133
  143. package/Input/InputMoneyView.tsx +0 -194
  144. package/Input/SearchTextTyping.tsx +0 -108
  145. package/Input/moneyUtils.ts +0 -23
  146. package/Layout/layoutMetrics.ts +0 -58
  147. package/Layout/layoutTypes.ts +0 -86
  148. package/Layout/screenContent.tsx +0 -92
  149. package/Layout/screenFooter.tsx +0 -63
  150. package/Layout/screenHeader.tsx +0 -321
  151. package/Layout/screenQuickReturn.tsx +0 -64
  152. package/Layout/screenScroll.ts +0 -107
  153. package/Layout/screenTypes.ts +0 -143
@@ -1,194 +0,0 @@
1
- import React, { RefObject, useContext } from 'react';
2
- import {
3
- Pressable,
4
- Text,
5
- TextInput,
6
- TextInputFocusEvent,
7
- TextInputProps,
8
- TouchableOpacity,
9
- View,
10
- } from 'react-native';
11
- import { ApplicationContext } from '../Context';
12
- import { Icon } from '../Icon';
13
- import { useScaleSize, exportFontFamily } from '../Text';
14
- import {
15
- FloatingView,
16
- getBorderColor,
17
- getSizeStyle,
18
- RenderTrailing,
19
- } from './common';
20
- import { InputMoneyProps } from './index';
21
- import styles from './styles';
22
- import SystemTextInput from './SystemTextInput';
23
-
24
- type InputMoneyViewProps = Pick<
25
- InputMoneyProps,
26
- | 'size'
27
- | 'errorMessage'
28
- | 'disabled'
29
- | 'trailingColor'
30
- | 'trailing'
31
- | 'onPressTrailing'
32
- | 'loading'
33
- | 'floatingValue'
34
- | 'floatingIconColor'
35
- | 'required'
36
- | 'floatingIcon'
37
- | 'onPressFloatingIcon'
38
- | 'showClearIcon'
39
- > & {
40
- placeholder: string;
41
- currency: string;
42
- focused: boolean;
43
- componentId: string;
44
- displayValue: string;
45
- caretSelection?: { start: number; end: number };
46
- inputRef: RefObject<TextInput | null>;
47
- focusAtEnd: () => void;
48
- onClearText: () => void;
49
- onChangeText: (text: string) => void;
50
- onFocus: (e: TextInputFocusEvent) => void;
51
- onBlur: (e: TextInputFocusEvent) => void;
52
- inputProps: TextInputProps;
53
- };
54
-
55
- /**
56
- * Presentational body of InputMoney: bordered field, currency suffix (kept
57
- * after a placeholder that ends with it) and the clear/trailing icons.
58
- */
59
- export const InputMoneyView = ({
60
- size,
61
- errorMessage,
62
- disabled,
63
- trailingColor,
64
- trailing,
65
- onPressTrailing,
66
- loading,
67
- floatingValue,
68
- floatingIconColor,
69
- required,
70
- floatingIcon,
71
- onPressFloatingIcon,
72
- showClearIcon,
73
- placeholder,
74
- currency,
75
- focused,
76
- componentId,
77
- displayValue,
78
- caretSelection,
79
- inputRef,
80
- focusAtEnd,
81
- onClearText,
82
- onChangeText,
83
- onFocus,
84
- onBlur,
85
- inputProps: props,
86
- }: InputMoneyViewProps) => {
87
- const { theme } = useContext(ApplicationContext);
88
- const scaleHeight = useScaleSize(size === 'small' ? 48 : 56);
89
- const scaledFontSize = useScaleSize(20);
90
- const inputFontFamily = exportFontFamily('bold');
91
- const disabledColor = theme.colors.text.disable;
92
- let textColor = theme.colors.text.default;
93
- let placeholderColor = theme.colors.text.hint;
94
- let iconTintColor = trailingColor;
95
- if (disabled) {
96
- textColor = disabledColor;
97
- placeholderColor = disabledColor;
98
- iconTintColor = disabledColor;
99
- }
100
- const textStyle = {
101
- fontSize: scaledFontSize,
102
- fontFamily: inputFontFamily,
103
- };
104
- const placeholderHasCurrency = placeholder.endsWith(currency);
105
- const shouldShowCurrency = !!displayValue || placeholderHasCurrency;
106
- const shouldShowClearIcon = !!(showClearIcon && focused && displayValue);
107
- let inputPlaceholder = placeholder;
108
- if (placeholderHasCurrency) {
109
- inputPlaceholder = placeholder.slice(0, -currency.length);
110
- }
111
- return (
112
- <View
113
- style={[
114
- styles.inputWrapper,
115
- { backgroundColor: theme.colors.background.surface },
116
- getSizeStyle(size, undefined, scaleHeight),
117
- getBorderColor(theme, focused, errorMessage, disabled),
118
- ]}
119
- >
120
- <FloatingView
121
- floatingValue={floatingValue}
122
- floatingIconColor={floatingIconColor}
123
- disabled={disabled}
124
- required={required}
125
- floatingIcon={floatingIcon}
126
- onPress={onPressFloatingIcon}
127
- componentId={componentId}
128
- />
129
- <Pressable
130
- style={[styles.inputView, styles.moneyInputView]}
131
- onPress={focusAtEnd}
132
- disabled={disabled}
133
- >
134
- <SystemTextInput
135
- {...props}
136
- accessibilityLabel={`${componentId}`}
137
- textAlignVertical="center"
138
- ref={inputRef}
139
- accessibilityState={{
140
- disabled: disabled,
141
- ...props.accessibilityState,
142
- }}
143
- style={[textStyle, styles.moneyTextInput, { color: textColor }]}
144
- allowFontScaling={false}
145
- textBreakStrategy="highQuality"
146
- value={displayValue}
147
- selection={caretSelection ?? props.selection}
148
- onChangeText={onChangeText}
149
- onFocus={onFocus}
150
- onBlur={onBlur}
151
- placeholder={inputPlaceholder}
152
- selectionColor={theme.colors.primary}
153
- placeholderTextColor={placeholderColor}
154
- keyboardType={'numeric'}
155
- maxLength={undefined}
156
- />
157
- {shouldShowCurrency && (
158
- <Text
159
- style={[
160
- textStyle,
161
- { color: displayValue ? textColor : placeholderColor },
162
- ]}
163
- allowFontScaling={false}
164
- >
165
- {currency}
166
- </Text>
167
- )}
168
- </Pressable>
169
- <View style={styles.iconView}>
170
- {shouldShowClearIcon && (
171
- <TouchableOpacity
172
- accessibilityLabel={`${componentId}|clear-icon-touch`}
173
- style={styles.iconWrapper}
174
- onPress={onClearText}
175
- >
176
- <Icon
177
- source="24_navigation_close_circle_full"
178
- size={16}
179
- color={theme.colors.text.hint}
180
- accessibilityLabel={`${componentId}|clear-icon`}
181
- />
182
- </TouchableOpacity>
183
- )}
184
- <RenderTrailing
185
- color={iconTintColor}
186
- icon={trailing}
187
- onPressIcon={onPressTrailing}
188
- loading={loading}
189
- componentId={componentId}
190
- />
191
- </View>
192
- </View>
193
- );
194
- };
@@ -1,108 +0,0 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
- import React, { FC, useEffect, useRef } from 'react';
3
- import { TextInput } from 'react-native';
4
- import { useScaleSize, exportFontFamily } from '../Text';
5
- import styles from './styles';
6
-
7
- /**
8
- * Animated search placeholder: types each string of `data` char by char, then
9
- * erases it, looping forever. Writes via setNativeProps to avoid re-renders.
10
- */
11
- export const TextTyping: FC<any> = ({
12
- data = [],
13
- timeDelayEnd = 2000,
14
- timeDelayNextChar = 20,
15
- }) => {
16
- const textRef = useRef<TextInput>(null);
17
- const scaledFontSize = useScaleSize(12);
18
- const typingFontFamily = exportFontFamily('regular');
19
-
20
- const currentIndex = useRef<number>(0);
21
- const currentCharIndex = useRef<number>(0);
22
- const currentText = useRef('');
23
-
24
- useEffect(() => {
25
- setTimeout(() => {
26
- playAnimation();
27
- }, 1000);
28
- }, []);
29
-
30
- const playAnimation = () => {
31
- const handleResetList = () => {
32
- currentIndex.current = 0;
33
- handleAnimation();
34
- };
35
-
36
- const handleAnimation = () => {
37
- const listChar = data?.[currentIndex.current]?.split('') || [];
38
- listChar.length !== 0 && showChar(listChar?.[currentCharIndex.current]);
39
- };
40
-
41
- if (currentIndex.current >= data?.length) {
42
- handleResetList();
43
- } else {
44
- handleAnimation();
45
- }
46
- };
47
-
48
- const showChar = (char?: string) => {
49
- const handleResetString = () => {
50
- setTimeout(() => {
51
- reset();
52
- }, timeDelayEnd);
53
- };
54
-
55
- const handleShowChar = () => {
56
- setTimeout(() => {
57
- textRef.current?.setNativeProps?.({
58
- text: currentText.current + char,
59
- });
60
- currentText.current += char;
61
- currentCharIndex.current++;
62
- playAnimation();
63
- }, timeDelayNextChar);
64
- };
65
-
66
- const textLength = data?.[currentIndex.current]?.length || 0;
67
- if (currentCharIndex.current >= textLength) {
68
- handleResetString();
69
- } else {
70
- handleShowChar();
71
- }
72
- };
73
-
74
- const reset = () => {
75
- const handleNextString = () => {
76
- currentIndex.current++;
77
- playAnimation();
78
- };
79
-
80
- const handleReset = () => {
81
- setTimeout(() => {
82
- textRef.current?.setNativeProps?.({
83
- text: currentText.current.slice(0, -1),
84
- });
85
- currentText.current = currentText.current.slice(0, -1);
86
- currentCharIndex.current--;
87
- reset();
88
- }, timeDelayNextChar);
89
- };
90
-
91
- currentCharIndex.current <= 0 ? handleNextString() : handleReset();
92
- };
93
-
94
- return (
95
- <TextInput
96
- style={[
97
- styles.inputStyle,
98
- { fontSize: scaledFontSize, fontFamily: typingFontFamily },
99
- ]}
100
- ref={textRef}
101
- editable={false}
102
- autoCorrect={false}
103
- pointerEvents={'none'}
104
- numberOfLines={1}
105
- allowFontScaling={false}
106
- />
107
- );
108
- };
@@ -1,23 +0,0 @@
1
- export const moneyFormatter = new Intl.NumberFormat('vi-VN');
2
-
3
- /**
4
- * Locates the single edited span between `old` and `text`: common prefix
5
- * length (`start`), common suffix length (`suffix`) and removed + inserted
6
- * char count (`size`).
7
- */
8
- export const findEdit = (old: string, text: string) => {
9
- let start = 0;
10
- while (start < text.length && old[start] === text[start]) {
11
- start += 1;
12
- }
13
- const maxSuffix = Math.min(text.length, old.length) - start;
14
- let suffix = 0;
15
- while (suffix < maxSuffix) {
16
- if (old[old.length - 1 - suffix] !== text[text.length - 1 - suffix]) {
17
- break;
18
- }
19
- suffix += 1;
20
- }
21
- const size = old.length + text.length - 2 * (start + suffix);
22
- return { old, start, suffix, size };
23
- };
@@ -1,58 +0,0 @@
1
- /**
2
- * Header geometry
3
- * - barHeight: navigation bar row below the status bar
4
- * - iPhoneMinHeight: header never shorter than this on iPhone (landscape, iPhone Duo)
5
- * - statusBarMinInset: a smaller top inset means the status bar is not on the top edge
6
- * - largeWidth / largeMargin: @react-navigation/elements Header gives its content row
7
- * 5pt side margins on iOS from 414pt wide
8
- */
9
- export const HeaderMetrics = {
10
- barHeight: 52,
11
- iPhoneMinHeight: 72,
12
- statusBarMinInset: 20,
13
- largeWidth: 414,
14
- largeMargin: 5,
15
- };
16
-
17
- /**
18
- * iPhone Duo geometry, iOS 27.1 (Xcode 27.1 simulator)
19
- * - maxAspectRatio: both displays are near 1.42 (inner) and 1.45 (outer), every slab
20
- * iPhone is 1.77 or taller
21
- * - innerMinHeight: window height from which the inner display is in use (outer display
22
- * is 466pt tall in landscape, inner display 669pt)
23
- * - controlSize / itemPitch: vertical bar of 48pt circular controls, item groups as 48pt
24
- * wide capsules at a 50pt pitch, 12pt from the strip's inner edge and 12pt apart
25
- * - firstItemTop: with the status bar in the strip, the first control sits under the
26
- * camera, clock and connectivity cluster (cluster ends near y 151 on the outer display,
27
- * y 98 on the inner display in landscape)
28
- * - outerHeaderHeight / outerCameraCenterY: on the outer display in portrait the header
29
- * is 4pt taller than iPhoneMinHeight and its title lines up with the camera punchout
30
- * (y 24–66 at the top of the strip)
31
- * - edgeInset: on the outer display in landscape the strip holds no status bar, so its
32
- * controls start this far from the top and stay this far above the bottom, unless a
33
- * reserved region (the camera at either end) asks for more
34
- * - innerStatusBarCenterY / innerStatusBarWidth: on the inner display in portrait the
35
- * clock and connectivity cluster sits at the top right corner (x 550–643 of 669, clock
36
- * digits centered on y 47); its reserved region, when reported, is taller than the glyphs
37
- * - floatingTabBarHeight / floatingTabBarMargin / floatingTabBarInsetOverlap: the host
38
- * app's iOS 26 system tab bar on the inner display in portrait, a 62pt Liquid Glass pill
39
- * sized to its tabs with the QR as a pinned 62pt platter beside it, centered and at
40
- * least 20pt from the side edges; it overlaps the home indicator inset by 13pt (21pt
41
- * above the screen bottom with a 34pt inset)
42
- */
43
- export const DuoMetrics = {
44
- maxAspectRatio: 1.6,
45
- innerMinHeight: 600,
46
- controlSize: 48,
47
- itemPitch: 50,
48
- firstItemTop: 170,
49
- firstItemTopLandscape: 120,
50
- outerHeaderHeight: 76,
51
- outerCameraCenterY: 45,
52
- edgeInset: 24,
53
- innerStatusBarCenterY: 47,
54
- innerStatusBarWidth: 120,
55
- floatingTabBarHeight: 62,
56
- floatingTabBarMargin: 20,
57
- floatingTabBarInsetOverlap: 13,
58
- };
@@ -1,86 +0,0 @@
1
- import { EdgeInsets } from 'react-native-safe-area-context';
2
-
3
- export type SideBarEdge = 'left' | 'right';
4
-
5
- export type SideBarLayout = {
6
- /**
7
- * Edge holding the side bar, the one with the larger safe-area inset.
8
- */
9
- edge: SideBarEdge;
10
-
11
- /**
12
- * Width of the side bar column, the safe-area inset on that edge.
13
- */
14
- width: number;
15
-
16
- /**
17
- * Window y of the first side bar item, below the navigation bar and the side status bar.
18
- */
19
- top: number;
20
-
21
- /**
22
- * Room to keep free above the window bottom, clear of a camera at the bottom end.
23
- */
24
- bottom: number;
25
- };
26
-
27
- export type ScreenLayout = {
28
- /**
29
- * Window width, from useWindowDimensions.
30
- */
31
- width: number;
32
-
33
- /**
34
- * Window height, from useWindowDimensions.
35
- */
36
- height: number;
37
-
38
- /**
39
- * `true` when running on iPhone Duo, outer or inner display.
40
- */
41
- isIPhoneDuo: boolean;
42
-
43
- /**
44
- * Raw safe-area insets.
45
- */
46
- insets: EdgeInsets;
47
-
48
- /**
49
- * Horizontal insets the screen content keeps clear of. 0 outside iPhone Duo.
50
- */
51
- insetLeft: number;
52
- insetRight: number;
53
-
54
- /**
55
- * Width available to the screen content: window width minus the horizontal insets.
56
- */
57
- contentWidth: number;
58
-
59
- /**
60
- * Header height: the top safe-area inset plus the navigation bar row, at least 72pt on iPhone.
61
- */
62
- headerHeight: number;
63
-
64
- /**
65
- * Room above the navigation bar row for the status bar, the rest of headerHeight is
66
- * the row, which centers the title vertically. 0 when the status bar is not on top.
67
- */
68
- headerStatusBarHeight: number;
69
-
70
- /**
71
- * Side column holding the back button and the toolkit, when iPhone Duo moves the
72
- * bars to the side. `undefined` while the bars stay horizontal.
73
- */
74
- sideBar?: SideBarLayout;
75
-
76
- /**
77
- * Room the header row keeps from each side for the clock and battery clusters, when
78
- * iPhone Duo puts the row on the status bar (inner display in portrait).
79
- */
80
- statusBarClearance?: StatusBarClearance;
81
- };
82
-
83
- export type StatusBarClearance = {
84
- left: number;
85
- right: number;
86
- };
@@ -1,92 +0,0 @@
1
- import React, { Fragment } from 'react';
2
- import { Animated, View } from 'react-native';
3
- import { Spacing } from '../Consts';
4
- import styles from './styles';
5
- import { validateChildren } from './utils';
6
- import { ANIMATED_BANNER_HEIGHT } from './screenTypes';
7
- import { AnimatedHeader } from '../Application/types';
8
-
9
- type ContentInset = { insetLeft: number; insetRight: number };
10
-
11
- /**
12
- * Wraps each screen child (Fragments flattened) in a view with the screen's top spacing
13
- * and side insets; a child with `useMargin: false` gets no top spacing.
14
- */
15
- export const renderContent = (content: any, layout: ContentInset): any => {
16
- const results = validateChildren(content, [undefined]);
17
- if (Array.isArray(results)) {
18
- return results.map((item, index) => {
19
- const space = item?.props?.useMargin === false ? 0 : Spacing.M;
20
- if (item?.type === Fragment) {
21
- return renderContent(item?.props?.children, layout);
22
- }
23
- if (item) {
24
- return (
25
- <View
26
- key={`ScreenItem${index}`}
27
- style={[
28
- {
29
- marginTop: space,
30
- marginLeft: layout.insetLeft,
31
- marginRight: layout.insetRight,
32
- },
33
- item.props?.expanded && styles.expanded,
34
- ]}
35
- onLayout={item.props?.onLayout}
36
- >
37
- {item}
38
- </View>
39
- );
40
- }
41
- });
42
- } else {
43
- const item: any = content;
44
- const space = item?.props?.useMargin === false ? 0 : Spacing.M;
45
- if (item?.type === Fragment) {
46
- return renderContent(item?.props?.children, layout);
47
- }
48
- return (
49
- <View
50
- key={`ScreenItem`}
51
- style={[
52
- {
53
- marginTop: space,
54
- marginLeft: layout.insetLeft,
55
- marginRight: layout.insetRight,
56
- },
57
- item?.props?.expanded && styles.expanded,
58
- ]}
59
- onLayout={item?.props?.onLayout}
60
- >
61
- {content}
62
- </View>
63
- );
64
- }
65
- };
66
-
67
- /**
68
- * Animated banner from `animatedHeader.component`, clipped to the banner height plus
69
- * `layoutOffset`. Nothing without a component.
70
- */
71
- export const renderAnimatedHeader = (
72
- animatedHeader: AnimatedHeader | undefined,
73
- layoutOffset: number,
74
- animatedValue: Animated.Value,
75
- sharedValue: any,
76
- ) => {
77
- if (typeof animatedHeader?.component === 'function') {
78
- return (
79
- <View
80
- style={[
81
- styles.screenBanner,
82
- { maxHeight: ANIMATED_BANNER_HEIGHT + layoutOffset },
83
- ]}
84
- >
85
- {animatedHeader?.component({
86
- animatedValue,
87
- sharedValue,
88
- })}
89
- </View>
90
- );
91
- }
92
- };
@@ -1,63 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { View } from 'react-native';
3
- import { Spacing } from '../Consts';
4
- import Section from './Section';
5
- import styles from './styles';
6
-
7
- type ScreenFooterProps = {
8
- footer: ReactNode;
9
- marginFooter: boolean;
10
- insetLeft: number;
11
- insetRight: number;
12
- hasContentInset: boolean;
13
- isTab: boolean;
14
- duoTabInset: number;
15
- bottomInset: number;
16
- surfaceColor: string;
17
- };
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
- export const ScreenFooter = ({
24
- footer,
25
- marginFooter,
26
- insetLeft,
27
- insetRight,
28
- hasContentInset,
29
- isTab,
30
- duoTabInset,
31
- bottomInset,
32
- surfaceColor,
33
- }: ScreenFooterProps) => {
34
- let bottomSpace = bottomInset;
35
- if (isTab && duoTabInset) {
36
- bottomSpace = duoTabInset;
37
- }
38
-
39
- return (
40
- <View
41
- pointerEvents={'box-none'}
42
- style={[
43
- hasContentInset && styles.footerClip,
44
- {
45
- marginLeft: insetLeft,
46
- marginRight: insetRight,
47
- },
48
- ]}
49
- >
50
- <View
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>
61
- </View>
62
- );
63
- };