@react-navigation/bottom-tabs 7.6.0 → 7.7.1

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 (56) hide show
  1. package/lib/module/unstable/NativeBottomTabView.js +6 -0
  2. package/lib/module/unstable/NativeBottomTabView.js.map +1 -0
  3. package/lib/module/unstable/NativeBottomTabView.native.js +229 -0
  4. package/lib/module/unstable/NativeBottomTabView.native.js.map +1 -0
  5. package/lib/module/unstable/NativeScreen/NativeScreen.js +166 -0
  6. package/lib/module/unstable/NativeScreen/NativeScreen.js.map +1 -0
  7. package/lib/module/unstable/NativeScreen/debounce.js +12 -0
  8. package/lib/module/unstable/NativeScreen/debounce.js.map +1 -0
  9. package/lib/module/unstable/NativeScreen/types.js +4 -0
  10. package/lib/module/unstable/NativeScreen/types.js.map +1 -0
  11. package/lib/module/unstable/NativeScreen/useAnimatedHeaderHeight.js +12 -0
  12. package/lib/module/unstable/NativeScreen/useAnimatedHeaderHeight.js.map +1 -0
  13. package/lib/module/unstable/NativeScreen/useHeaderConfig.js +283 -0
  14. package/lib/module/unstable/NativeScreen/useHeaderConfig.js.map +1 -0
  15. package/lib/module/unstable/createNativeBottomTabNavigator.js +6 -0
  16. package/lib/module/unstable/createNativeBottomTabNavigator.js.map +1 -0
  17. package/lib/module/unstable/createNativeBottomTabNavigator.native.js +65 -0
  18. package/lib/module/unstable/createNativeBottomTabNavigator.native.js.map +1 -0
  19. package/lib/module/unstable/index.js +16 -0
  20. package/lib/module/unstable/index.js.map +1 -0
  21. package/lib/module/unstable/types.js +4 -0
  22. package/lib/module/unstable/types.js.map +1 -0
  23. package/lib/typescript/src/unstable/NativeBottomTabView.d.ts +10 -0
  24. package/lib/typescript/src/unstable/NativeBottomTabView.d.ts.map +1 -0
  25. package/lib/typescript/src/unstable/NativeBottomTabView.native.d.ts +10 -0
  26. package/lib/typescript/src/unstable/NativeBottomTabView.native.d.ts.map +1 -0
  27. package/lib/typescript/src/unstable/NativeScreen/NativeScreen.d.ts +8 -0
  28. package/lib/typescript/src/unstable/NativeScreen/NativeScreen.d.ts.map +1 -0
  29. package/lib/typescript/src/unstable/NativeScreen/debounce.d.ts +2 -0
  30. package/lib/typescript/src/unstable/NativeScreen/debounce.d.ts.map +1 -0
  31. package/lib/typescript/src/unstable/NativeScreen/types.d.ts +467 -0
  32. package/lib/typescript/src/unstable/NativeScreen/types.d.ts.map +1 -0
  33. package/lib/typescript/src/unstable/NativeScreen/useAnimatedHeaderHeight.d.ts +5 -0
  34. package/lib/typescript/src/unstable/NativeScreen/useAnimatedHeaderHeight.d.ts.map +1 -0
  35. package/lib/typescript/src/unstable/NativeScreen/useHeaderConfig.d.ts +11 -0
  36. package/lib/typescript/src/unstable/NativeScreen/useHeaderConfig.d.ts.map +1 -0
  37. package/lib/typescript/src/unstable/createNativeBottomTabNavigator.d.ts +2 -0
  38. package/lib/typescript/src/unstable/createNativeBottomTabNavigator.d.ts.map +1 -0
  39. package/lib/typescript/src/unstable/createNativeBottomTabNavigator.native.d.ts +16 -0
  40. package/lib/typescript/src/unstable/createNativeBottomTabNavigator.native.d.ts.map +1 -0
  41. package/lib/typescript/src/unstable/index.d.ts +13 -0
  42. package/lib/typescript/src/unstable/index.d.ts.map +1 -0
  43. package/lib/typescript/src/unstable/types.d.ts +302 -0
  44. package/lib/typescript/src/unstable/types.d.ts.map +1 -0
  45. package/package.json +10 -4
  46. package/src/unstable/NativeBottomTabView.native.tsx +307 -0
  47. package/src/unstable/NativeBottomTabView.tsx +20 -0
  48. package/src/unstable/NativeScreen/NativeScreen.tsx +242 -0
  49. package/src/unstable/NativeScreen/debounce.tsx +14 -0
  50. package/src/unstable/NativeScreen/types.ts +517 -0
  51. package/src/unstable/NativeScreen/useAnimatedHeaderHeight.tsx +18 -0
  52. package/src/unstable/NativeScreen/useHeaderConfig.tsx +423 -0
  53. package/src/unstable/createNativeBottomTabNavigator.native.tsx +116 -0
  54. package/src/unstable/createNativeBottomTabNavigator.tsx +4 -0
  55. package/src/unstable/index.tsx +22 -0
  56. package/src/unstable/types.tsx +385 -0
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ export function NativeBottomTabView(_) {
4
+ throw new Error('Native Bottom Tabs are not supported on this platform.');
5
+ }
6
+ //# sourceMappingURL=NativeBottomTabView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeBottomTabView","_","Error"],"sourceRoot":"../../../src","sources":["unstable/NativeBottomTabView.tsx"],"mappings":";;AAiBA,OAAO,SAASA,mBAAmBA,CAACC,CAAQ,EAAE;EAC5C,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;AAC3E","ignoreList":[]}
@@ -0,0 +1,229 @@
1
+ "use strict";
2
+
3
+ import { getLabel, Lazy, SafeAreaProviderCompat } from '@react-navigation/elements';
4
+ import { CommonActions, StackActions, useTheme } from '@react-navigation/native';
5
+ import Color from 'color';
6
+ import * as React from 'react';
7
+ import { Platform, PlatformColor } from 'react-native';
8
+ import { BottomTabs, BottomTabsScreen } from 'react-native-screens';
9
+ import { NativeScreen } from "./NativeScreen/NativeScreen.js";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ export function NativeBottomTabView({
12
+ state,
13
+ navigation,
14
+ descriptors
15
+ }) {
16
+ const {
17
+ colors,
18
+ fonts
19
+ } = useTheme();
20
+ const focusedRouteKey = state.routes[state.index].key;
21
+ const previousRouteKeyRef = React.useRef(focusedRouteKey);
22
+ React.useEffect(() => {
23
+ const previousRouteKey = previousRouteKeyRef.current;
24
+ if (previousRouteKey !== focusedRouteKey && descriptors[previousRouteKey]?.options.popToTopOnBlur) {
25
+ const prevRoute = state.routes.find(route => route.key === previousRouteKey);
26
+ if (prevRoute?.state?.type === 'stack' && prevRoute.state.key) {
27
+ const popToTopAction = {
28
+ ...StackActions.popToTop(),
29
+ target: prevRoute.state.key
30
+ };
31
+ navigation.dispatch(popToTopAction);
32
+ }
33
+ }
34
+ previousRouteKeyRef.current = focusedRouteKey;
35
+ }, [descriptors, focusedRouteKey, navigation, state.index, state.routes]);
36
+ const currentOptions = descriptors[state.routes[state.index].key]?.options;
37
+ const {
38
+ fontFamily = Platform.select({
39
+ ios: fonts.medium.fontFamily,
40
+ default: fonts.regular.fontFamily
41
+ }),
42
+ fontWeight = Platform.select({
43
+ ios: fonts.medium.fontWeight,
44
+ default: fonts.regular.fontWeight
45
+ }),
46
+ fontSize,
47
+ fontStyle
48
+ } = currentOptions.tabBarLabelStyle || {};
49
+ const activeTintColor = currentOptions.tabBarActiveTintColor ?? colors.primary;
50
+ const inactiveTintColor = currentOptions.tabBarInactiveTintColor ?? Platform.select({
51
+ ios: PlatformColor('label'),
52
+ default: colors.text
53
+ });
54
+ const activeIndicatorColor = currentOptions?.tabBarActiveIndicatorColor ?? typeof activeTintColor === 'string' ? Color(activeTintColor)?.alpha(0.1).string() : undefined;
55
+ const onTransitionStart = ({
56
+ closing,
57
+ route
58
+ }) => {
59
+ navigation.emit({
60
+ type: 'transitionStart',
61
+ data: {
62
+ closing
63
+ },
64
+ target: route.key
65
+ });
66
+ };
67
+ const onTransitionEnd = ({
68
+ closing,
69
+ route
70
+ }) => {
71
+ navigation.emit({
72
+ type: 'transitionEnd',
73
+ data: {
74
+ closing
75
+ },
76
+ target: route.key
77
+ });
78
+ };
79
+ return /*#__PURE__*/_jsx(SafeAreaProviderCompat, {
80
+ children: /*#__PURE__*/_jsx(BottomTabs, {
81
+ tabBarItemLabelVisibilityMode: currentOptions?.tabBarLabelVisibilityMode,
82
+ tabBarControllerMode: currentOptions?.tabBarControllerMode,
83
+ tabBarMinimizeBehavior: currentOptions?.tabBarMinimizeBehavior,
84
+ tabBarTintColor: activeTintColor,
85
+ tabBarItemIconColor: inactiveTintColor,
86
+ tabBarItemIconColorActive: activeTintColor,
87
+ tabBarItemTitleFontColor: inactiveTintColor,
88
+ tabBarItemTitleFontColorActive: activeTintColor,
89
+ tabBarItemTitleFontFamily: fontFamily,
90
+ tabBarItemTitleFontWeight: fontWeight,
91
+ tabBarItemTitleFontSize: fontSize,
92
+ tabBarItemTitleFontSizeActive: fontSize,
93
+ tabBarItemTitleFontStyle: fontStyle,
94
+ tabBarBackgroundColor: currentOptions.tabBarStyle?.backgroundColor,
95
+ tabBarItemActiveIndicatorColor: activeIndicatorColor,
96
+ tabBarItemActiveIndicatorEnabled: currentOptions?.tabBarActiveIndicatorEnabled,
97
+ tabBarItemRippleColor: currentOptions?.tabBarRippleColor,
98
+ experimentalControlNavigationStateInJS: true,
99
+ onNativeFocusChange: e => {
100
+ const route = state.routes.find(route => route.key === e.nativeEvent.tabKey);
101
+ if (route) {
102
+ const isFocused = state.index === state.routes.findIndex(r => r.key === route.key);
103
+ const event = navigation.emit({
104
+ type: 'tabPress',
105
+ target: route.key,
106
+ canPreventDefault: true
107
+ });
108
+ if (!isFocused && !event.defaultPrevented) {
109
+ React.startTransition(() => {
110
+ navigation.dispatch({
111
+ ...CommonActions.navigate(route.name, route.params),
112
+ target: state.key
113
+ });
114
+ });
115
+ }
116
+ }
117
+ },
118
+ children: state.routes.map((route, index) => {
119
+ const {
120
+ options,
121
+ render,
122
+ navigation
123
+ } = descriptors[route.key];
124
+ const isFocused = state.index === index;
125
+ const isPreloaded = state.preloadedRouteKeys.includes(route.key);
126
+ const {
127
+ title,
128
+ lazy = true,
129
+ tabBarLabel,
130
+ tabBarBadgeStyle,
131
+ tabBarIcon,
132
+ tabBarBadge,
133
+ tabBarSystemItem,
134
+ tabBarBlurEffect,
135
+ tabBarStyle
136
+ } = options;
137
+ const {
138
+ backgroundColor: tabBarBackgroundColor,
139
+ shadowColor: tabBarShadowColor
140
+ } = tabBarStyle || {};
141
+ const tabTitle =
142
+ // On iOS, `systemItem` already provides a localized label
143
+ // So we should only use `tabBarLabel` if explicitly provided
144
+ Platform.OS === 'ios' && tabBarSystemItem != null ? tabBarLabel : getLabel({
145
+ label: tabBarLabel,
146
+ title
147
+ }, route.name);
148
+ const tabItemAppearance = {
149
+ tabBarItemTitleFontFamily: fontFamily,
150
+ tabBarItemTitleFontSize: fontSize,
151
+ tabBarItemTitleFontWeight: fontWeight,
152
+ tabBarItemTitleFontStyle: fontStyle
153
+ };
154
+ const badgeBackgroundColor = tabBarBadgeStyle?.backgroundColor ?? colors.notification;
155
+ const badgeTextColor = typeof badgeBackgroundColor === 'string' && Color(badgeBackgroundColor)?.isLight() ? 'black' : 'white';
156
+ const icon = typeof tabBarIcon === 'function' ? getPlatformIcon(tabBarIcon({
157
+ focused: false
158
+ })) : tabBarIcon != null ? getPlatformIcon(tabBarIcon) : undefined;
159
+ const selectedIcon = typeof tabBarIcon === 'function' ? getPlatformIcon(tabBarIcon({
160
+ focused: true
161
+ })) : undefined;
162
+ return /*#__PURE__*/_jsx(BottomTabsScreen, {
163
+ onWillDisappear: () => onTransitionStart({
164
+ closing: true,
165
+ route
166
+ }),
167
+ onWillAppear: () => onTransitionStart({
168
+ closing: false,
169
+ route
170
+ }),
171
+ onDidAppear: () => onTransitionEnd({
172
+ closing: false,
173
+ route
174
+ }),
175
+ onDidDisappear: () => onTransitionEnd({
176
+ closing: true,
177
+ route
178
+ }),
179
+ tabKey: route.key,
180
+ icon: icon,
181
+ selectedIcon: selectedIcon?.ios ?? selectedIcon?.shared,
182
+ tabBarItemBadgeBackgroundColor: badgeBackgroundColor,
183
+ tabBarItemBadgeTextColor: badgeTextColor,
184
+ badgeValue: tabBarBadge?.toString(),
185
+ systemItem: tabBarSystemItem,
186
+ isFocused: isFocused,
187
+ title: tabTitle,
188
+ standardAppearance: {
189
+ tabBarBackgroundColor,
190
+ tabBarShadowColor,
191
+ tabBarBlurEffect,
192
+ stacked: {
193
+ normal: tabItemAppearance
194
+ },
195
+ inline: {
196
+ normal: tabItemAppearance
197
+ },
198
+ compactInline: {
199
+ normal: tabItemAppearance
200
+ }
201
+ },
202
+ children: /*#__PURE__*/_jsx(Lazy, {
203
+ enabled: lazy ? isFocused || isPreloaded : true,
204
+ render: () => /*#__PURE__*/_jsx(NativeScreen, {
205
+ route: route,
206
+ navigation: navigation,
207
+ options: options,
208
+ children: render()
209
+ })
210
+ })
211
+ }, route.key);
212
+ })
213
+ })
214
+ });
215
+ }
216
+ function getPlatformIcon(icon) {
217
+ return {
218
+ ios: icon?.type === 'sfSymbol' ? icon : icon?.type === 'image' && icon.tinted !== false ? {
219
+ type: 'templateSource',
220
+ templateSource: icon.source
221
+ } : undefined,
222
+ android: icon?.type === 'drawableResource' ? icon : undefined,
223
+ shared: icon?.type === 'image' ? {
224
+ type: 'imageSource',
225
+ imageSource: icon.source
226
+ } : undefined
227
+ };
228
+ }
229
+ //# sourceMappingURL=NativeBottomTabView.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getLabel","Lazy","SafeAreaProviderCompat","CommonActions","StackActions","useTheme","Color","React","Platform","PlatformColor","BottomTabs","BottomTabsScreen","NativeScreen","jsx","_jsx","NativeBottomTabView","state","navigation","descriptors","colors","fonts","focusedRouteKey","routes","index","key","previousRouteKeyRef","useRef","useEffect","previousRouteKey","current","options","popToTopOnBlur","prevRoute","find","route","type","popToTopAction","popToTop","target","dispatch","currentOptions","fontFamily","select","ios","medium","default","regular","fontWeight","fontSize","fontStyle","tabBarLabelStyle","activeTintColor","tabBarActiveTintColor","primary","inactiveTintColor","tabBarInactiveTintColor","text","activeIndicatorColor","tabBarActiveIndicatorColor","alpha","string","undefined","onTransitionStart","closing","emit","data","onTransitionEnd","children","tabBarItemLabelVisibilityMode","tabBarLabelVisibilityMode","tabBarControllerMode","tabBarMinimizeBehavior","tabBarTintColor","tabBarItemIconColor","tabBarItemIconColorActive","tabBarItemTitleFontColor","tabBarItemTitleFontColorActive","tabBarItemTitleFontFamily","tabBarItemTitleFontWeight","tabBarItemTitleFontSize","tabBarItemTitleFontSizeActive","tabBarItemTitleFontStyle","tabBarBackgroundColor","tabBarStyle","backgroundColor","tabBarItemActiveIndicatorColor","tabBarItemActiveIndicatorEnabled","tabBarActiveIndicatorEnabled","tabBarItemRippleColor","tabBarRippleColor","experimentalControlNavigationStateInJS","onNativeFocusChange","e","nativeEvent","tabKey","isFocused","findIndex","r","event","canPreventDefault","defaultPrevented","startTransition","navigate","name","params","map","render","isPreloaded","preloadedRouteKeys","includes","title","lazy","tabBarLabel","tabBarBadgeStyle","tabBarIcon","tabBarBadge","tabBarSystemItem","tabBarBlurEffect","shadowColor","tabBarShadowColor","tabTitle","OS","label","tabItemAppearance","badgeBackgroundColor","notification","badgeTextColor","isLight","icon","getPlatformIcon","focused","selectedIcon","onWillDisappear","onWillAppear","onDidAppear","onDidDisappear","shared","tabBarItemBadgeBackgroundColor","tabBarItemBadgeTextColor","badgeValue","toString","systemItem","standardAppearance","stacked","normal","inline","compactInline","enabled","tinted","templateSource","source","android","imageSource"],"sourceRoot":"../../../src","sources":["unstable/NativeBottomTabView.native.tsx"],"mappings":";;AAAA,SACEA,QAAQ,EACRC,IAAI,EACJC,sBAAsB,QACjB,4BAA4B;AACnC,SACEC,aAAa,EAGbC,YAAY,EAEZC,QAAQ,QACH,0BAA0B;AACjC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAA0BC,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AACvE,SACEC,UAAU,EACVC,gBAAgB,QAGX,sBAAsB;AAE7B,SAASC,YAAY,QAAQ,gCAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAc3D,OAAO,SAASC,mBAAmBA,CAAC;EAAEC,KAAK;EAAEC,UAAU;EAAEC;AAAmB,CAAC,EAAE;EAC7E,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGf,QAAQ,CAAC,CAAC;EAEpC,MAAMgB,eAAe,GAAGL,KAAK,CAACM,MAAM,CAACN,KAAK,CAACO,KAAK,CAAC,CAACC,GAAG;EACrD,MAAMC,mBAAmB,GAAGlB,KAAK,CAACmB,MAAM,CAACL,eAAe,CAAC;EAEzDd,KAAK,CAACoB,SAAS,CAAC,MAAM;IACpB,MAAMC,g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BAAqB;YACrBqC,iBAAiB;YACjBF,gBAAgB;YAChB0B,OAAO,EAAE;cACPC,MAAM,EAAErB;YACV,CAAC;YACDsB,MAAM,EAAE;cACND,MAAM,EAAErB;YACV,CAAC;YACDuB,aAAa,EAAE;cACbF,MAAM,EAAErB;YACV;UACF,CAAE;UAAAxD,QAAA,eAEFrD,IAAA,CAACb,IAAI;YACHkJ,OAAO,EAAEpC,IAAI,GAAGhB,SAAS,IAAIY,WAAW,GAAG,IAAK;YAChDD,MAAM,EAAEA,CAAA,kBACN5F,IAAA,CAACF,YAAY;cACXsB,KAAK,EAAEA,KAAM;cACbjB,UAAU,EAAEA,UAAW;cACvBa,OAAO,EAAEA,OAAQ;cAAAqC,QAAA,EAEhBuC,MAAM,CAAC;YAAC,CACG;UACd,CACH;QAAC,GApCGxE,KAAK,CAACV,GAqCK,CAAC;MAEvB,CAAC;IAAC,CACQ;EAAC,CACS,CAAC;AAE7B;AAEA,SAASyG,eAAeA,CAACD,IAAU,EAAgB;EACjD,OAAO;IACLrF,GAAG,EACDqF,IAAI,EAAE7F,IAAI,KAAK,UAAU,GACrB6F,IAAI,GACJA,IAAI,EAAE7F,IAAI,KAAK,OAAO,IAAI6F,IAAI,CAACoB,MAAM,KAAK,KAAK,GAC7C;MACEjH,IAAI,EAAE,gBAAgB;MACtBkH,cAAc,EAAErB,IAAI,CAACsB;IACvB,CAAC,GACDzF,SAAS;IACjB0F,OAAO,EAAEvB,IAAI,EAAE7F,IAAI,KAAK,kBAAkB,GAAG6F,IAAI,GAAGnE,SAAS;IAC7D2E,MAAM,EACJR,IAAI,EAAE7F,IAAI,KAAK,OAAO,GAClB;MACEA,IAAI,EAAE,aAAa;MACnBqH,WAAW,EAAExB,IAAI,CAACsB;IACpB,CAAC,GACDzF;EACR,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+
3
+ import { getDefaultHeaderHeight, HeaderHeightContext, HeaderShownContext, useFrameSize } from '@react-navigation/elements';
4
+ import * as React from 'react';
5
+ import { Animated, Platform, StatusBar, StyleSheet, useAnimatedValue, View } from 'react-native';
6
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
7
+ import { ScreenStack, ScreenStackItem } from 'react-native-screens';
8
+ import { debounce } from "./debounce.js";
9
+ import { AnimatedHeaderHeightContext } from "./useAnimatedHeaderHeight.js";
10
+ import { useHeaderConfig } from "./useHeaderConfig.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const ANDROID_DEFAULT_HEADER_HEIGHT = 56;
13
+ export function NativeScreen({
14
+ route,
15
+ navigation,
16
+ options,
17
+ children
18
+ }) {
19
+ const {
20
+ headerShown = true,
21
+ headerTransparent,
22
+ headerBackground,
23
+ header: renderCustomHeader
24
+ } = options;
25
+ const isModal = false;
26
+ const insets = useSafeAreaInsets();
27
+
28
+ // Modals are fullscreen in landscape only on iPhone
29
+ const isIPhone = Platform.OS === 'ios' && !(Platform.isPad || Platform.isTV);
30
+ const isParentHeaderShown = React.useContext(HeaderShownContext);
31
+ const parentHeaderHeight = React.useContext(HeaderHeightContext);
32
+ const isLandscape = useFrameSize(frame => frame.width > frame.height);
33
+ const topInset = isParentHeaderShown || Platform.OS === 'ios' && isModal || isIPhone && isLandscape ? 0 : insets.top;
34
+ const defaultHeaderHeight = useFrameSize(frame => Platform.select({
35
+ // FIXME: Currently screens isn't using Material 3
36
+ // So our `getDefaultHeaderHeight` doesn't return the correct value
37
+ // So we hardcode the value here for now until screens is updated
38
+ android: ANDROID_DEFAULT_HEADER_HEIGHT + topInset,
39
+ default: getDefaultHeaderHeight(frame, isModal, topInset)
40
+ }));
41
+ const [headerHeight, setHeaderHeight] = React.useState(defaultHeaderHeight);
42
+
43
+ // eslint-disable-next-line react-hooks/exhaustive-deps
44
+ const setHeaderHeightDebounced = React.useCallback(
45
+ // Debounce the header height updates to avoid excessive re-renders
46
+ debounce(setHeaderHeight, 100), []);
47
+ const hasCustomHeader = renderCustomHeader != null;
48
+ let headerHeightCorrectionOffset = 0;
49
+ if (Platform.OS === 'android' && !hasCustomHeader) {
50
+ const statusBarHeight = StatusBar.currentHeight ?? 0;
51
+
52
+ // FIXME: On Android, the native header height is not correctly calculated
53
+ // It includes status bar height even if statusbar is not translucent
54
+ // And the statusbar value itself doesn't match the actual status bar height
55
+ // So we subtract the bogus status bar height and add the actual top inset
56
+ headerHeightCorrectionOffset = -statusBarHeight + topInset;
57
+ }
58
+ const rawAnimatedHeaderHeight = useAnimatedValue(defaultHeaderHeight);
59
+ const animatedHeaderHeight = React.useMemo(() => Animated.add(rawAnimatedHeaderHeight, headerHeightCorrectionOffset), [headerHeightCorrectionOffset, rawAnimatedHeaderHeight]);
60
+ const headerTopInsetEnabled = topInset !== 0;
61
+ const onHeaderHeightChange = Animated.event([{
62
+ nativeEvent: {
63
+ headerHeight: rawAnimatedHeaderHeight
64
+ }
65
+ }], {
66
+ useNativeDriver: true,
67
+ listener: e => {
68
+ if (hasCustomHeader) {
69
+ // If we have a custom header, don't use native header height
70
+ return;
71
+ }
72
+ if (Platform.OS === 'android' && (options.headerBackground != null || options.headerTransparent)) {
73
+ // FIXME: On Android, we get 0 if the header is translucent
74
+ // So we set a default height in that case
75
+ setHeaderHeight(ANDROID_DEFAULT_HEADER_HEIGHT + topInset);
76
+ return;
77
+ }
78
+ if (e.nativeEvent && typeof e.nativeEvent === 'object' && 'headerHeight' in e.nativeEvent && typeof e.nativeEvent.headerHeight === 'number') {
79
+ const headerHeight = e.nativeEvent.headerHeight + headerHeightCorrectionOffset;
80
+
81
+ // Only debounce if header has large title or search bar
82
+ // As it's the only case where the header height can change frequently
83
+ const doesHeaderAnimate = Platform.OS === 'ios' && (options.headerLargeTitle || options.headerSearchBarOptions);
84
+ if (doesHeaderAnimate) {
85
+ setHeaderHeightDebounced(headerHeight);
86
+ } else {
87
+ setHeaderHeight(headerHeight);
88
+ }
89
+ }
90
+ }
91
+ });
92
+ const headerConfig = useHeaderConfig({
93
+ ...options,
94
+ route,
95
+ headerHeight,
96
+ headerShown: hasCustomHeader ? false : headerShown === true,
97
+ headerTopInsetEnabled
98
+ });
99
+ return /*#__PURE__*/_jsx(ScreenStack, {
100
+ style: styles.container,
101
+ children: /*#__PURE__*/_jsx(ScreenStackItem, {
102
+ screenId: route.key,
103
+ headerConfig: headerConfig,
104
+ onHeaderHeightChange: onHeaderHeightChange,
105
+ children: /*#__PURE__*/_jsx(AnimatedHeaderHeightContext.Provider, {
106
+ value: animatedHeaderHeight,
107
+ children: /*#__PURE__*/_jsxs(HeaderHeightContext.Provider, {
108
+ value: headerShown ? headerHeight : parentHeaderHeight ?? 0,
109
+ children: [headerBackground != null ?
110
+ /*#__PURE__*/
111
+ /**
112
+ * To show a custom header background, we render it at the top of the screen below the header
113
+ * The header also needs to be positioned absolutely (with `translucent` style)
114
+ */
115
+ _jsx(View, {
116
+ style: [styles.background, headerTransparent ? styles.translucent : null, {
117
+ height: headerHeight
118
+ }],
119
+ children: headerBackground()
120
+ }) : null, hasCustomHeader && headerShown ? /*#__PURE__*/_jsx(View, {
121
+ onLayout: e => {
122
+ const headerHeight = e.nativeEvent.layout.height;
123
+ setHeaderHeight(headerHeight);
124
+ rawAnimatedHeaderHeight.setValue(headerHeight);
125
+ },
126
+ style: [styles.header, headerTransparent ? styles.absolute : null],
127
+ children: renderCustomHeader?.({
128
+ route,
129
+ navigation,
130
+ options
131
+ })
132
+ }) : null, /*#__PURE__*/_jsx(HeaderShownContext.Provider, {
133
+ value: isParentHeaderShown || headerShown,
134
+ children: children
135
+ })]
136
+ })
137
+ })
138
+ })
139
+ });
140
+ }
141
+ const styles = StyleSheet.create({
142
+ container: {
143
+ flex: 1
144
+ },
145
+ header: {
146
+ zIndex: 1
147
+ },
148
+ absolute: {
149
+ position: 'absolute',
150
+ top: 0,
151
+ start: 0,
152
+ end: 0
153
+ },
154
+ translucent: {
155
+ position: 'absolute',
156
+ top: 0,
157
+ start: 0,
158
+ end: 0,
159
+ zIndex: 1,
160
+ elevation: 1
161
+ },
162
+ background: {
163
+ overflow: 'hidden'
164
+ }
165
+ });
166
+ //# sourceMappingURL=NativeScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getDefaultHeaderHeight","HeaderHeightContext","HeaderShownContext","useFrameSize","React","Animated","Platform","StatusBar","StyleSheet","useAnimatedValue","View","useSafeAreaInsets","ScreenStack","ScreenStackItem","debounce","AnimatedHeaderHeightContext","useHeaderConfig","jsx","_jsx","jsxs","_jsxs","ANDROID_DEFAULT_HEADER_HEIGHT","NativeScreen","route","navigation","options","children","headerShown","headerTransparent","headerBackground","header","renderCustomHeader","isModal","insets","isIPhone","OS","isPad","isTV","isParentHeaderShown","useContext","parentHeaderHeight","isLandscape","frame","width","height","topInset","top","defaultHeaderHeight","select","android","default","headerHeight","setHeaderHeight","useState","setHeaderHeightDebounced","useCallback","hasCustomHeader","headerHeightCorrectionOffset","statusBarHeight","currentHeight","rawAnimatedHeaderHeight","animatedHeaderHeight","useMemo","add","headerTopInsetEnabled","onHeaderHeightChange","event","nativeEvent","useNativeDriver","listener","e","doesHeaderAnimate","headerLargeTitle","headerSearchBarOptions","headerConfig","style","styles","container","screenId","key","Provider","value","background","translucent","onLayout","layout","setValue","absolute","create","flex","zIndex","position","start","end","elevation","overflow"],"sourceRoot":"../../../../src","sources":["unstable/NativeScreen/NativeScreen.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,mBAAmB,EACnBC,kBAAkB,EAClBC,YAAY,QACP,4BAA4B;AACnC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,gBAAgB,EAChBC,IAAI,QACC,cAAc;AACrB,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,WAAW,EAAEC,eAAe,QAAQ,sBAAsB;AAGnE,SAASC,QAAQ,QAAQ,eAAY;AACrC,SAASC,2BAA2B,QAAQ,8BAA2B;AACvE,SAASC,eAAe,QA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,SAAS,EAAE;EACb,CAAC;EACDZ,UAAU,EAAE;IACVa,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ export function debounce(func, duration) {
4
+ let timeout;
5
+ return function (...args) {
6
+ clearTimeout(timeout);
7
+ timeout = setTimeout(() => {
8
+ func.apply(this, args);
9
+ }, duration);
10
+ };
11
+ }
12
+ //# sourceMappingURL=debounce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["debounce","func","duration","timeout","args","clearTimeout","setTimeout","apply"],"sourceRoot":"../../../../src","sources":["unstable/NativeScreen/debounce.tsx"],"mappings":";;AAAA,OAAO,SAASA,QAAQA,CACtBC,IAAO,EACPC,QAAgB,EACb;EACH,IAAIC,OAAsC;EAE1C,OAAO,UAAyB,GAAGC,IAAI,EAAE;IACvCC,YAAY,CAACF,OAAO,CAAC;IAErBA,OAAO,GAAGG,UAAU,CAAC,MAAM;MACzBL,IAAI,CAACM,KAAK,CAAC,IAAI,EAAEH,IAAI,CAAC;IACxB,CAAC,EAAEF,QAAQ,CAAC;EACd,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["unstable/NativeScreen/types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ import * as React from 'react';
4
+ export const AnimatedHeaderHeightContext = /*#__PURE__*/React.createContext(undefined);
5
+ export function useAnimatedHeaderHeight() {
6
+ const animatedValue = React.useContext(AnimatedHeaderHeightContext);
7
+ if (animatedValue === undefined) {
8
+ throw new Error("Couldn't find the header height. Are you inside a screen in a native stack navigator?");
9
+ }
10
+ return animatedValue;
11
+ }
12
+ //# sourceMappingURL=useAnimatedHeaderHeight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","AnimatedHeaderHeightContext","createContext","undefined","useAnimatedHeaderHeight","animatedValue","useContext","Error"],"sourceRoot":"../../../../src","sources":["unstable/NativeScreen/useAnimatedHeaderHeight.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAG9B,OAAO,MAAMC,2BAA2B,gBAAGD,KAAK,CAACE,aAAa,CAE5DC,SAAS,CAAC;AAEZ,OAAO,SAASC,uBAAuBA,CAAA,EAAG;EACxC,MAAMC,aAAa,GAAGL,KAAK,CAACM,UAAU,CAACL,2BAA2B,CAAC;EAEnE,IAAII,aAAa,KAAKF,SAAS,EAAE;IAC/B,MAAM,IAAII,KAAK,CACb,uFACF,CAAC;EACH;EAEA,OAAOF,aAAa;AACtB","ignoreList":[]}