@react-navigation/bottom-tabs 7.9.0 → 8.0.0-alpha.0

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 (139) hide show
  1. package/lib/module/index.js +3 -2
  2. package/lib/module/index.js.map +1 -1
  3. package/lib/module/navigators/createBottomTabNavigator.js +27 -9
  4. package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
  5. package/lib/module/utils/BottomTabAnimationContext.js +5 -0
  6. package/lib/module/utils/BottomTabAnimationContext.js.map +1 -0
  7. package/lib/module/utils/useBottomTabAnimation.js +12 -0
  8. package/lib/module/utils/useBottomTabAnimation.js.map +1 -0
  9. package/lib/module/utils/useTabBarPosition.js +34 -0
  10. package/lib/module/utils/useTabBarPosition.js.map +1 -0
  11. package/lib/module/views/BottomTabBar.js +46 -49
  12. package/lib/module/views/BottomTabBar.js.map +1 -1
  13. package/lib/module/views/BottomTabItem.js +17 -15
  14. package/lib/module/views/BottomTabItem.js.map +1 -1
  15. package/lib/module/views/BottomTabViewCommon.js +16 -0
  16. package/lib/module/views/BottomTabViewCommon.js.map +1 -0
  17. package/lib/module/views/{BottomTabView.js → BottomTabViewCustom.js} +107 -106
  18. package/lib/module/views/BottomTabViewCustom.js.map +1 -0
  19. package/lib/module/views/BottomTabViewNative.android.js +4 -0
  20. package/lib/module/views/BottomTabViewNative.android.js.map +1 -0
  21. package/lib/module/views/BottomTabViewNative.ios.js +4 -0
  22. package/lib/module/views/BottomTabViewNative.ios.js.map +1 -0
  23. package/lib/module/views/BottomTabViewNative.js +5 -0
  24. package/lib/module/views/BottomTabViewNative.js.map +1 -0
  25. package/lib/module/{unstable/NativeBottomTabView.native.js → views/BottomTabViewNativeImpl.js} +95 -77
  26. package/lib/module/views/BottomTabViewNativeImpl.js.map +1 -0
  27. package/lib/module/views/ScreenContent.js +39 -0
  28. package/lib/module/views/ScreenContent.js.map +1 -0
  29. package/lib/module/views/TabBarIcon.js +40 -4
  30. package/lib/module/views/TabBarIcon.js.map +1 -1
  31. package/lib/typescript/src/index.d.ts +4 -3
  32. package/lib/typescript/src/index.d.ts.map +1 -1
  33. package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +10 -6
  34. package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
  35. package/lib/typescript/src/types.d.ts +383 -115
  36. package/lib/typescript/src/types.d.ts.map +1 -1
  37. package/lib/typescript/src/utils/BottomTabAnimationContext.d.ts +4 -0
  38. package/lib/typescript/src/utils/BottomTabAnimationContext.d.ts.map +1 -0
  39. package/lib/typescript/src/utils/useBottomTabAnimation.d.ts +2 -0
  40. package/lib/typescript/src/utils/useBottomTabAnimation.d.ts.map +1 -0
  41. package/lib/typescript/src/utils/useTabBarPosition.d.ts +3 -0
  42. package/lib/typescript/src/utils/useTabBarPosition.d.ts.map +1 -0
  43. package/lib/typescript/src/views/BottomTabBar.d.ts +4 -4
  44. package/lib/typescript/src/views/BottomTabBar.d.ts.map +1 -1
  45. package/lib/typescript/src/views/BottomTabItem.d.ts +16 -14
  46. package/lib/typescript/src/views/BottomTabItem.d.ts.map +1 -1
  47. package/lib/typescript/src/views/{BottomTabView.d.ts → BottomTabViewCommon.d.ts} +2 -2
  48. package/lib/typescript/src/views/BottomTabViewCommon.d.ts.map +1 -0
  49. package/lib/typescript/src/views/BottomTabViewCustom.d.ts +10 -0
  50. package/lib/typescript/src/views/BottomTabViewCustom.d.ts.map +1 -0
  51. package/lib/typescript/src/views/BottomTabViewNative.android.d.ts +2 -0
  52. package/lib/typescript/src/views/BottomTabViewNative.android.d.ts.map +1 -0
  53. package/lib/typescript/src/views/BottomTabViewNative.d.ts +3 -0
  54. package/lib/typescript/src/views/BottomTabViewNative.d.ts.map +1 -0
  55. package/lib/typescript/src/views/BottomTabViewNative.ios.d.ts +2 -0
  56. package/lib/typescript/src/views/BottomTabViewNative.ios.d.ts.map +1 -0
  57. package/lib/typescript/src/views/BottomTabViewNativeImpl.d.ts +10 -0
  58. package/lib/typescript/src/views/BottomTabViewNativeImpl.d.ts.map +1 -0
  59. package/lib/typescript/src/views/ScreenContent.d.ts +13 -0
  60. package/lib/typescript/src/views/ScreenContent.d.ts.map +1 -0
  61. package/lib/typescript/src/views/TabBarIcon.d.ts +9 -9
  62. package/lib/typescript/src/views/TabBarIcon.d.ts.map +1 -1
  63. package/package.json +11 -16
  64. package/src/index.tsx +7 -2
  65. package/src/navigators/createBottomTabNavigator.tsx +78 -27
  66. package/src/types.tsx +417 -122
  67. package/src/utils/BottomTabAnimationContext.tsx +7 -0
  68. package/src/utils/useBottomTabAnimation.tsx +15 -0
  69. package/src/utils/useTabBarPosition.tsx +41 -0
  70. package/src/views/BottomTabBar.tsx +68 -67
  71. package/src/views/BottomTabItem.tsx +39 -34
  72. package/src/views/BottomTabViewCommon.tsx +26 -0
  73. package/src/views/{BottomTabView.tsx → BottomTabViewCustom.tsx} +142 -129
  74. package/src/views/BottomTabViewNative.android.tsx +1 -0
  75. package/src/views/BottomTabViewNative.ios.tsx +1 -0
  76. package/src/views/BottomTabViewNative.tsx +3 -0
  77. package/src/{unstable/NativeBottomTabView.native.tsx → views/BottomTabViewNativeImpl.tsx} +139 -116
  78. package/src/views/ScreenContent.tsx +58 -0
  79. package/src/views/TabBarIcon.tsx +63 -10
  80. package/lib/module/unstable/NativeBottomTabView.js +0 -6
  81. package/lib/module/unstable/NativeBottomTabView.js.map +0 -1
  82. package/lib/module/unstable/NativeBottomTabView.native.js.map +0 -1
  83. package/lib/module/unstable/NativeScreen/NativeScreen.js +0 -152
  84. package/lib/module/unstable/NativeScreen/NativeScreen.js.map +0 -1
  85. package/lib/module/unstable/NativeScreen/debounce.js +0 -12
  86. package/lib/module/unstable/NativeScreen/debounce.js.map +0 -1
  87. package/lib/module/unstable/NativeScreen/types.js +0 -4
  88. package/lib/module/unstable/NativeScreen/types.js.map +0 -1
  89. package/lib/module/unstable/NativeScreen/useAnimatedHeaderHeight.js +0 -12
  90. package/lib/module/unstable/NativeScreen/useAnimatedHeaderHeight.js.map +0 -1
  91. package/lib/module/unstable/NativeScreen/useHeaderConfig.js +0 -304
  92. package/lib/module/unstable/NativeScreen/useHeaderConfig.js.map +0 -1
  93. package/lib/module/unstable/createNativeBottomTabNavigator.js +0 -6
  94. package/lib/module/unstable/createNativeBottomTabNavigator.js.map +0 -1
  95. package/lib/module/unstable/createNativeBottomTabNavigator.native.js +0 -65
  96. package/lib/module/unstable/createNativeBottomTabNavigator.native.js.map +0 -1
  97. package/lib/module/unstable/index.js +0 -16
  98. package/lib/module/unstable/index.js.map +0 -1
  99. package/lib/module/unstable/types.js +0 -4
  100. package/lib/module/unstable/types.js.map +0 -1
  101. package/lib/module/views/BottomTabView.js.map +0 -1
  102. package/lib/module/views/ScreenFallback.js +0 -42
  103. package/lib/module/views/ScreenFallback.js.map +0 -1
  104. package/lib/typescript/src/unstable/NativeBottomTabView.d.ts +0 -10
  105. package/lib/typescript/src/unstable/NativeBottomTabView.d.ts.map +0 -1
  106. package/lib/typescript/src/unstable/NativeBottomTabView.native.d.ts +0 -10
  107. package/lib/typescript/src/unstable/NativeBottomTabView.native.d.ts.map +0 -1
  108. package/lib/typescript/src/unstable/NativeScreen/NativeScreen.d.ts +0 -8
  109. package/lib/typescript/src/unstable/NativeScreen/NativeScreen.d.ts.map +0 -1
  110. package/lib/typescript/src/unstable/NativeScreen/debounce.d.ts +0 -2
  111. package/lib/typescript/src/unstable/NativeScreen/debounce.d.ts.map +0 -1
  112. package/lib/typescript/src/unstable/NativeScreen/types.d.ts +0 -523
  113. package/lib/typescript/src/unstable/NativeScreen/types.d.ts.map +0 -1
  114. package/lib/typescript/src/unstable/NativeScreen/useAnimatedHeaderHeight.d.ts +0 -5
  115. package/lib/typescript/src/unstable/NativeScreen/useAnimatedHeaderHeight.d.ts.map +0 -1
  116. package/lib/typescript/src/unstable/NativeScreen/useHeaderConfig.d.ts +0 -11
  117. package/lib/typescript/src/unstable/NativeScreen/useHeaderConfig.d.ts.map +0 -1
  118. package/lib/typescript/src/unstable/createNativeBottomTabNavigator.d.ts +0 -2
  119. package/lib/typescript/src/unstable/createNativeBottomTabNavigator.d.ts.map +0 -1
  120. package/lib/typescript/src/unstable/createNativeBottomTabNavigator.native.d.ts +0 -16
  121. package/lib/typescript/src/unstable/createNativeBottomTabNavigator.native.d.ts.map +0 -1
  122. package/lib/typescript/src/unstable/index.d.ts +0 -13
  123. package/lib/typescript/src/unstable/index.d.ts.map +0 -1
  124. package/lib/typescript/src/unstable/types.d.ts +0 -319
  125. package/lib/typescript/src/unstable/types.d.ts.map +0 -1
  126. package/lib/typescript/src/views/BottomTabView.d.ts.map +0 -1
  127. package/lib/typescript/src/views/ScreenFallback.d.ts +0 -18
  128. package/lib/typescript/src/views/ScreenFallback.d.ts.map +0 -1
  129. package/src/unstable/NativeBottomTabView.tsx +0 -20
  130. package/src/unstable/NativeScreen/NativeScreen.tsx +0 -212
  131. package/src/unstable/NativeScreen/debounce.tsx +0 -14
  132. package/src/unstable/NativeScreen/types.ts +0 -573
  133. package/src/unstable/NativeScreen/useAnimatedHeaderHeight.tsx +0 -18
  134. package/src/unstable/NativeScreen/useHeaderConfig.tsx +0 -434
  135. package/src/unstable/createNativeBottomTabNavigator.native.tsx +0 -116
  136. package/src/unstable/createNativeBottomTabNavigator.tsx +0 -4
  137. package/src/unstable/index.tsx +0 -23
  138. package/src/unstable/types.tsx +0 -405
  139. package/src/views/ScreenFallback.tsx +0 -50
