@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,385 @@
1
+ import type {
2
+ DefaultNavigatorOptions,
3
+ Descriptor,
4
+ NavigationHelpers,
5
+ NavigationProp,
6
+ ParamListBase,
7
+ RouteProp,
8
+ TabActionHelpers,
9
+ TabNavigationState,
10
+ TabRouterOptions,
11
+ Theme,
12
+ } from '@react-navigation/native';
13
+ import type { ColorValue, ImageSourcePropType, TextStyle } from 'react-native';
14
+ import type { EdgeInsets } from 'react-native-safe-area-context';
15
+ import type {
16
+ BottomTabsScreenBlurEffect,
17
+ BottomTabsSystemItem,
18
+ TabBarControllerMode,
19
+ TabBarItemLabelVisibilityMode,
20
+ TabBarMinimizeBehavior,
21
+ } from 'react-native-screens';
22
+ import type { SFSymbol } from 'sf-symbols-typescript';
23
+
24
+ import type { NativeHeaderOptions } from './NativeScreen/types';
25
+
26
+ export type Layout = { width: number; height: number };
27
+
28
+ export type NativeBottomTabNavigationEventMap = {
29
+ /**
30
+ * Event which fires on tapping on the tab in the tab bar.
31
+ */
32
+ tabPress: { data: undefined; canPreventDefault: true };
33
+ /**
34
+ * Event which fires when a transition animation starts.
35
+ */
36
+ transitionStart: { data: { closing: boolean } };
37
+ /**
38
+ * Event which fires when a transition animation ends.
39
+ */
40
+ transitionEnd: { data: { closing: boolean } };
41
+ };
42
+
43
+ export type NativeBottomTabNavigationProp<
44
+ ParamList extends ParamListBase,
45
+ RouteName extends keyof ParamList = keyof ParamList,
46
+ NavigatorID extends string | undefined = undefined,
47
+ > = NavigationProp<
48
+ ParamList,
49
+ RouteName,
50
+ NavigatorID,
51
+ TabNavigationState<ParamList>,
52
+ NativeBottomTabNavigationOptions,
53
+ NativeBottomTabNavigationEventMap
54
+ > &
55
+ TabActionHelpers<ParamList>;
56
+
57
+ export type NativeBottomTabScreenProps<
58
+ ParamList extends ParamListBase,
59
+ RouteName extends keyof ParamList = keyof ParamList,
60
+ NavigatorID extends string | undefined = undefined,
61
+ > = {
62
+ navigation: NativeBottomTabNavigationProp<ParamList, RouteName, NavigatorID>;
63
+ route: RouteProp<ParamList, RouteName>;
64
+ };
65
+
66
+ export type NativeBottomTabOptionsArgs<
67
+ ParamList extends ParamListBase,
68
+ RouteName extends keyof ParamList = keyof ParamList,
69
+ NavigatorID extends string | undefined = undefined,
70
+ > = NativeBottomTabScreenProps<ParamList, RouteName, NavigatorID> & {
71
+ theme: Theme;
72
+ };
73
+
74
+ type IconImage = {
75
+ /**
76
+ * - `image` - Use a local image as the icon.
77
+ */
78
+ type: 'image';
79
+ /**
80
+ * Image source to use as the icon.
81
+ * e.g., `require('./path/to/image.png')`
82
+ */
83
+ source: ImageSourcePropType;
84
+ /**
85
+ * Whether to apply tint color to the icon.
86
+ * Defaults to `true`.
87
+ *
88
+ * @platform ios
89
+ */
90
+ tinted?: boolean;
91
+ };
92
+
93
+ type IconIOSSfSymbol = {
94
+ /**
95
+ * - `sfSymbol` - Use an SF Symbol as the icon on iOS.
96
+ */
97
+ type: 'sfSymbol';
98
+ /**
99
+ * Name of the SF Symbol to use as the icon.
100
+ *
101
+ * @platform ios
102
+ */
103
+ name: SFSymbol;
104
+ };
105
+
106
+ type IconAndroidDrawable = {
107
+ /**
108
+ * - `drawableResource` - Use a drawable resource as the icon on Android.
109
+ */
110
+ type: 'drawableResource';
111
+ /**
112
+ * Name of the drawable resource to use as the icon.
113
+ *
114
+ * @platform android
115
+ */
116
+ name: string;
117
+ };
118
+
119
+ type IconIOS = IconIOSSfSymbol | IconImage;
120
+
121
+ type IconAndroid = IconAndroidDrawable | IconImage;
122
+
123
+ export type Icon = IconIOS | IconAndroid;
124
+
125
+ export type NativeBottomTabNavigationOptions = NativeHeaderOptions & {
126
+ /**
127
+ * Title text for the screen.
128
+ */
129
+ title?: string;
130
+
131
+ /**
132
+ * Uses iOS built-in tab bar items with standard iOS styling and localized titles.
133
+ * If set to `search`, it's positioned next to the tab bar on iOS 26 and above.
134
+ *
135
+ * The `tabBarIcon` and `tabBarLabel` options will override the icon and label from the system item.
136
+ * If you want to keep the system behavior on iOS, but need to provide icon and label for other platforms,
137
+ * Use `Platform.OS` or `Platform.select` to conditionally set `undefined` for `tabBarIcon` and `tabBarLabel` on iOS.
138
+ *
139
+ * @platform ios
140
+ */
141
+ tabBarSystemItem?: BottomTabsSystemItem;
142
+
143
+ /**
144
+ * Title string of the tab displayed in the tab bar
145
+ *
146
+ * Overrides the label provided by `tabBarSystemItem` on iOS.
147
+ *
148
+ * If not provided, or set to `undefined`:
149
+ * - The system values are used if `tabBarSystemItem` is set on iOS.
150
+ * - Otherwise, it falls back to the `title` or route name.
151
+ */
152
+ tabBarLabel?: string;
153
+
154
+ /**
155
+ * Label visibility mode for the tab bar items.
156
+ *
157
+ * The following values are currently supported:
158
+ *
159
+ * - `auto` - the system decides when to show or hide labels
160
+ * - `selected` - labels are shown only for the selected tab
161
+ * - `labeled` - labels are always shown
162
+ * - `unlabeled` - labels are never shown
163
+ *
164
+ * Defaults to `auto`.
165
+ *
166
+ * @platform android
167
+ */
168
+ tabBarLabelVisibilityMode?: TabBarItemLabelVisibilityMode;
169
+
170
+ /**
171
+ * Style object for the tab label.
172
+ */
173
+ tabBarLabelStyle?: Pick<
174
+ TextStyle,
175
+ 'fontFamily' | 'fontSize' | 'fontWeight' | 'fontStyle'
176
+ >;
177
+
178
+ /**
179
+ * Icon to display for the tab.
180
+ *
181
+ * Showing a different icon for focused tab is only supported on iOS.
182
+ *
183
+ * Overrides the icon provided by `tabBarSystemItem` on iOS.
184
+ */
185
+ tabBarIcon?: Icon | ((props: { focused: boolean }) => Icon);
186
+
187
+ /**
188
+ * Text to show in a badge on the tab icon.
189
+ */
190
+ tabBarBadge?: number | string;
191
+
192
+ /**
193
+ * Custom style for the tab bar badge.
194
+ * You can specify a background color or text color here.
195
+ *
196
+ * @platform android
197
+ */
198
+ tabBarBadgeStyle?: {
199
+ backgroundColor?: ColorValue;
200
+ color?: ColorValue;
201
+ };
202
+
203
+ /**
204
+ * Color for the icon and label in the active tab.
205
+ */
206
+ tabBarActiveTintColor?: ColorValue;
207
+
208
+ /**
209
+ * Color for the icon and label in the inactive tabs.
210
+ *
211
+ * @platform android
212
+ */
213
+ tabBarInactiveTintColor?: ColorValue;
214
+
215
+ /**
216
+ * Background color of the active indicator.
217
+ *
218
+ * @platform android
219
+ */
220
+ tabBarActiveIndicatorColor?: ColorValue;
221
+
222
+ /**
223
+ * Specifies if the active indicator should be used. Defaults to `true`.
224
+ *
225
+ * @platform android
226
+ */
227
+ tabBarActiveIndicatorEnabled?: boolean;
228
+
229
+ /**
230
+ * Color of tab bar item's ripple effect.
231
+ *
232
+ * @platform android
233
+ */
234
+ tabBarRippleColor?: ColorValue;
235
+
236
+ /**
237
+ * Style object for the tab bar container.
238
+ */
239
+ tabBarStyle?: {
240
+ /**
241
+ * Background color of the tab bar.
242
+ *
243
+ * Only supported on Android and iOS 18 and below.
244
+ */
245
+ backgroundColor?: ColorValue;
246
+ /**
247
+ * Shadow color of the tab bar.
248
+ *
249
+ * Only supported on iOS 18 and below.
250
+ */
251
+ shadowColor?: ColorValue;
252
+ };
253
+
254
+ /**
255
+ * Blur effect applied to the tab bar when tab screen is selected.
256
+ *
257
+ * Works with backgroundColor's alpha < 1.
258
+ *
259
+ * Only supported on iOS 18 and lower.
260
+ *
261
+ * The following values are currently supported:
262
+ *
263
+ * - `none` - disables blur effect
264
+ * - `systemDefault` - uses UIKit's default tab bar blur effect
265
+ * - one of styles mapped from UIKit's UIBlurEffectStyle, e.g. `systemUltraThinMaterial`
266
+ *
267
+ * Defaults to `systemDefault`.
268
+ *
269
+ * Complete list of possible blur effect styles is available in the official UIKit documentation:
270
+ * @see {@link https://developer.apple.com/documentation/uikit/uiblureffect/style|UIBlurEffect.Style}
271
+ *
272
+ * @platform ios
273
+ */
274
+ tabBarBlurEffect?: BottomTabsScreenBlurEffect;
275
+
276
+ /**
277
+ * Display mode for the tab bar.
278
+ *
279
+ * Available starting from iOS 18.
280
+ * Not supported on tvOS.
281
+ *
282
+ * The following values are currently supported:
283
+ *
284
+ * - `auto` - the system sets the display mode based on the tab’s content
285
+ * - `tabBar` - the system displays the content only as a tab bar
286
+ * - `tabSidebar` - the tab bar is displayed as a sidebar
287
+ *
288
+ * Defaults to `auto`.
289
+ *
290
+ * @see {@link https://developer.apple.com/documentation/uikit/uitabbarcontroller/mode|UITabBarController.Mode}
291
+ *
292
+ * @platform ios
293
+ */
294
+ tabBarControllerMode?: TabBarControllerMode;
295
+
296
+ /**
297
+ * Minimize behavior for the tab bar.
298
+ *
299
+ * Available starting from iOS 26.
300
+ *
301
+ * The following values are currently supported:
302
+ *
303
+ * - `auto` - resolves to the system default minimize behavior
304
+ * - `never` - the tab bar does not minimize
305
+ * - `onScrollDown` - the tab bar minimizes when scrolling down and
306
+ * expands when scrolling back up
307
+ * - `onScrollUp` - the tab bar minimizes when scrolling up and expands
308
+ * when scrolling back down
309
+ *
310
+ * Defaults to `auto`.
311
+ *
312
+ * The supported values correspond to the official UIKit documentation:
313
+ * @see {@link https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior|UITabBarController.MinimizeBehavior}
314
+ *
315
+ * @platform ios
316
+ */
317
+ tabBarMinimizeBehavior?: TabBarMinimizeBehavior;
318
+
319
+ /**
320
+ * Whether this screens should render the first time it's accessed. Defaults to `true`.
321
+ * Set it to `false` if you want to render the screen on initial render.
322
+ */
323
+ lazy?: boolean;
324
+
325
+ /**
326
+ * Whether any nested stack should be popped to top when navigating away from the tab.
327
+ * Defaults to `false`.
328
+ */
329
+ popToTopOnBlur?: boolean;
330
+ };
331
+
332
+ export type NativeBottomTabDescriptor = Descriptor<
333
+ NativeBottomTabNavigationOptions,
334
+ NativeBottomTabNavigationProp<ParamListBase>,
335
+ RouteProp<ParamListBase>
336
+ >;
337
+
338
+ export type NativeBottomTabDescriptorMap = Record<
339
+ string,
340
+ NativeBottomTabDescriptor
341
+ >;
342
+
343
+ export type NativeBottomTabNavigationConfig = {};
344
+
345
+ export type NativeBottomTabBarProps = {
346
+ state: TabNavigationState<ParamListBase>;
347
+ descriptors: NativeBottomTabDescriptorMap;
348
+ navigation: NavigationHelpers<
349
+ ParamListBase,
350
+ NativeBottomTabNavigationEventMap
351
+ >;
352
+ insets: EdgeInsets;
353
+ };
354
+
355
+ export type NativeBottomTabNavigatorProps = DefaultNavigatorOptions<
356
+ ParamListBase,
357
+ string | undefined,
358
+ TabNavigationState<ParamListBase>,
359
+ NativeBottomTabNavigationOptions,
360
+ NativeBottomTabNavigationEventMap,
361
+ NativeBottomTabNavigationProp<ParamListBase>
362
+ > &
363
+ TabRouterOptions &
364
+ NativeBottomTabNavigationConfig;
365
+
366
+ export type NativeBottomTabNavigationHelpers = NavigationHelpers<
367
+ ParamListBase,
368
+ NativeBottomTabNavigationEventMap
369
+ > &
370
+ TabActionHelpers<ParamListBase>;
371
+
372
+ export type NativeBottomTabHeaderProps = {
373
+ /**
374
+ * Options for the current screen.
375
+ */
376
+ options: NativeBottomTabNavigationOptions;
377
+ /**
378
+ * Route object for the current screen.
379
+ */
380
+ route: RouteProp<ParamListBase>;
381
+ /**
382
+ * Navigation prop for the header.
383
+ */
384
+ navigation: NativeBottomTabNavigationProp<ParamListBase>;
385
+ };