@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.
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createBottomTabNavigator.js +27 -9
- package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/module/utils/BottomTabAnimationContext.js +5 -0
- package/lib/module/utils/BottomTabAnimationContext.js.map +1 -0
- package/lib/module/utils/useBottomTabAnimation.js +12 -0
- package/lib/module/utils/useBottomTabAnimation.js.map +1 -0
- package/lib/module/utils/useTabBarPosition.js +34 -0
- package/lib/module/utils/useTabBarPosition.js.map +1 -0
- package/lib/module/views/BottomTabBar.js +46 -49
- package/lib/module/views/BottomTabBar.js.map +1 -1
- package/lib/module/views/BottomTabItem.js +17 -15
- package/lib/module/views/BottomTabItem.js.map +1 -1
- package/lib/module/views/BottomTabViewCommon.js +16 -0
- package/lib/module/views/BottomTabViewCommon.js.map +1 -0
- package/lib/module/views/{BottomTabView.js → BottomTabViewCustom.js} +107 -106
- package/lib/module/views/BottomTabViewCustom.js.map +1 -0
- package/lib/module/views/BottomTabViewNative.android.js +4 -0
- package/lib/module/views/BottomTabViewNative.android.js.map +1 -0
- package/lib/module/views/BottomTabViewNative.ios.js +4 -0
- package/lib/module/views/BottomTabViewNative.ios.js.map +1 -0
- package/lib/module/views/BottomTabViewNative.js +5 -0
- package/lib/module/views/BottomTabViewNative.js.map +1 -0
- package/lib/module/{unstable/NativeBottomTabView.native.js → views/BottomTabViewNativeImpl.js} +95 -77
- package/lib/module/views/BottomTabViewNativeImpl.js.map +1 -0
- package/lib/module/views/ScreenContent.js +39 -0
- package/lib/module/views/ScreenContent.js.map +1 -0
- package/lib/module/views/TabBarIcon.js +40 -4
- package/lib/module/views/TabBarIcon.js.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +10 -6
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +383 -115
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/BottomTabAnimationContext.d.ts +4 -0
- package/lib/typescript/src/utils/BottomTabAnimationContext.d.ts.map +1 -0
- package/lib/typescript/src/utils/useBottomTabAnimation.d.ts +2 -0
- package/lib/typescript/src/utils/useBottomTabAnimation.d.ts.map +1 -0
- package/lib/typescript/src/utils/useTabBarPosition.d.ts +3 -0
- package/lib/typescript/src/utils/useTabBarPosition.d.ts.map +1 -0
- package/lib/typescript/src/views/BottomTabBar.d.ts +4 -4
- package/lib/typescript/src/views/BottomTabBar.d.ts.map +1 -1
- package/lib/typescript/src/views/BottomTabItem.d.ts +16 -14
- package/lib/typescript/src/views/BottomTabItem.d.ts.map +1 -1
- package/lib/typescript/src/views/{BottomTabView.d.ts → BottomTabViewCommon.d.ts} +2 -2
- package/lib/typescript/src/views/BottomTabViewCommon.d.ts.map +1 -0
- package/lib/typescript/src/views/BottomTabViewCustom.d.ts +10 -0
- package/lib/typescript/src/views/BottomTabViewCustom.d.ts.map +1 -0
- package/lib/typescript/src/views/BottomTabViewNative.android.d.ts +2 -0
- package/lib/typescript/src/views/BottomTabViewNative.android.d.ts.map +1 -0
- package/lib/typescript/src/views/BottomTabViewNative.d.ts +3 -0
- package/lib/typescript/src/views/BottomTabViewNative.d.ts.map +1 -0
- package/lib/typescript/src/views/BottomTabViewNative.ios.d.ts +2 -0
- package/lib/typescript/src/views/BottomTabViewNative.ios.d.ts.map +1 -0
- package/lib/typescript/src/views/BottomTabViewNativeImpl.d.ts +10 -0
- package/lib/typescript/src/views/BottomTabViewNativeImpl.d.ts.map +1 -0
- package/lib/typescript/src/views/ScreenContent.d.ts +13 -0
- package/lib/typescript/src/views/ScreenContent.d.ts.map +1 -0
- package/lib/typescript/src/views/TabBarIcon.d.ts +9 -9
- package/lib/typescript/src/views/TabBarIcon.d.ts.map +1 -1
- package/package.json +11 -16
- package/src/index.tsx +7 -2
- package/src/navigators/createBottomTabNavigator.tsx +78 -27
- package/src/types.tsx +417 -122
- package/src/utils/BottomTabAnimationContext.tsx +7 -0
- package/src/utils/useBottomTabAnimation.tsx +15 -0
- package/src/utils/useTabBarPosition.tsx +41 -0
- package/src/views/BottomTabBar.tsx +68 -67
- package/src/views/BottomTabItem.tsx +39 -34
- package/src/views/BottomTabViewCommon.tsx +26 -0
- package/src/views/{BottomTabView.tsx → BottomTabViewCustom.tsx} +142 -129
- package/src/views/BottomTabViewNative.android.tsx +1 -0
- package/src/views/BottomTabViewNative.ios.tsx +1 -0
- package/src/views/BottomTabViewNative.tsx +3 -0
- package/src/{unstable/NativeBottomTabView.native.tsx → views/BottomTabViewNativeImpl.tsx} +139 -116
- package/src/views/ScreenContent.tsx +58 -0
- package/src/views/TabBarIcon.tsx +63 -10
- package/lib/module/unstable/NativeBottomTabView.js +0 -6
- package/lib/module/unstable/NativeBottomTabView.js.map +0 -1
- package/lib/module/unstable/NativeBottomTabView.native.js.map +0 -1
- package/lib/module/unstable/NativeScreen/NativeScreen.js +0 -152
- package/lib/module/unstable/NativeScreen/NativeScreen.js.map +0 -1
- package/lib/module/unstable/NativeScreen/debounce.js +0 -12
- package/lib/module/unstable/NativeScreen/debounce.js.map +0 -1
- package/lib/module/unstable/NativeScreen/types.js +0 -4
- package/lib/module/unstable/NativeScreen/types.js.map +0 -1
- package/lib/module/unstable/NativeScreen/useAnimatedHeaderHeight.js +0 -12
- package/lib/module/unstable/NativeScreen/useAnimatedHeaderHeight.js.map +0 -1
- package/lib/module/unstable/NativeScreen/useHeaderConfig.js +0 -304
- package/lib/module/unstable/NativeScreen/useHeaderConfig.js.map +0 -1
- package/lib/module/unstable/createNativeBottomTabNavigator.js +0 -6
- package/lib/module/unstable/createNativeBottomTabNavigator.js.map +0 -1
- package/lib/module/unstable/createNativeBottomTabNavigator.native.js +0 -65
- package/lib/module/unstable/createNativeBottomTabNavigator.native.js.map +0 -1
- package/lib/module/unstable/index.js +0 -16
- package/lib/module/unstable/index.js.map +0 -1
- package/lib/module/unstable/types.js +0 -4
- package/lib/module/unstable/types.js.map +0 -1
- package/lib/module/views/BottomTabView.js.map +0 -1
- package/lib/module/views/ScreenFallback.js +0 -42
- package/lib/module/views/ScreenFallback.js.map +0 -1
- package/lib/typescript/src/unstable/NativeBottomTabView.d.ts +0 -10
- package/lib/typescript/src/unstable/NativeBottomTabView.d.ts.map +0 -1
- package/lib/typescript/src/unstable/NativeBottomTabView.native.d.ts +0 -10
- package/lib/typescript/src/unstable/NativeBottomTabView.native.d.ts.map +0 -1
- package/lib/typescript/src/unstable/NativeScreen/NativeScreen.d.ts +0 -8
- package/lib/typescript/src/unstable/NativeScreen/NativeScreen.d.ts.map +0 -1
- package/lib/typescript/src/unstable/NativeScreen/debounce.d.ts +0 -2
- package/lib/typescript/src/unstable/NativeScreen/debounce.d.ts.map +0 -1
- package/lib/typescript/src/unstable/NativeScreen/types.d.ts +0 -523
- package/lib/typescript/src/unstable/NativeScreen/types.d.ts.map +0 -1
- package/lib/typescript/src/unstable/NativeScreen/useAnimatedHeaderHeight.d.ts +0 -5
- package/lib/typescript/src/unstable/NativeScreen/useAnimatedHeaderHeight.d.ts.map +0 -1
- package/lib/typescript/src/unstable/NativeScreen/useHeaderConfig.d.ts +0 -11
- package/lib/typescript/src/unstable/NativeScreen/useHeaderConfig.d.ts.map +0 -1
- package/lib/typescript/src/unstable/createNativeBottomTabNavigator.d.ts +0 -2
- package/lib/typescript/src/unstable/createNativeBottomTabNavigator.d.ts.map +0 -1
- package/lib/typescript/src/unstable/createNativeBottomTabNavigator.native.d.ts +0 -16
- package/lib/typescript/src/unstable/createNativeBottomTabNavigator.native.d.ts.map +0 -1
- package/lib/typescript/src/unstable/index.d.ts +0 -13
- package/lib/typescript/src/unstable/index.d.ts.map +0 -1
- package/lib/typescript/src/unstable/types.d.ts +0 -319
- package/lib/typescript/src/unstable/types.d.ts.map +0 -1
- package/lib/typescript/src/views/BottomTabView.d.ts.map +0 -1
- package/lib/typescript/src/views/ScreenFallback.d.ts +0 -18
- package/lib/typescript/src/views/ScreenFallback.d.ts.map +0 -1
- package/src/unstable/NativeBottomTabView.tsx +0 -20
- package/src/unstable/NativeScreen/NativeScreen.tsx +0 -212
- package/src/unstable/NativeScreen/debounce.tsx +0 -14
- package/src/unstable/NativeScreen/types.ts +0 -573
- package/src/unstable/NativeScreen/useAnimatedHeaderHeight.tsx +0 -18
- package/src/unstable/NativeScreen/useHeaderConfig.tsx +0 -434
- package/src/unstable/createNativeBottomTabNavigator.native.tsx +0 -116
- package/src/unstable/createNativeBottomTabNavigator.tsx +0 -4
- package/src/unstable/index.tsx +0 -23
- package/src/unstable/types.tsx +0 -405
- package/src/views/ScreenFallback.tsx +0 -50
package/src/types.tsx
CHANGED
|
@@ -17,24 +17,36 @@ import type {
|
|
|
17
17
|
import type * as React from 'react';
|
|
18
18
|
import type {
|
|
19
19
|
Animated,
|
|
20
|
+
ColorValue,
|
|
20
21
|
GestureResponderEvent,
|
|
22
|
+
ImageSourcePropType,
|
|
21
23
|
StyleProp,
|
|
22
24
|
TextStyle,
|
|
23
25
|
ViewStyle,
|
|
24
26
|
} from 'react-native';
|
|
25
|
-
import type {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
import type {
|
|
28
|
+
BottomTabsScreenBlurEffect,
|
|
29
|
+
BottomTabsSystemItem,
|
|
30
|
+
ScrollEdgeEffect,
|
|
31
|
+
TabBarControllerMode,
|
|
32
|
+
TabBarItemLabelVisibilityMode,
|
|
33
|
+
TabBarMinimizeBehavior,
|
|
34
|
+
} from 'react-native-screens';
|
|
35
|
+
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
28
36
|
|
|
29
37
|
export type Variant = 'uikit' | 'material';
|
|
30
38
|
|
|
31
39
|
export type BottomTabNavigationEventMap = {
|
|
32
40
|
/**
|
|
33
41
|
* Event which fires on tapping on the tab in the tab bar.
|
|
42
|
+
*
|
|
43
|
+
* Preventing default is only supported with `custom` implementation.
|
|
34
44
|
*/
|
|
35
45
|
tabPress: { data: undefined; canPreventDefault: true };
|
|
36
46
|
/**
|
|
37
47
|
* Event which fires on long press on the tab in the tab bar.
|
|
48
|
+
*
|
|
49
|
+
* Only supported with `custom` implementation.
|
|
38
50
|
*/
|
|
39
51
|
tabLongPress: { data: undefined };
|
|
40
52
|
/**
|
|
@@ -58,31 +70,27 @@ export type BottomTabNavigationHelpers = NavigationHelpers<
|
|
|
58
70
|
export type BottomTabNavigationProp<
|
|
59
71
|
ParamList extends ParamListBase,
|
|
60
72
|
RouteName extends keyof ParamList = keyof ParamList,
|
|
61
|
-
NavigatorID extends string | undefined = undefined,
|
|
62
73
|
> = NavigationProp<
|
|
63
74
|
ParamList,
|
|
64
75
|
RouteName,
|
|
65
|
-
NavigatorID,
|
|
66
76
|
TabNavigationState<ParamList>,
|
|
67
77
|
BottomTabNavigationOptions,
|
|
68
|
-
BottomTabNavigationEventMap
|
|
69
|
-
>
|
|
70
|
-
|
|
78
|
+
BottomTabNavigationEventMap,
|
|
79
|
+
TabActionHelpers<ParamList>
|
|
80
|
+
>;
|
|
71
81
|
|
|
72
82
|
export type BottomTabScreenProps<
|
|
73
83
|
ParamList extends ParamListBase,
|
|
74
84
|
RouteName extends keyof ParamList = keyof ParamList,
|
|
75
|
-
NavigatorID extends string | undefined = undefined,
|
|
76
85
|
> = {
|
|
77
|
-
navigation: BottomTabNavigationProp<ParamList, RouteName
|
|
86
|
+
navigation: BottomTabNavigationProp<ParamList, RouteName>;
|
|
78
87
|
route: RouteProp<ParamList, RouteName>;
|
|
79
88
|
};
|
|
80
89
|
|
|
81
90
|
export type BottomTabOptionsArgs<
|
|
82
91
|
ParamList extends ParamListBase,
|
|
83
92
|
RouteName extends keyof ParamList = keyof ParamList,
|
|
84
|
-
|
|
85
|
-
> = BottomTabScreenProps<ParamList, RouteName, NavigatorID> & {
|
|
93
|
+
> = BottomTabScreenProps<ParamList, RouteName> & {
|
|
86
94
|
theme: Theme;
|
|
87
95
|
};
|
|
88
96
|
|
|
@@ -108,31 +116,83 @@ export type TabBarVisibilityAnimationConfig =
|
|
|
108
116
|
|
|
109
117
|
export type TabAnimationName = 'none' | 'fade' | 'shift';
|
|
110
118
|
|
|
111
|
-
|
|
119
|
+
type IconImage = {
|
|
112
120
|
/**
|
|
113
|
-
*
|
|
121
|
+
* - `image` - Use a local image as the icon.
|
|
114
122
|
*/
|
|
115
|
-
|
|
123
|
+
type: 'image';
|
|
124
|
+
/**
|
|
125
|
+
* Image source to use as the icon.
|
|
126
|
+
* e.g., `require('./path/to/image.png')`
|
|
127
|
+
*/
|
|
128
|
+
source: ImageSourcePropType;
|
|
129
|
+
/**
|
|
130
|
+
* Whether to apply tint color to the icon.
|
|
131
|
+
* Defaults to `true`.
|
|
132
|
+
*
|
|
133
|
+
* @platform ios
|
|
134
|
+
*/
|
|
135
|
+
tinted?: boolean;
|
|
136
|
+
};
|
|
116
137
|
|
|
138
|
+
type IconIOSSfSymbol = {
|
|
117
139
|
/**
|
|
118
|
-
*
|
|
119
|
-
|
|
140
|
+
* - `sfSymbol` - Use an SF Symbol as the icon on iOS.
|
|
141
|
+
*/
|
|
142
|
+
type: 'sfSymbol';
|
|
143
|
+
/**
|
|
144
|
+
* Name of the SF Symbol to use as the icon.
|
|
120
145
|
*
|
|
121
|
-
*
|
|
146
|
+
* @platform ios
|
|
122
147
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
| ((props: {
|
|
126
|
-
focused: boolean;
|
|
127
|
-
color: string;
|
|
128
|
-
position: LabelPosition;
|
|
129
|
-
children: string;
|
|
130
|
-
}) => React.ReactNode);
|
|
148
|
+
name: SFSymbol;
|
|
149
|
+
};
|
|
131
150
|
|
|
151
|
+
type IconAndroidDrawable = {
|
|
132
152
|
/**
|
|
133
|
-
*
|
|
153
|
+
* - `drawableResource` - Use a drawable resource as the icon on Android.
|
|
134
154
|
*/
|
|
135
|
-
|
|
155
|
+
type: 'drawableResource';
|
|
156
|
+
/**
|
|
157
|
+
* Name of the drawable resource to use as the icon.
|
|
158
|
+
*
|
|
159
|
+
* @platform android
|
|
160
|
+
*/
|
|
161
|
+
name: string;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
type IconIOS = IconIOSSfSymbol | IconImage;
|
|
165
|
+
|
|
166
|
+
type IconAndroid = IconAndroidDrawable | IconImage;
|
|
167
|
+
|
|
168
|
+
export type BottomTabIcon = IconIOS | IconAndroid;
|
|
169
|
+
|
|
170
|
+
type BottomTabCustomOptions = {
|
|
171
|
+
/**
|
|
172
|
+
* How the screen should animate when switching tabs.
|
|
173
|
+
*
|
|
174
|
+
* Supported values:
|
|
175
|
+
* - 'none': don't animate the screen (default)
|
|
176
|
+
* - 'fade': cross-fade the screens.
|
|
177
|
+
* - 'shift': shift the screens slightly shift to left/right.
|
|
178
|
+
*
|
|
179
|
+
* Only supported with `custom` implementation.
|
|
180
|
+
*/
|
|
181
|
+
animation?: TabAnimationName;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Function which specifies interpolated styles for bottom-tab scenes.
|
|
185
|
+
*
|
|
186
|
+
* Only supported with `custom` implementation.
|
|
187
|
+
*/
|
|
188
|
+
sceneStyleInterpolator?: BottomTabSceneStyleInterpolator;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Object which specifies the animation type (timing or spring) and their options (such as duration for timing).
|
|
192
|
+
*
|
|
193
|
+
* Only supported with `custom` implementation.
|
|
194
|
+
*/
|
|
195
|
+
transitionSpec?: TransitionSpec;
|
|
136
196
|
|
|
137
197
|
/**
|
|
138
198
|
* Whether the label is shown below the icon or beside the icon.
|
|
@@ -141,180 +201,414 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
|
|
141
201
|
* - `beside-icon` the label is shown next to the icon (typical for iPad)
|
|
142
202
|
*
|
|
143
203
|
* By default, the position is chosen automatically based on device width.
|
|
204
|
+
*
|
|
205
|
+
* Only supported with `custom` implementation.
|
|
144
206
|
*/
|
|
145
207
|
tabBarLabelPosition?: LabelPosition;
|
|
146
208
|
|
|
147
209
|
/**
|
|
148
|
-
*
|
|
210
|
+
* Whether label font should scale to respect Text Size accessibility settings.
|
|
211
|
+
*
|
|
212
|
+
* Defaults to `true`.
|
|
213
|
+
*
|
|
214
|
+
* Only supported with `custom` implementation.
|
|
149
215
|
*/
|
|
150
|
-
|
|
216
|
+
tabBarAllowFontScaling?: boolean;
|
|
151
217
|
|
|
152
218
|
/**
|
|
153
|
-
*
|
|
219
|
+
* Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.
|
|
220
|
+
* It's recommended to set this if you don't have a label for the tab.
|
|
221
|
+
*
|
|
222
|
+
* Only supported with `custom` implementation.
|
|
154
223
|
*/
|
|
155
|
-
|
|
224
|
+
tabBarAccessibilityLabel?: string;
|
|
156
225
|
|
|
157
226
|
/**
|
|
158
|
-
*
|
|
227
|
+
* ID to locate this tab button in tests.
|
|
228
|
+
*
|
|
229
|
+
* Only supported with `custom` implementation.
|
|
159
230
|
*/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
231
|
+
tabBarButtonTestID?: string;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Style object for the tab item container.
|
|
235
|
+
*
|
|
236
|
+
* Only supported with `custom` implementation.
|
|
237
|
+
*/
|
|
238
|
+
tabBarItemStyle?: StyleProp<ViewStyle>;
|
|
165
239
|
|
|
166
240
|
/**
|
|
167
241
|
* Style object for the tab icon.
|
|
242
|
+
*
|
|
243
|
+
* Only supported with `custom` implementation.
|
|
168
244
|
*/
|
|
169
245
|
tabBarIconStyle?: StyleProp<TextStyle>;
|
|
170
246
|
|
|
171
247
|
/**
|
|
172
|
-
*
|
|
248
|
+
* Whether the tab bar gets hidden when the keyboard is shown.
|
|
249
|
+
*
|
|
250
|
+
* Defaults to `false`.
|
|
251
|
+
*
|
|
252
|
+
* Only supported with `custom` implementation.
|
|
173
253
|
*/
|
|
174
|
-
|
|
254
|
+
tabBarHideOnKeyboard?: boolean;
|
|
175
255
|
|
|
176
256
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
257
|
+
* Animation config for showing and hiding the tab bar when the keyboard is shown/hidden.
|
|
258
|
+
*
|
|
259
|
+
* Only supported with `custom` implementation.
|
|
179
260
|
*/
|
|
180
|
-
|
|
261
|
+
tabBarVisibilityAnimationConfig?: {
|
|
262
|
+
show?: TabBarVisibilityAnimationConfig;
|
|
263
|
+
hide?: TabBarVisibilityAnimationConfig;
|
|
264
|
+
};
|
|
181
265
|
|
|
182
266
|
/**
|
|
183
|
-
*
|
|
184
|
-
*
|
|
267
|
+
* Variant of the tab bar. Defaults to `uikit`.
|
|
268
|
+
*
|
|
269
|
+
* Only supported with `custom` implementation.
|
|
185
270
|
*/
|
|
186
|
-
|
|
271
|
+
tabBarVariant?: Variant;
|
|
187
272
|
|
|
188
273
|
/**
|
|
189
|
-
*
|
|
274
|
+
* Style object for the tab bar container.
|
|
275
|
+
*
|
|
276
|
+
* Only supported with `custom` implementation.
|
|
190
277
|
*/
|
|
191
|
-
|
|
278
|
+
tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Function which returns a React Element to use as background for the tab bar.
|
|
282
|
+
* You could render an image, a gradient, blur view etc.
|
|
283
|
+
*
|
|
284
|
+
* When using `BlurView`, make sure to set `position: 'absolute'` in `tabBarStyle` as well.
|
|
285
|
+
* You'd also need to use `useBottomTabBarHeight()` to add a bottom padding to your content.
|
|
286
|
+
*
|
|
287
|
+
* Only supported with `custom` implementation.
|
|
288
|
+
*/
|
|
289
|
+
tabBarBackground?: () => React.ReactNode;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Position of the tab bar on the screen. Defaults to `bottom`.
|
|
293
|
+
*
|
|
294
|
+
* Only supported with `custom` implementation or if custom tab bar is provided.
|
|
295
|
+
*/
|
|
296
|
+
tabBarPosition?: 'bottom' | 'left' | 'right' | 'top';
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Background color for the active tab.
|
|
300
|
+
*
|
|
301
|
+
* Only supported with `custom` implementation.
|
|
302
|
+
*/
|
|
303
|
+
tabBarActiveBackgroundColor?: ColorValue;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Background color for the inactive tabs.
|
|
307
|
+
*
|
|
308
|
+
* Only supported with `custom` implementation.
|
|
309
|
+
*/
|
|
310
|
+
tabBarInactiveBackgroundColor?: ColorValue;
|
|
192
311
|
|
|
193
312
|
/**
|
|
194
313
|
* Function which returns a React element to render as the tab bar button.
|
|
195
314
|
* Renders `PlatformPressable` by default.
|
|
315
|
+
*
|
|
316
|
+
* Only supported with `custom` implementation.
|
|
196
317
|
*/
|
|
197
318
|
tabBarButton?: (props: BottomTabBarButtonProps) => React.ReactNode;
|
|
319
|
+
};
|
|
198
320
|
|
|
321
|
+
type BottomTabNativeOptions = {
|
|
199
322
|
/**
|
|
200
|
-
*
|
|
323
|
+
* Uses iOS built-in tab bar items with standard iOS styling and localized titles.
|
|
324
|
+
* If set to `search`, it's positioned next to the tab bar on iOS 26 and above.
|
|
325
|
+
*
|
|
326
|
+
* The `tabBarIcon` and `tabBarLabel` options will override the icon and label from the system item.
|
|
327
|
+
* If you want to keep the system behavior on iOS, but need to provide icon and label for other platforms,
|
|
328
|
+
* Use `Platform.OS` or `Platform.select` to conditionally set `undefined` for `tabBarIcon` and `tabBarLabel` on iOS.
|
|
329
|
+
*
|
|
330
|
+
* @platform ios
|
|
201
331
|
*/
|
|
202
|
-
|
|
332
|
+
tabBarSystemItem?: BottomTabsSystemItem;
|
|
203
333
|
|
|
204
334
|
/**
|
|
205
|
-
*
|
|
335
|
+
* Blur effect applied to the tab bar when tab screen is selected.
|
|
336
|
+
*
|
|
337
|
+
* Works with backgroundColor's alpha < 1.
|
|
338
|
+
*
|
|
339
|
+
* The following values are currently supported:
|
|
340
|
+
*
|
|
341
|
+
* - `none` - disables blur effect
|
|
342
|
+
* - `systemDefault` - uses UIKit's default tab bar blur effect
|
|
343
|
+
* - one of styles mapped from UIKit's UIBlurEffectStyle, e.g. `systemUltraThinMaterial`
|
|
344
|
+
*
|
|
345
|
+
* Defaults to `systemDefault`.
|
|
346
|
+
*
|
|
347
|
+
* Complete list of possible blur effect styles is available in the official UIKit documentation:
|
|
348
|
+
* @see {@link https://developer.apple.com/documentation/uikit/uiblureffect/style|UIBlurEffect.Style}
|
|
349
|
+
*
|
|
350
|
+
* Only supported on iOS 18 and lower.
|
|
351
|
+
*
|
|
352
|
+
* @platform ios
|
|
206
353
|
*/
|
|
207
|
-
|
|
354
|
+
tabBarBlurEffect?: BottomTabsScreenBlurEffect;
|
|
208
355
|
|
|
209
356
|
/**
|
|
210
|
-
*
|
|
357
|
+
* Minimize behavior for the tab bar.
|
|
358
|
+
*
|
|
359
|
+
* The following values are currently supported:
|
|
360
|
+
*
|
|
361
|
+
* - `auto` - resolves to the system default minimize behavior
|
|
362
|
+
* - `never` - the tab bar does not minimize
|
|
363
|
+
* - `onScrollDown` - the tab bar minimizes when scrolling down and
|
|
364
|
+
* expands when scrolling back up
|
|
365
|
+
* - `onScrollUp` - the tab bar minimizes when scrolling up and expands
|
|
366
|
+
* when scrolling back down
|
|
367
|
+
*
|
|
368
|
+
* Defaults to `auto`.
|
|
369
|
+
*
|
|
370
|
+
* The supported values correspond to the official UIKit documentation:
|
|
371
|
+
* @see {@link https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior|UITabBarController.MinimizeBehavior}
|
|
372
|
+
*
|
|
373
|
+
* Available starting from iOS 26.
|
|
374
|
+
*
|
|
375
|
+
* @platform ios
|
|
211
376
|
*/
|
|
212
|
-
|
|
377
|
+
tabBarMinimizeBehavior?: TabBarMinimizeBehavior;
|
|
213
378
|
|
|
214
379
|
/**
|
|
215
|
-
* Background color
|
|
380
|
+
* Background color of the active indicator.
|
|
381
|
+
*
|
|
382
|
+
* Only supported with `native` implementation.
|
|
383
|
+
*
|
|
384
|
+
* @platform android
|
|
216
385
|
*/
|
|
217
|
-
|
|
386
|
+
tabBarActiveIndicatorColor?: ColorValue;
|
|
218
387
|
|
|
219
388
|
/**
|
|
220
|
-
*
|
|
389
|
+
* Specifies if the active indicator should be used. Defaults to `true`.
|
|
390
|
+
*
|
|
391
|
+
* Only supported with `native` implementation.
|
|
392
|
+
*
|
|
393
|
+
* @platform android
|
|
221
394
|
*/
|
|
222
|
-
|
|
395
|
+
tabBarActiveIndicatorEnabled?: boolean;
|
|
223
396
|
|
|
224
397
|
/**
|
|
225
|
-
*
|
|
398
|
+
* Function which returns a React element to display as an accessory view.
|
|
399
|
+
*
|
|
400
|
+
* Accepts a `placement` parameter which can be one of the following values:
|
|
401
|
+
* - `regular` - at bottom of the screen, above the tab bar if tab bar is at the bottom
|
|
402
|
+
* - `inline` - inline with the collapsed bottom tab bar (e.g. when minimized based on `tabBarMinimizeBehavior`)
|
|
403
|
+
*
|
|
404
|
+
* Note: the content is rendered twice for both placements, but only one is visible at a time based on the tab bar state.
|
|
405
|
+
* Any shared state should be stored outside of the component to keep both versions in sync.
|
|
406
|
+
*
|
|
407
|
+
* Available starting from iOS 26.
|
|
408
|
+
*
|
|
409
|
+
* Only supported with `native` implementation.
|
|
410
|
+
*
|
|
411
|
+
* @platform ios
|
|
226
412
|
*/
|
|
227
|
-
|
|
413
|
+
bottomAccessory?: (options: {
|
|
414
|
+
placement: 'regular' | 'inline';
|
|
415
|
+
}) => React.ReactNode;
|
|
228
416
|
|
|
229
417
|
/**
|
|
230
|
-
*
|
|
418
|
+
* Configures the scroll edge effect for the _content ScrollView_ (the ScrollView that is present in first descendants chain of the Screen).
|
|
419
|
+
* Depending on values set, it will blur the scrolling content below certain UI elements (header items, search bar)
|
|
420
|
+
* for the specified edge of the ScrollView.
|
|
421
|
+
*
|
|
422
|
+
* When set in nested containers, i.e. Native Stack inside Native Bottom Tabs, or the other way around,
|
|
423
|
+
* the ScrollView will use only the innermost one's config.
|
|
424
|
+
*
|
|
425
|
+
* **Note:** Using both `headerBlurEffect` and `scrollEdgeEffects` (>= iOS 26) simultaneously may cause overlapping effects.
|
|
426
|
+
*
|
|
427
|
+
* Edge effects can be configured for each edge separately. The following values are currently supported:
|
|
428
|
+
*
|
|
429
|
+
* - `automatic` - the automatic scroll edge effect style,
|
|
430
|
+
* - `hard` - a scroll edge effect with a hard cutoff and dividing line,
|
|
431
|
+
* - `soft` - a soft-edged scroll edge effect,
|
|
432
|
+
* - `hidden` - no scroll edge effect.
|
|
433
|
+
*
|
|
434
|
+
* Defaults to `automatic` for each edge.
|
|
435
|
+
*
|
|
436
|
+
* Available starting from iOS 26.
|
|
437
|
+
*
|
|
438
|
+
* Only supported with `native` implementation.
|
|
439
|
+
*
|
|
440
|
+
* @platform ios
|
|
231
441
|
*/
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
442
|
+
scrollEdgeEffects?: {
|
|
443
|
+
bottom?: ScrollEdgeEffect;
|
|
444
|
+
left?: ScrollEdgeEffect;
|
|
445
|
+
right?: ScrollEdgeEffect;
|
|
446
|
+
top?: ScrollEdgeEffect;
|
|
235
447
|
};
|
|
448
|
+
};
|
|
236
449
|
|
|
450
|
+
export type BottomTabNavigationOptions = {
|
|
237
451
|
/**
|
|
238
|
-
*
|
|
452
|
+
* Title text for the screen.
|
|
239
453
|
*/
|
|
240
|
-
|
|
454
|
+
title?: string;
|
|
241
455
|
|
|
242
456
|
/**
|
|
243
|
-
*
|
|
457
|
+
* Title string of the tab displayed in the tab bar
|
|
458
|
+
*
|
|
459
|
+
* Overrides the label provided by `tabBarSystemItem` on iOS.
|
|
460
|
+
*
|
|
461
|
+
* If not provided, or set to `undefined`:
|
|
462
|
+
* - The system values are used if `tabBarSystemItem` is set on iOS.
|
|
463
|
+
* - Otherwise, it falls back to the `title` or route name.
|
|
244
464
|
*/
|
|
245
|
-
|
|
465
|
+
tabBarLabel?: string;
|
|
246
466
|
|
|
247
467
|
/**
|
|
248
|
-
*
|
|
249
|
-
* You could render an image, a gradient, blur view etc.
|
|
468
|
+
* Label visibility mode for the tab bar items.
|
|
250
469
|
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
470
|
+
* The following values are currently supported:
|
|
471
|
+
*
|
|
472
|
+
* - `auto` - decided based on platform and implementation
|
|
473
|
+
* - `labeled` - labels are always shown
|
|
474
|
+
* - `unlabeled` - labels are never shown
|
|
475
|
+
* - `selected` - labels shown only for selected tab (only supported on Android with `native` implementation)
|
|
476
|
+
*
|
|
477
|
+
* Defaults to `auto`.
|
|
478
|
+
*
|
|
479
|
+
* Supported on all platforms with `custom` implementation.
|
|
480
|
+
* Only supported on Android with `native` implementation.
|
|
253
481
|
*/
|
|
254
|
-
|
|
482
|
+
tabBarLabelVisibilityMode?: TabBarItemLabelVisibilityMode;
|
|
255
483
|
|
|
256
484
|
/**
|
|
257
|
-
*
|
|
485
|
+
* Style object for the tab label.
|
|
258
486
|
*/
|
|
259
|
-
|
|
487
|
+
tabBarLabelStyle?: Pick<
|
|
488
|
+
TextStyle,
|
|
489
|
+
'fontFamily' | 'fontSize' | 'fontWeight' | 'fontStyle'
|
|
490
|
+
>;
|
|
260
491
|
|
|
261
492
|
/**
|
|
262
|
-
*
|
|
263
|
-
*
|
|
493
|
+
* Icon to display for the tab.
|
|
494
|
+
*
|
|
495
|
+
* Overrides the icon provided by `tabBarSystemItem` on iOS with native implementation.
|
|
496
|
+
*
|
|
497
|
+
* Providing different icon for focused and unfocused states is supported:
|
|
498
|
+
* - on all platforms with `custom` implementation
|
|
499
|
+
* - on iOS with `native` implementation
|
|
500
|
+
*
|
|
501
|
+
* A React element is only supported with `custom` implementation.
|
|
264
502
|
*/
|
|
265
|
-
|
|
503
|
+
tabBarIcon?:
|
|
504
|
+
| BottomTabIcon
|
|
505
|
+
| ((props: {
|
|
506
|
+
focused: boolean;
|
|
507
|
+
color: ColorValue;
|
|
508
|
+
size: number;
|
|
509
|
+
}) => BottomTabIcon | React.ReactNode);
|
|
266
510
|
|
|
267
511
|
/**
|
|
268
|
-
*
|
|
512
|
+
* Text to show in a badge on the tab icon.
|
|
269
513
|
*/
|
|
270
|
-
|
|
514
|
+
tabBarBadge?: number | string;
|
|
271
515
|
|
|
272
516
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
517
|
+
* Custom style for the tab bar badge.
|
|
518
|
+
* You can specify a background color or text color here.
|
|
519
|
+
*
|
|
520
|
+
* @platform android
|
|
275
521
|
*/
|
|
276
|
-
|
|
522
|
+
tabBarBadgeStyle?: {
|
|
523
|
+
backgroundColor?: ColorValue;
|
|
524
|
+
color?: ColorValue;
|
|
525
|
+
};
|
|
277
526
|
|
|
278
527
|
/**
|
|
279
|
-
*
|
|
280
|
-
* Defaults to `false`.
|
|
528
|
+
* Color for the icon and label in the active tab.
|
|
281
529
|
*/
|
|
282
|
-
|
|
530
|
+
tabBarActiveTintColor?: ColorValue;
|
|
283
531
|
|
|
284
532
|
/**
|
|
285
|
-
*
|
|
286
|
-
* Defaults to `true` when `enableFreeze()` is run at the top of the application.
|
|
287
|
-
* Requires `react-native-screens` version >=3.16.0.
|
|
288
|
-
*
|
|
289
|
-
* Only supported on iOS and Android.
|
|
533
|
+
* Color for the icon and label in the inactive tabs.
|
|
290
534
|
*/
|
|
291
|
-
|
|
535
|
+
tabBarInactiveTintColor?: ColorValue;
|
|
292
536
|
|
|
293
537
|
/**
|
|
294
|
-
*
|
|
538
|
+
* Color of tab bar item's ripple effect.
|
|
539
|
+
*
|
|
540
|
+
* @platform android
|
|
295
541
|
*/
|
|
296
|
-
|
|
542
|
+
tabBarRippleColor?: ColorValue;
|
|
297
543
|
|
|
298
544
|
/**
|
|
299
|
-
*
|
|
545
|
+
* Display mode for the tab bar.
|
|
300
546
|
*
|
|
301
547
|
* Supported values:
|
|
302
|
-
* -
|
|
303
|
-
* -
|
|
304
|
-
* -
|
|
548
|
+
* - `auto` - automatic based on the tab’s content
|
|
549
|
+
* - `tabBar` - tab items are shown in a traditional tab bar
|
|
550
|
+
* - `tabSidebar` - tab items are shown in a sidebar
|
|
551
|
+
*
|
|
552
|
+
* Supported on all platforms with `custom` implementation. By default:
|
|
553
|
+
* - `tabBar` is positioned at the bottom
|
|
554
|
+
* - `tabSidebar` is positioned on the left (LTR) or right (RTL)
|
|
555
|
+
*
|
|
556
|
+
* The `tabBarPosition` option can be used to override this in `custom` implementation.
|
|
557
|
+
*
|
|
558
|
+
* Supported on iOS 18 and above with `native` implementation.
|
|
559
|
+
* Not supported on tvOS.
|
|
305
560
|
*/
|
|
306
|
-
|
|
561
|
+
tabBarControllerMode?: TabBarControllerMode;
|
|
307
562
|
|
|
308
563
|
/**
|
|
309
|
-
*
|
|
564
|
+
* Style object for the tab bar container.
|
|
310
565
|
*/
|
|
311
|
-
|
|
566
|
+
tabBarStyle?: {
|
|
567
|
+
/**
|
|
568
|
+
* Background color of the tab bar.
|
|
569
|
+
*
|
|
570
|
+
* Only supported on Android and iOS 18 and below.
|
|
571
|
+
*/
|
|
572
|
+
backgroundColor?: ColorValue;
|
|
573
|
+
/**
|
|
574
|
+
* Shadow color of the tab bar.
|
|
575
|
+
*
|
|
576
|
+
* Only supported on iOS 18 and below.
|
|
577
|
+
*/
|
|
578
|
+
shadowColor?: ColorValue;
|
|
579
|
+
};
|
|
312
580
|
|
|
313
581
|
/**
|
|
314
|
-
*
|
|
582
|
+
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
|
583
|
+
* Set it to `false` if you want to render the screen on initial render.
|
|
315
584
|
*/
|
|
316
|
-
|
|
317
|
-
|
|
585
|
+
lazy?: boolean;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Whether any nested stack should be popped to top when navigating away from the tab.
|
|
589
|
+
* Defaults to `false`.
|
|
590
|
+
*/
|
|
591
|
+
popToTopOnBlur?: boolean; // TODO: handle natively
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Style object for the component wrapping the screen content.
|
|
595
|
+
*/
|
|
596
|
+
sceneStyle?: StyleProp<ViewStyle>;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Function that returns a React Element to display as a header.
|
|
600
|
+
*/
|
|
601
|
+
header?: (props: BottomTabHeaderProps) => React.ReactNode;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Whether to show the header.
|
|
605
|
+
*
|
|
606
|
+
* Defaults to `false` unless a header is provided.
|
|
607
|
+
*/
|
|
608
|
+
headerShown?: boolean;
|
|
609
|
+
} & HeaderOptions &
|
|
610
|
+
BottomTabNativeOptions &
|
|
611
|
+
BottomTabCustomOptions;
|
|
318
612
|
|
|
319
613
|
export type BottomTabDescriptor = Descriptor<
|
|
320
614
|
BottomTabNavigationOptions,
|
|
@@ -385,32 +679,35 @@ export type BottomTabTransitionPreset = {
|
|
|
385
679
|
|
|
386
680
|
export type BottomTabNavigationConfig = {
|
|
387
681
|
/**
|
|
388
|
-
*
|
|
682
|
+
* The implementation to use for rendering the bottom tabs.
|
|
683
|
+
*
|
|
684
|
+
* - `native`: uses native platform bottom tabs on Android and iOS.
|
|
685
|
+
* - `custom`: uses a custom JavaScript implementation for all platforms.
|
|
686
|
+
*
|
|
687
|
+
* Some feature may not be available depending on the implementation used.
|
|
688
|
+
*
|
|
689
|
+
* Defaults to `native` on Android and iOS.
|
|
690
|
+
*
|
|
691
|
+
* On other platforms, it's always `custom` and this option has no effect.
|
|
389
692
|
*/
|
|
390
|
-
|
|
693
|
+
implementation?: 'native' | 'custom';
|
|
694
|
+
|
|
391
695
|
/**
|
|
392
|
-
*
|
|
393
|
-
* By default, the device's safe area insets are automatically detected. You can override the behavior with this option.
|
|
696
|
+
* Function that returns a React element to display as the tab bar.
|
|
394
697
|
*/
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
right?: number;
|
|
398
|
-
bottom?: number;
|
|
399
|
-
left?: number;
|
|
400
|
-
};
|
|
698
|
+
tabBar?: (props: BottomTabBarProps) => React.ReactNode;
|
|
699
|
+
|
|
401
700
|
/**
|
|
402
701
|
* Whether inactive screens should be detached from the view hierarchy to save memory.
|
|
403
|
-
*
|
|
404
|
-
* Defaults to `true
|
|
702
|
+
*
|
|
703
|
+
* Defaults to `true`.
|
|
704
|
+
*
|
|
705
|
+
* Only supported with `custom` implementation.
|
|
405
706
|
*/
|
|
406
707
|
detachInactiveScreens?: boolean;
|
|
407
708
|
};
|
|
408
709
|
|
|
409
710
|
export type BottomTabHeaderProps = {
|
|
410
|
-
/**
|
|
411
|
-
* Layout of the screen.
|
|
412
|
-
*/
|
|
413
|
-
layout: Layout;
|
|
414
711
|
/**
|
|
415
712
|
* Options for the current screen.
|
|
416
713
|
*/
|
|
@@ -429,7 +726,6 @@ export type BottomTabBarProps = {
|
|
|
429
726
|
state: TabNavigationState<ParamListBase>;
|
|
430
727
|
descriptors: BottomTabDescriptorMap;
|
|
431
728
|
navigation: NavigationHelpers<ParamListBase, BottomTabNavigationEventMap>;
|
|
432
|
-
insets: EdgeInsets;
|
|
433
729
|
};
|
|
434
730
|
|
|
435
731
|
export type BottomTabBarButtonProps = Omit<
|
|
@@ -446,7 +742,6 @@ export type BottomTabBarButtonProps = Omit<
|
|
|
446
742
|
|
|
447
743
|
export type BottomTabNavigatorProps = DefaultNavigatorOptions<
|
|
448
744
|
ParamListBase,
|
|
449
|
-
string | undefined,
|
|
450
745
|
TabNavigationState<ParamListBase>,
|
|
451
746
|
BottomTabNavigationOptions,
|
|
452
747
|
BottomTabNavigationEventMap,
|