@@ -1,573 +0,0 @@
1
- import * as React from 'react';
2
- import type {
3
- ColorValue,
4
- ImageSourcePropType,
5
- StyleProp,
6
- TextStyle,
7
- } from 'react-native';
8
- import type {
9
- ScreenStackHeaderConfigProps,
10
- SearchBarProps,
11
- } from 'react-native-screens';
12
- import type { SFSymbol } from 'sf-symbols-typescript';
13
-
14
- import type { NativeBottomTabHeaderProps } from '../types';
15
-
16
- export type NativeHeaderOptions = {
17
- /**
18
- * String that can be displayed in the header as a fallback for `headerTitle`.
19
- */
20
- title?: string;
21
- /**
22
- * Style of the header when a large title is shown
23
- * The large title is shown if `headerLargeTitle` is `true` and
24
- * the edge of any scrollable content reaches the matching edge of the header.
25
- *
26
- * Supported properties:
27
- * - backgroundColor
28
- *
29
- * Only supported on iOS.
30
- *
31
- * @platform ios
32
- */
33
- headerLargeStyle?: StyleProp<{
34
- backgroundColor?: ColorValue;
35
- }>;
36
- /**
37
- * Whether to enable header with large title which collapses to regular header on scroll.
38
- *
39
- * For large title to collapse on scroll, the content of the screen should be wrapped in a scrollable view such as `ScrollView` or `FlatList`.
40
- * If the scrollable area doesn't fill the screen, the large title won't collapse on scroll.
41
- * You also need to specify `contentInsetAdjustmentBehavior="automatic"` in your `ScrollView`, `FlatList` etc.
42
- *
43
- * Only supported on iOS.
44
- *
45
- * @platform ios
46
- */
47
- headerLargeTitleEnabled?: boolean;
48
- /**
49
- * Whether drop shadow of header is visible when a large title is shown.
50
- *
51
- * Only supported on iOS.
52
- *
53
- * @platform ios
54
- */
55
- headerLargeTitleShadowVisible?: boolean;
56
- /**
57
- * Style object for large title in header. Supported properties:
58
- * - fontFamily
59
- * - fontSize
60
- * - fontWeight
61
- * - color
62
- *
63
- * Only supported on iOS.
64
- *
65
- * @platform ios
66
- */
67
- headerLargeTitleStyle?: StyleProp<{
68
- fontFamily?: string;
69
- fontSize?: number;
70
- fontWeight?: string;
71
- color?: ColorValue;
72
- }>;
73
- /**
74
- * Style object for header. Supported properties:
75
- * - backgroundColor
76
- */
77
- headerStyle?: StyleProp<{
78
- backgroundColor?: ColorValue;
79
- }>;
80
-
81
- /**
82
- * Whether to hide the elevation shadow (Android) or the bottom border (iOS) on the header.
83
- */
84
- headerShadowVisible?: boolean;
85
-
86
- /**
87
- * Boolean indicating whether the navigation bar is translucent.
88
- * Setting this to `true` makes the header absolutely positioned,
89
- * and changes the background color to `transparent` unless specified in `headerStyle`.
90
- */
91
- headerTransparent?: boolean;
92
-
93
- /**
94
- * Blur effect for the translucent header.
95
- * The `headerTransparent` option needs to be set to `true` for this to work.
96
- *
97
- * Only supported on iOS.
98
- *
99
- * @platform ios
100
- */
101
- headerBlurEffect?: ScreenStackHeaderConfigProps['blurEffect'];
102
-
103
- /**
104
- * Tint color for the header. Changes the color of back button and title.
105
- */
106
- headerTintColor?: string;
107
-
108
- /**
109
- * Function which returns a React Element to render as the background of the header.
110
- * This is useful for using backgrounds such as an image, a gradient, blur effect etc.
111
- * You can use this with `headerTransparent` to render content underneath a translucent header.
112
- */
113
- headerBackground?: () => React.ReactNode;
114
-
115
- /**
116
- * Function which returns a React Element to display on the left side of the header.
117
- * This replaces the back button. See `headerBackVisible` to show the back button along side left element.
118
- * Will be overriden by `headerLeftItems` on iOS.
119
- */
120
- headerLeft?: (props: NativeScreenHeaderItemProps) => React.ReactNode;
121
-
122
- /**
123
- * Function which returns a React Element to display on the right side of the header.
124
- * Will be overriden by `headerRightItems` on iOS.
125
- */
126
- headerRight?: (props: NativeScreenHeaderItemProps) => React.ReactNode;
127
-
128
- /**
129
- * Function which returns an array of items to display as on the left side of the header.
130
- * Overrides `headerLeft`.
131
- *
132
- * This is an unstable API and might change in the future.
133
- *
134
- * @platform ios
135
- */
136
- unstable_headerLeftItems?: (
137
- props: NativeScreenHeaderItemProps
138
- ) => NativeScreenHeaderItem[];
139
-
140
- /**
141
- * Function which returns an array of items to display as on the right side of the header.
142
- * Overrides `headerRight`.
143
- *
144
- * This is an unstable API and might change in the future.
145
- *
146
- * @platform ios
147
- */
148
- unstable_headerRightItems?: (
149
- props: NativeScreenHeaderItemProps
150
- ) => NativeScreenHeaderItem[];
151
-
152
- /**
153
- * String or a function that returns a React Element to be used by the header.
154
- * Defaults to screen `title` or route name.
155
- *
156
- * When a function is passed, it receives `tintColor` and`children` in the options object as an argument.
157
- * The title string is passed in `children`.
158
- *
159
- * Note that if you render a custom element by passing a function, animations for the title won't work.
160
- */
161
- headerTitle?:
162
- | string
163
- | ((props: {
164
- /**
165
- * The title text of the header.
166
- */
167
- children: string;
168
- /**
169
- * Tint color for the header.
170
- */
171
- tintColor?: string;
172
- }) => React.ReactNode);
173
-
174
- /**
175
- * How to align the the header title.
176
- * Defaults to `left` on platforms other than iOS.
177
- *
178
- * Not supported on iOS. It's always `center` on iOS and cannot be changed.
179
- */
180
- headerTitleAlign?: 'left' | 'center';
181
-
182
- /**
183
- * Style object for header title. Supported properties:
184
- * - fontFamily
185
- * - fontSize
186
- * - fontWeight
187
- * - color
188
- */
189
- headerTitleStyle?: StyleProp<
190
- Pick<TextStyle, 'fontFamily' | 'fontSize' | 'fontWeight'> & {
191
- color?: string;
192
- }
193
- >;
194
-
195
- /**
196
- * Options to render a native search bar.
197
- * You also need to specify `contentInsetAdjustmentBehavior="automatic"` in your `ScrollView`, `FlatList` etc.
198
- * If you don't have a `ScrollView`, specify `headerTransparent: false`.
199
- */
200
- headerSearchBarOptions?: SearchBarProps;
201
-
202
- /**
203
- * Whether to show the header. Setting this to `false` hides the header.
204
- * Defaults to `true`.
205
- */
206
- headerShown?: boolean;
207
-
208
- /**
209
- * Function that given returns a React Element to display as a header.
210
- */
211
- header?: (props: NativeBottomTabHeaderProps) => React.ReactNode;
212
- };
213
-
214
- export type NativeScreenHeaderItemProps = {
215
- /**
216
- * Tint color for the header.
217
- */
218
- tintColor?: ColorValue;
219
- };
220
-
221
- /**
222
- * A button item in the header.
223
- */
224
- export type NativeScreenHeaderItemButton = SharedHeaderItem & {
225
- /**
226
- * Type of the item.
227
- */
228
- type: 'button';
229
- /**
230
- * Function to call when the item is pressed.
231
- */
232
- onPress: () => void;
233
- /**
234
- * Whether the item is in a selected state.
235
- *
236
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected
237
- */
238
- selected?: boolean;
239
- };
240
-
241
- /**
242
- * An action item in a menu.
243
- */
244
- export type NativeScreenHeaderItemMenuAction = {
245
- type: 'action';
246
- /**
247
- * Label for the menu item.
248
- */
249
- label: string;
250
- /**
251
- * The secondary text displayed alongside the label of the menu item.
252
- */
253
- description?: string;
254
- /**
255
- * Icon for the menu item.
256
- */
257
- icon?: IconIOSSfSymbol;
258
- /**
259
- * Function to call when the menu item is pressed.
260
- */
261
- onPress: () => void;
262
- /**
263
- * The state of an action- or command-based menu item.
264
- *
265
- * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/state
266
- */
267
- state?: 'on' | 'off' | 'mixed';
268
- /**
269
- * Whether to apply disabled style to the item.
270
- *
271
- * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled
272
- */
273
- disabled?: boolean;
274
- /**
275
- * Whether to apply destructive style to the item.
276
- *
277
- * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive
278
- */
279
- destructive?: boolean;
280
- /**
281
- * Whether to apply hidden style to the item.
282
- *
283
- * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/hidden
284
- */
285
- hidden?: boolean;
286
- /**
287
- * Whether to keep the menu presented after firing the element’s action.
288
- *
289
- * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented
290
- */
291
- keepsMenuPresented?: boolean;
292
- /**
293
- * An elaborated title that explains the purpose of the action.
294
- *
295
- * On iOS, the system displays this title in the discoverability heads-up display (HUD).
296
- * If this is not set, the HUD displays the title property.
297
- *
298
- * Read more: https://developer.apple.com/documentation/uikit/uiaction/discoverabilitytitle
299
- */
300
- discoverabilityLabel?: string;
301
- };
302
-
303
- /**
304
- * A submenu item that contains other menu items.
305
- */
306
- export type NativeScreenHeaderItemMenuSubmenu = {
307
- type: 'submenu';
308
- /**
309
- * Label for the submenu item.
310
- */
311
- label: string;
312
- /**
313
- * Icon for the submenu item.
314
- */
315
- icon?: IconIOSSfSymbol;
316
- /**
317
- * Whether the menu is displayed inline with the parent menu.
318
- * By default, submenus are displayed after expanding the parent menu item.
319
- * Inline menus are displayed as part of the parent menu as a section.
320
- *
321
- * Defaults to `false`.
322
- *
323
- * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline
324
- */
325
- inline?: boolean;
326
- /**
327
- * How the submenu items are displayed.
328
- * - `default`: menu items are displayed normally.
329
- * - `palette`: menu items are displayed in a horizontal row.
330
- *
331
- * Defaults to `default`.
332
- *
333
- * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette
334
- */
335
- layout?: 'default' | 'palette';
336
- /**
337
- * Whether to apply destructive style to the menu item.
338
- *
339
- * Read more: https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive
340
- */
341
- destructive?: boolean;
342
- /**
343
- * Whether multiple items in the submenu can be selected, i.e. in "on" state.
344
- *
345
- * Defaults to `false`.
346
- *
347
- * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/singleselection
348
- */
349
- multiselectable?: boolean;
350
- /**
351
- * Array of menu items (actions or submenus).
352
- */
353
- items: NativeScreenHeaderItemMenu['menu']['items'];
354
- };
355
-
356
- /**
357
- * An item that shows a menu when pressed.
358
- */
359
- export type NativeScreenHeaderItemMenu = SharedHeaderItem & {
360
- type: 'menu';
361
- /**
362
- * Whether the menu is a selection menu.
363
- * Tapping an item in a selection menu will add a checkmark to the selected item.
364
- *
365
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/changesselectionasprimaryaction
366
- */
367
- changesSelectionAsPrimaryAction?: boolean;
368
- /**
369
- * Menu for the item.
370
- */
371
- menu: {
372
- /**
373
- * Optional title to show on top of the menu.
374
- */
375
- title?: string;
376
- /**
377
- * Whether multiple items in the submenu can be selected, i.e. in "on" state.
378
- *
379
- * Defaults to `false`.
380
- *
381
- * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/singleselection
382
- */
383
- multiselectable?: boolean;
384
- /**
385
- * How the submenu items are displayed.
386
- * - `default`: menu items are displayed normally.
387
- * - `palette`: menu items are displayed in a horizontal row.
388
- *
389
- * Defaults to `default`.
390
- *
391
- * Read more: https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette
392
- */
393
- layout?: 'default' | 'palette';
394
- /**
395
- * Array of menu items (actions or submenus).
396
- */
397
- items: (
398
- | NativeScreenHeaderItemMenuAction
399
- | NativeScreenHeaderItemMenuSubmenu
400
- )[];
401
- };
402
- };
403
-
404
- /**
405
- * An item to add spacing between other items in the header.
406
- */
407
- export type NativeScreenHeaderItemSpacing = {
408
- type: 'spacing';
409
- /**
410
- * The amount of spacing to add.
411
- */
412
- spacing: number;
413
- };
414
-
415
- /**
416
- * A custom item to display any React Element in the header.
417
- */
418
- export type NativeScreenHeaderItemCustom = {
419
- type: 'custom';
420
- /**
421
- * A React Element to display as the item.
422
- */
423
- element: React.ReactElement;
424
- /**
425
- * Whether the background this item may share with other items in the bar should be hidden.
426
- * Only available from iOS 26.0 and later.
427
- *
428
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground
429
- */
430
- hidesSharedBackground?: boolean;
431
- };
432
-
433
- /**
434
- * An item that can be displayed in the header.
435
- * It can be a button, a menu, spacing, or a custom element.
436
- *
437
- * On iOS 26, when showing items on the right side of the header,
438
- * if the items don't fit the available space, they will be collapsed into a menu automatically.
439
- * Items with `type: 'custom'` will not be included in this automatic collapsing behavior.
440
- */
441
- export type NativeScreenHeaderItem =
442
- | NativeScreenHeaderItemButton
443
- | NativeScreenHeaderItemMenu
444
- | NativeScreenHeaderItemSpacing
445
- | NativeScreenHeaderItemCustom;
446
-
447
- type IconImage = {
448
- /**
449
- * - `image` - Use a local image as the icon.
450
- */
451
- type: 'image';
452
- /**
453
- * Image source to use as the icon.
454
- * e.g., `require('./path/to/image.png')`
455
- */
456
- source: ImageSourcePropType;
457
- /**
458
- * Whether to apply tint color to the icon.
459
- * Defaults to `true`.
460
- *
461
- * @platform ios
462
- */
463
- tinted?: boolean;
464
- };
465
-
466
- type IconIOSSfSymbol = {
467
- /**
468
- * - `sfSymbol` - Use an SF Symbol as the icon on iOS.
469
- */
470
- type: 'sfSymbol';
471
- /**
472
- * Name of the SF Symbol to use as the icon.
473
- *
474
- * @platform ios
475
- */
476
- name: SFSymbol;
477
- };
478
-
479
- type IconIOS = IconIOSSfSymbol | IconImage;
480
-
481
- type SharedHeaderItem = {
482
- /**
483
- * Label of the item.
484
- */
485
- label: string;
486
- /**
487
- * Style for the item label.
488
- */
489
- labelStyle?: {
490
- fontFamily?: string;
491
- fontSize?: number;
492
- fontWeight?: string;
493
- color?: ColorValue;
494
- };
495
- /**
496
- * Icon for the item
497
- */
498
- icon?: IconIOS;
499
- /**
500
- * The variant of the item.
501
- * "prominent" only available from iOS 26.0 and later.
502
- *
503
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/style-swift.property
504
- */
505
- variant?: 'plain' | 'done' | 'prominent';
506
- /**
507
- * The tint color to apply to the item.
508
- *
509
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor
510
- */
511
- tintColor?: ColorValue;
512
- /**
513
- * Whether the item is in a disabled state.
514
- */
515
- disabled?: boolean;
516
- /**
517
- * The width of the item.
518
- *
519
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/width
520
- */
521
- width?: number;
522
- /**
523
- * Whether the background this item may share with other items in the bar should be hidden.
524
- * Only available from iOS 26.0 and later.
525
- *
526
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground
527
- */
528
- hidesSharedBackground?: boolean;
529
- /**
530
- * Whether this item can share a background with other items.
531
- * Only available from iOS 26.0 and later.
532
- *
533
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/sharesbackground
534
- */
535
- sharesBackground?: boolean;
536
- /**
537
- * An identifier used to match items across transitions.
538
- * Only available from iOS 26.0 and later.
539
- *
540
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitem/identifier
541
- */
542
- identifier?: string;
543
- /**
544
- * A badge to display on a item.
545
- * Only available from iOS 26.0 and later.
546
- *
547
- * Read more: https://developer.apple.com/documentation/uikit/uibarbuttonitembadge
548
- */
549
- badge?: {
550
- /**
551
- * The text to display in the badge.
552
- */
553
- value: number | string;
554
- /**
555
- * Style of the badge.
556
- */
557
- style?: {
558
- color?: ColorValue;
559
- backgroundColor?: ColorValue;
560
- fontFamily?: string;
561
- fontSize?: number;
562
- fontWeight?: string;
563
- };
564
- };
565
- /**
566
- * Accessibility label for the item.
567
- */
568
- accessibilityLabel?: string;
569
- /**
570
- * Accessibility hint for the item.
571
- */
572
- accessibilityHint?: string;
573
- };
@@ -1,18 +0,0 @@
1
- import * as React from 'react';
2
- import type { Animated } from 'react-native';
3
-
4
- export const AnimatedHeaderHeightContext = React.createContext<
5
- Animated.AnimatedInterpolation<number> | undefined
6
- >(undefined);
7
-
8
- export function useAnimatedHeaderHeight() {
9
- const animatedValue = React.useContext(AnimatedHeaderHeightContext);
10
-
11
- if (animatedValue === undefined) {
12
- throw new Error(
13
- "Couldn't find the header height. Are you inside a screen in a native stack navigator?"
14
- );
15
- }
16
-
17
- return animatedValue;
18
- }