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