@momo-kits/foundation 0.168.1-rn862.1 → 0.169.2

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 (109) hide show
  1. package/Application/BottomSheet.hooks.ts +195 -0
  2. package/Application/BottomSheet.parts.tsx +147 -0
  3. package/Application/BottomSheet.styles.ts +43 -0
  4. package/Application/BottomSheet.tsx +76 -279
  5. package/Application/BottomTab/ActiveIndicator.tsx +90 -0
  6. package/Application/BottomTab/BottomTabBar.styles.ts +65 -0
  7. package/Application/BottomTab/BottomTabBar.tsx +229 -276
  8. package/Application/BottomTab/BottomTabInset.tsx +14 -0
  9. package/Application/BottomTab/CurvedContainer.tsx +153 -0
  10. package/Application/BottomTab/CustomBottomTabItem.tsx +132 -108
  11. package/Application/BottomTab/DuoBarCompression.tsx +4 -12
  12. package/Application/BottomTab/DuoRailTabBar.tsx +227 -0
  13. package/Application/BottomTab/DuoTabBar.styles.ts +81 -0
  14. package/Application/BottomTab/DuoTabBar.tsx +29 -495
  15. package/Application/BottomTab/TabBarIcon.tsx +160 -72
  16. package/Application/BottomTab/TabScreen.tsx +164 -0
  17. package/Application/BottomTab/index.tsx +84 -351
  18. package/Application/BottomTab/metrics.ts +164 -0
  19. package/Application/BottomTab/tabItems.ts +46 -0
  20. package/Application/BottomTab/usePressLift.ts +32 -0
  21. package/Application/Components/DuoGlassBackground.tsx +7 -9
  22. package/Application/Components/HeaderAnimated.tsx +1 -1
  23. package/Application/Components/HeaderBackground.tsx +1 -1
  24. package/Application/Components/HeaderExtendHeader.tsx +17 -11
  25. package/Application/Components/HeaderRight.styles.ts +144 -0
  26. package/Application/Components/HeaderRight.tsx +6 -528
  27. package/Application/Components/HeaderTitle.shared.ts +43 -0
  28. package/Application/Components/HeaderTitle.styles.ts +125 -0
  29. package/Application/Components/HeaderTitle.tsx +12 -576
  30. package/Application/Components/HeaderToolkitAction.tsx +208 -0
  31. package/Application/Components/NavigationButton.tsx +9 -6
  32. package/Application/Components/SearchHeader.tsx +1 -1
  33. package/Application/Components/SwipeBackHaptic.tsx +95 -0
  34. package/Application/Components/TitleJourney.tsx +110 -0
  35. package/Application/Components/TitleLocation.tsx +73 -0
  36. package/Application/Components/TitleUser.tsx +304 -0
  37. package/Application/Components/useToolkitActions.tsx +233 -0
  38. package/Application/ModalIconButton.tsx +66 -0
  39. package/Application/ModalScreen.tsx +39 -18
  40. package/Application/Navigation.ts +1 -1
  41. package/Application/NavigationContainer.tsx +7 -8
  42. package/Application/StackScreen.tracking.ts +158 -0
  43. package/Application/StackScreen.tsx +10 -137
  44. package/Application/WidgetContainer.tsx +10 -3
  45. package/Application/__tests__/modalLayout.test.ts +128 -0
  46. package/Application/hooks.ts +137 -0
  47. package/Application/index.ts +13 -1
  48. package/Application/modalLayout.ts +177 -0
  49. package/Application/navigationOptions.tsx +217 -0
  50. package/Application/types.header.ts +116 -0
  51. package/Application/types.tabs.ts +48 -0
  52. package/Application/types.theme.ts +87 -0
  53. package/Application/types.ts +12 -244
  54. package/Application/utils.ts +107 -0
  55. package/Badge/BadgeRibbon.tsx +3 -3
  56. package/Badge/styles.ts +2 -0
  57. package/Button/index.tsx +16 -136
  58. package/Button/styles.ts +1 -1
  59. package/Button/utils.ts +139 -0
  60. package/CheckBox/index.tsx +1 -6
  61. package/Divider/DashDivider.tsx +10 -11
  62. package/Divider/index.tsx +18 -8
  63. package/Image/index.tsx +1 -46
  64. package/Input/Input.tsx +7 -8
  65. package/Input/InputDropDown.tsx +3 -4
  66. package/Input/InputMoney.tsx +38 -164
  67. package/Input/InputMoneyView.tsx +187 -0
  68. package/Input/InputOTP.tsx +1 -1
  69. package/Input/InputPhoneNumber.tsx +5 -1
  70. package/Input/InputSearch.tsx +2 -108
  71. package/Input/InputTextArea.tsx +1 -5
  72. package/Input/SearchTextTyping.tsx +104 -0
  73. package/Input/common.tsx +4 -4
  74. package/Input/moneyUtils.ts +17 -0
  75. package/Input/styles.ts +26 -2
  76. package/Layout/FloatingButton.tsx +22 -21
  77. package/Layout/ReservedRegions.tsx +21 -4
  78. package/Layout/Screen.tsx +74 -670
  79. package/Layout/Section.tsx +1 -2
  80. package/Layout/index.ts +10 -4
  81. package/Layout/layoutMetrics.ts +58 -0
  82. package/Layout/layoutTypes.ts +86 -0
  83. package/Layout/screenContent.tsx +90 -0
  84. package/Layout/screenFooter.tsx +53 -0
  85. package/Layout/screenHeader.tsx +315 -0
  86. package/Layout/screenQuickReturn.tsx +67 -0
  87. package/Layout/screenScroll.ts +110 -0
  88. package/Layout/screenTypes.ts +134 -0
  89. package/Layout/styles.ts +2 -0
  90. package/Layout/utils.ts +10 -144
  91. package/Loader/DotLoader.tsx +7 -3
  92. package/Loader/ProgressBar.tsx +2 -6
  93. package/Loader/Spinner.tsx +7 -3
  94. package/Loader/styles.ts +4 -0
  95. package/Popup/PopupNotify.tsx +70 -64
  96. package/Popup/PopupPromotion.tsx +5 -4
  97. package/Popup/types.ts +7 -0
  98. package/Popup/utils.ts +46 -24
  99. package/Radio/index.tsx +2 -10
  100. package/Radio/styles.ts +6 -0
  101. package/Skeleton/index.tsx +1 -9
  102. package/Skeleton/styles.ts +1 -0
  103. package/Tag/index.tsx +3 -3
  104. package/Text/index.tsx +11 -2
  105. package/Title/index.tsx +2 -9
  106. package/Title/styles.ts +6 -0
  107. package/package.json +21 -22
  108. package/Application/device.ts +0 -29
  109. package/Application/utils.tsx +0 -497
