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