@@ -64,11 +64,10 @@ const Section: React.FC<SectionProps> = ({
64
64
  style={[
65
65
  style,
66
66
  styles.protectedStyle,
67
+ styles.rowWrap,
67
68
  {
68
69
  width: widthSection,
69
70
  marginHorizontal: margin,
70
- flexDirection: 'row',
71
- flexWrap: 'wrap',
72
71
  gap: gutterSize,
73
72
  },
74
73
  ]}
package/Layout/index.ts CHANGED
@@ -1,15 +1,20 @@
1
1
  import Card from './Card';
2
2
  import Section from './Section';
3
- import { useScreenLayout, validateChildren } from './utils';
4
- import type { ScreenLayout, SideBarEdge, SideBarLayout } from './utils';
3
+ import {
4
+ useScreenLayout,
5
+ validateChildren,
6
+ type ScreenLayout,
7
+ type SideBarEdge,
8
+ type SideBarLayout,
9
+ } from './utils';
5
10
  import { createContext } from 'react';
6
11
  import { GridContextProps } from './types';
7
12
  import Item from './Item';
8
13
  import ItemList from './ItemList';
9
14
  import ItemSectionList from './ItemSectionList';
10
- import Screen from './Screen';
15
+ import Screen, { type ScreenProps } from './Screen';
11
16
  import { TrackingScope } from './TrackingScope';
12
- import { ScreenProps } from './Screen';
17
+ import { useHinge } from './ReservedRegions';
13
18
 
14
19
  const GridContext = createContext<GridContextProps>({
15
20
  numberOfColumns: 12,
@@ -31,4 +36,5 @@ export {
31
36
  ItemSectionList,
32
37
  Screen,
33
38
  TrackingScope,
39
+ useHinge,
34
40
  };
@@ -0,0 +1,58 @@
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
+ };
@@ -0,0 +1,86 @@
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
+ };
@@ -0,0 +1,90 @@
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
+ * build content for screen for grid rule
13
+ */
14
+ export const renderContent = (content: any, layout: ContentInset): any => {
15
+ const results = validateChildren(content, [undefined]);
16
+ if (Array.isArray(results)) {
17
+ return results.map((item, index) => {
18
+ const space = item?.props?.useMargin === false ? 0 : Spacing.M;
19
+ if (item?.type === Fragment) {
20
+ return renderContent(item?.props?.children, layout);
21
+ }
22
+ if (item) {
23
+ return (
24
+ <View
25
+ key={`ScreenItem${index}`}
26
+ style={[
27
+ {
28
+ marginTop: space,
29
+ marginLeft: layout.insetLeft,
30
+ marginRight: layout.insetRight,
31
+ },
32
+ item.props?.expanded && styles.expanded,
33
+ ]}
34
+ onLayout={item.props?.onLayout}
35
+ >
36
+ {item}
37
+ </View>
38
+ );
39
+ }
40
+ });
41
+ } else {
42
+ const item: any = content;
43
+ const space = item?.props?.useMargin === false ? 0 : Spacing.M;
44
+ if (item?.type === Fragment) {
45
+ return renderContent(item?.props?.children, layout);
46
+ }
47
+ return (
48
+ <View
49
+ key={`ScreenItem`}
50
+ style={[
51
+ {
52
+ marginTop: space,
53
+ marginLeft: layout.insetLeft,
54
+ marginRight: layout.insetRight,
55
+ },
56
+ item?.props?.expanded && styles.expanded,
57
+ ]}
58
+ onLayout={item?.props?.onLayout}
59
+ >
60
+ {content}
61
+ </View>
62
+ );
63
+ }
64
+ };
65
+
66
+ /**
67
+ * render top navigation banner
68
+ */
69
+ export const renderAnimatedHeader = (
70
+ animatedHeader: AnimatedHeader | undefined,
71
+ layoutOffset: number,
72
+ animatedValue: Animated.Value,
73
+ sharedValue: any,
74
+ ) => {
75
+ if (typeof animatedHeader?.component === 'function') {
76
+ return (
77
+ <View
78
+ style={[
79
+ styles.screenBanner,
80
+ { maxHeight: ANIMATED_BANNER_HEIGHT + layoutOffset },
81
+ ]}
82
+ >
83
+ {animatedHeader?.component({
84
+ animatedValue,
85
+ sharedValue,
86
+ })}
87
+ </View>
88
+ );
89
+ }
90
+ };
@@ -0,0 +1,53 @@
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
+ export const ScreenFooter = ({
20
+ footer,
21
+ marginFooter,
22
+ insetLeft,
23
+ insetRight,
24
+ hasContentInset,
25
+ isTab,
26
+ duoTabInset,
27
+ bottomInset,
28
+ surfaceColor,
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
+ <View
41
+ style={[
42
+ styles.shadow,
43
+ {
44
+ paddingBottom:
45
+ (isTab && duoTabInset ? duoTabInset : bottomInset) + Spacing.S,
46
+ backgroundColor: surfaceColor,
47
+ },
48
+ ]}
49
+ >
50
+ <Section useMargin={marginFooter}>{footer}</Section>
51
+ </View>
52
+ </View>
53
+ );
@@ -0,0 +1,315 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { StatusBar, StatusBarStyle } from 'react-native';
3
+ import { StackNavigationOptions } from '@react-navigation/stack';
4
+ import Navigation from '../Application/Navigation';
5
+ import { AnimatedHeader, SearchHeaderProps } from '../Application/types';
6
+ import { exportHeaderTitle } from '../Application/navigationOptions';
7
+ import { Colors, Spacing } from '../Consts';
8
+ import {
9
+ HeaderBackground,
10
+ HeaderLeft,
11
+ HeaderTitle,
12
+ SearchHeader,
13
+ } from '../Application';
14
+ import { DuoGlassBackground } from '../Application/Components/DuoGlassBackground';
15
+ import { getHeaderMargin } from './utils';
16
+ import { ANIMATED_BANNER_HEIGHT } from './screenTypes';
17
+ import { HeaderType } from './types';
18
+
19
+ type ScreenHeaderParams = {
20
+ navigation?: Navigation;
21
+ layout: any;
22
+ sharedValue: any;
23
+ quickReturnOptions: StackNavigationOptions;
24
+ hasSideBar: boolean;
25
+ headerType: HeaderType;
26
+ animatedHeader?: AnimatedHeader;
27
+ inputSearchProps?: SearchHeaderProps;
28
+ useShadowHeader: boolean;
29
+ gradientColor?: string;
30
+ headerBackground?: string;
31
+ layoutOffset: number;
32
+ };
33
+
34
+ export const useScreenHeader = ({
35
+ navigation,
36
+ layout,
37
+ sharedValue,
38
+ quickReturnOptions,
39
+ hasSideBar,
40
+ headerType,
41
+ animatedHeader,
42
+ inputSearchProps,
43
+ useShadowHeader,
44
+ gradientColor,
45
+ headerBackground,
46
+ layoutOffset,
47
+ }: ScreenHeaderParams) => {
48
+ const currentTint = useRef<string | undefined>(undefined);
49
+ const appliedHeaderMode = useRef<string | undefined>(undefined);
50
+
51
+ /**
52
+ * export options for screen
53
+ * @param type
54
+ */
55
+ const setHeaderType = useCallback(
56
+ (type: HeaderType, keepTitle = false) => {
57
+ let options: StackNavigationOptions;
58
+ switch (type) {
59
+ case 'none':
60
+ options = {
61
+ headerTransparent: true,
62
+ headerBackground: () => null,
63
+ headerShown: false,
64
+ };
65
+ break;
66
+
67
+ case 'extended':
68
+ options = {
69
+ ...quickReturnOptions,
70
+ headerShown: true,
71
+ headerTransparent: true,
72
+ headerBackground: () =>
73
+ hasSideBar ? (
74
+ <DuoGlassBackground animatedValue={sharedValue} />
75
+ ) : null,
76
+ headerTitle: (props: any) => <HeaderTitle {...props} />,
77
+ };
78
+ if (inputSearchProps) {
79
+ options = {
80
+ headerShown: true,
81
+ headerTransparent: true,
82
+ headerBackground: () => null,
83
+ headerTitle: (props: any) => (
84
+ <HeaderTitle
85
+ {...props}
86
+ interpolate={{
87
+ inputRange: [0, 50],
88
+ outputRange: [1, 0],
89
+ }}
90
+ animatedValue={sharedValue}
91
+ />
92
+ ),
93
+ };
94
+ }
95
+ break;
96
+
97
+ default:
98
+ if (hasSideBar && !inputSearchProps) {
99
+ options = {
100
+ ...quickReturnOptions,
101
+ headerTransparent: true,
102
+ headerTintColor: Colors.black_17,
103
+ headerShown: true,
104
+ headerBackground: () => (
105
+ <DuoGlassBackground animatedValue={sharedValue} />
106
+ ),
107
+ headerTitle: (props: any) => <HeaderTitle {...props} />,
108
+ };
109
+ break;
110
+ }
111
+ options = {
112
+ headerTransparent: false,
113
+ headerTintColor: Colors.black_17,
114
+ headerShown: true,
115
+ headerBackground: (props: any) => (
116
+ <HeaderBackground
117
+ {...props}
118
+ animatedValue={sharedValue}
119
+ useShadowHeader={useShadowHeader}
120
+ headerBackground={headerBackground}
121
+ gradientColor={gradientColor}
122
+ />
123
+ ),
124
+ headerTitle: (props: any) => <HeaderTitle {...props} />,
125
+ };
126
+ if (inputSearchProps) {
127
+ options = {
128
+ headerShown: true,
129
+ headerTransparent: true,
130
+ headerBackground: () => null,
131
+ headerTitle: (props: any) => (
132
+ <HeaderTitle
133
+ {...props}
134
+ interpolate={{
135
+ inputRange: [0, 50],
136
+ outputRange: [1, 0],
137
+ }}
138
+ animatedValue={sharedValue}
139
+ />
140
+ ),
141
+ };
142
+ }
143
+ }
144
+
145
+ if (keepTitle) {
146
+ delete options.headerTitle;
147
+ }
148
+
149
+ navigation?.instance?.setOptions({ header: undefined, ...options });
150
+ },
151
+ [
152
+ gradientColor,
153
+ headerBackground,
154
+ inputSearchProps,
155
+ navigation?.instance,
156
+ sharedValue,
157
+ useShadowHeader,
158
+ hasSideBar,
159
+ quickReturnOptions,
160
+ ],
161
+ );
162
+
163
+ /**
164
+ * export animatedHeader options for screen
165
+ * @param nextAnimatedHeader
166
+ */
167
+ const setAnimatedHeader = useCallback(
168
+ (nextAnimatedHeader: AnimatedHeader) => {
169
+ let options: StackNavigationOptions;
170
+ if (!currentTint.current) {
171
+ currentTint.current = nextAnimatedHeader?.headerTintColor;
172
+ }
173
+
174
+ options = {
175
+ ...quickReturnOptions,
176
+ headerTintColor: currentTint.current ?? Colors.black_17,
177
+ headerTransparent: true,
178
+ headerBackground: (props: any) =>
179
+ hasSideBar ? (
180
+ <DuoGlassBackground
181
+ animatedValue={sharedValue}
182
+ bannerBottom={ANIMATED_BANNER_HEIGHT + layoutOffset}
183
+ />
184
+ ) : (
185
+ <HeaderBackground
186
+ {...props}
187
+ animatedValue={sharedValue}
188
+ useGradient={false}
189
+ useShadowHeader={useShadowHeader}
190
+ headerBackground={headerBackground}
191
+ gradientColor={gradientColor}
192
+ />
193
+ ),
194
+ headerTitle: (props: any) => {
195
+ return <HeaderTitle {...props} />;
196
+ },
197
+ };
198
+
199
+ if (nextAnimatedHeader.headerTitle) {
200
+ options = {
201
+ ...options,
202
+ ...exportHeaderTitle(nextAnimatedHeader),
203
+ };
204
+ }
205
+
206
+ navigation?.instance?.setOptions(options);
207
+ },
208
+ [
209
+ gradientColor,
210
+ headerBackground,
211
+ navigation?.instance,
212
+ sharedValue,
213
+ useShadowHeader,
214
+ hasSideBar,
215
+ layoutOffset,
216
+ quickReturnOptions,
217
+ ],
218
+ );
219
+
220
+ /**
221
+ * export animatedHeader options for screen
222
+ */
223
+ const setAnimatedSearch = useCallback(() => {
224
+ const options: StackNavigationOptions = {
225
+ headerShown: true,
226
+ headerTransparent: true,
227
+ headerBackground: () => null,
228
+ headerTitle: (props: any) => (
229
+ <HeaderTitle
230
+ {...props}
231
+ interpolate={{
232
+ inputRange: [0, 50],
233
+ outputRange: [1, 0],
234
+ }}
235
+ animatedValue={sharedValue}
236
+ />
237
+ ),
238
+ };
239
+
240
+ navigation?.instance?.setOptions({ header: undefined, ...options });
241
+ }, [navigation?.instance, sharedValue]);
242
+
243
+ /**
244
+ * export search header
245
+ */
246
+ const setSearchHeader = (params: SearchHeaderProps) => {
247
+ let searchWidth = layout.width - 24;
248
+ let searchLeft = Spacing.M;
249
+ if (layout.sideBar) {
250
+ searchWidth = layout.contentWidth - Spacing.M * 2;
251
+ searchLeft = Spacing.M - getHeaderMargin(layout.width);
252
+ }
253
+ if (layout.statusBarClearance) {
254
+ searchWidth -=
255
+ layout.statusBarClearance.left + layout.statusBarClearance.right;
256
+ }
257
+ const options: StackNavigationOptions = {
258
+ headerRight: undefined,
259
+ headerTitleContainerStyle: {
260
+ width: searchWidth,
261
+ maxWidth: searchWidth,
262
+ marginLeft: 0,
263
+ marginEnd: 0,
264
+ marginStart: 0,
265
+ marginHorizontal: 0,
266
+ marginVertical: 0,
267
+ margin: 0,
268
+ left: searchLeft,
269
+ },
270
+ headerLeft: (props: any) =>
271
+ params?.hiddenBack ? null : <HeaderLeft {...props} floating />,
272
+ headerTitle: () => (
273
+ <SearchHeader {...params} animatedValue={sharedValue} />
274
+ ),
275
+ };
276
+
277
+ navigation?.instance?.setOptions(options);
278
+ };
279
+
280
+ useEffect(() => {
281
+ const focus = navigation?.instance?.addListener?.('focus', () => {
282
+ let barStyle: StatusBarStyle = 'dark-content';
283
+ if (currentTint.current === Colors.black_01) {
284
+ barStyle = 'light-content';
285
+ }
286
+ StatusBar.setBarStyle(barStyle, true);
287
+ });
288
+
289
+ if (animatedHeader) {
290
+ setAnimatedHeader(animatedHeader);
291
+ appliedHeaderMode.current = 'animated';
292
+ } else if (inputSearchProps) {
293
+ setAnimatedSearch();
294
+ appliedHeaderMode.current = 'search';
295
+ } else {
296
+ setHeaderType(headerType, appliedHeaderMode.current === headerType);
297
+ appliedHeaderMode.current = headerType;
298
+ }
299
+
300
+ return () => {
301
+ focus?.();
302
+ };
303
+ }, [
304
+ headerType,
305
+ animatedHeader,
306
+ inputSearchProps,
307
+ useShadowHeader,
308
+ navigation?.instance,
309
+ setAnimatedHeader,
310
+ setAnimatedSearch,
311
+ setHeaderType,
312
+ ]);
313
+
314
+ return { setSearchHeader, currentTint };
315
+ };