@react-navigation/bottom-tabs 7.5.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.
- package/lib/module/navigators/createBottomTabNavigator.js +2 -0
- package/lib/module/navigators/createBottomTabNavigator.js.map +1 -1
- package/lib/module/unstable/NativeBottomTabView.js +6 -0
- package/lib/module/unstable/NativeBottomTabView.js.map +1 -0
- package/lib/module/unstable/NativeBottomTabView.native.js +225 -0
- package/lib/module/unstable/NativeBottomTabView.native.js.map +1 -0
- package/lib/module/unstable/NativeScreen/NativeScreen.js +166 -0
- package/lib/module/unstable/NativeScreen/NativeScreen.js.map +1 -0
- package/lib/module/unstable/NativeScreen/debounce.js +12 -0
- package/lib/module/unstable/NativeScreen/debounce.js.map +1 -0
- package/lib/module/unstable/NativeScreen/types.js +4 -0
- package/lib/module/unstable/NativeScreen/types.js.map +1 -0
- package/lib/module/unstable/NativeScreen/useAnimatedHeaderHeight.js +12 -0
- package/lib/module/unstable/NativeScreen/useAnimatedHeaderHeight.js.map +1 -0
- package/lib/module/unstable/NativeScreen/useHeaderConfig.js +283 -0
- package/lib/module/unstable/NativeScreen/useHeaderConfig.js.map +1 -0
- package/lib/module/unstable/createNativeBottomTabNavigator.js +6 -0
- package/lib/module/unstable/createNativeBottomTabNavigator.js.map +1 -0
- package/lib/module/unstable/createNativeBottomTabNavigator.native.js +65 -0
- package/lib/module/unstable/createNativeBottomTabNavigator.native.js.map +1 -0
- package/lib/module/unstable/index.js +16 -0
- package/lib/module/unstable/index.js.map +1 -0
- package/lib/module/unstable/types.js +4 -0
- package/lib/module/unstable/types.js.map +1 -0
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts +1 -1
- package/lib/typescript/src/navigators/createBottomTabNavigator.d.ts.map +1 -1
- package/lib/typescript/src/unstable/NativeBottomTabView.d.ts +10 -0
- package/lib/typescript/src/unstable/NativeBottomTabView.d.ts.map +1 -0
- package/lib/typescript/src/unstable/NativeBottomTabView.native.d.ts +10 -0
- package/lib/typescript/src/unstable/NativeBottomTabView.native.d.ts.map +1 -0
- package/lib/typescript/src/unstable/NativeScreen/NativeScreen.d.ts +8 -0
- package/lib/typescript/src/unstable/NativeScreen/NativeScreen.d.ts.map +1 -0
- package/lib/typescript/src/unstable/NativeScreen/debounce.d.ts +2 -0
- package/lib/typescript/src/unstable/NativeScreen/debounce.d.ts.map +1 -0
- package/lib/typescript/src/unstable/NativeScreen/types.d.ts +467 -0
- package/lib/typescript/src/unstable/NativeScreen/types.d.ts.map +1 -0
- package/lib/typescript/src/unstable/NativeScreen/useAnimatedHeaderHeight.d.ts +5 -0
- package/lib/typescript/src/unstable/NativeScreen/useAnimatedHeaderHeight.d.ts.map +1 -0
- package/lib/typescript/src/unstable/NativeScreen/useHeaderConfig.d.ts +11 -0
- package/lib/typescript/src/unstable/NativeScreen/useHeaderConfig.d.ts.map +1 -0
- package/lib/typescript/src/unstable/createNativeBottomTabNavigator.d.ts +2 -0
- package/lib/typescript/src/unstable/createNativeBottomTabNavigator.d.ts.map +1 -0
- package/lib/typescript/src/unstable/createNativeBottomTabNavigator.native.d.ts +16 -0
- package/lib/typescript/src/unstable/createNativeBottomTabNavigator.native.d.ts.map +1 -0
- package/lib/typescript/src/unstable/index.d.ts +13 -0
- package/lib/typescript/src/unstable/index.d.ts.map +1 -0
- package/lib/typescript/src/unstable/types.d.ts +276 -0
- package/lib/typescript/src/unstable/types.d.ts.map +1 -0
- package/package.json +12 -6
- package/src/navigators/createBottomTabNavigator.tsx +2 -0
- package/src/unstable/NativeBottomTabView.native.tsx +303 -0
- package/src/unstable/NativeBottomTabView.tsx +20 -0
- package/src/unstable/NativeScreen/NativeScreen.tsx +242 -0
- package/src/unstable/NativeScreen/debounce.tsx +14 -0
- package/src/unstable/NativeScreen/types.ts +517 -0
- package/src/unstable/NativeScreen/useAnimatedHeaderHeight.tsx +18 -0
- package/src/unstable/NativeScreen/useHeaderConfig.tsx +423 -0
- package/src/unstable/createNativeBottomTabNavigator.native.tsx +116 -0
- package/src/unstable/createNativeBottomTabNavigator.tsx +4 -0
- package/src/unstable/index.tsx +22 -0
- package/src/unstable/types.tsx +353 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import type { DefaultNavigatorOptions, Descriptor, NavigationHelpers, NavigationProp, ParamListBase, RouteProp, TabActionHelpers, TabNavigationState, TabRouterOptions, Theme } from '@react-navigation/native';
|
|
2
|
+
import type { ColorValue, ImageSourcePropType, TextStyle } from 'react-native';
|
|
3
|
+
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
4
|
+
import type { BottomTabsSystemItem, TabBarControllerMode, TabBarItemLabelVisibilityMode, TabBarMinimizeBehavior } from 'react-native-screens';
|
|
5
|
+
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
6
|
+
import type { NativeHeaderOptions } from './NativeScreen/types';
|
|
7
|
+
export type Layout = {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
export type NativeBottomTabNavigationEventMap = {
|
|
12
|
+
/**
|
|
13
|
+
* Event which fires on tapping on the tab in the tab bar.
|
|
14
|
+
*/
|
|
15
|
+
tabPress: {
|
|
16
|
+
data: undefined;
|
|
17
|
+
canPreventDefault: true;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Event which fires when a transition animation starts.
|
|
21
|
+
*/
|
|
22
|
+
transitionStart: {
|
|
23
|
+
data: {
|
|
24
|
+
closing: boolean;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Event which fires when a transition animation ends.
|
|
29
|
+
*/
|
|
30
|
+
transitionEnd: {
|
|
31
|
+
data: {
|
|
32
|
+
closing: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export type NativeBottomTabNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = NavigationProp<ParamList, RouteName, NavigatorID, TabNavigationState<ParamList>, NativeBottomTabNavigationOptions, NativeBottomTabNavigationEventMap> & TabActionHelpers<ParamList>;
|
|
37
|
+
export type NativeBottomTabScreenProps<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = {
|
|
38
|
+
navigation: NativeBottomTabNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
39
|
+
route: RouteProp<ParamList, RouteName>;
|
|
40
|
+
};
|
|
41
|
+
export type NativeBottomTabOptionsArgs<ParamList extends ParamListBase, RouteName extends keyof ParamList = keyof ParamList, NavigatorID extends string | undefined = undefined> = NativeBottomTabScreenProps<ParamList, RouteName, NavigatorID> & {
|
|
42
|
+
theme: Theme;
|
|
43
|
+
};
|
|
44
|
+
type IconImage = {
|
|
45
|
+
/**
|
|
46
|
+
* - `image` - Use a local image as the icon.
|
|
47
|
+
*/
|
|
48
|
+
type: 'image';
|
|
49
|
+
/**
|
|
50
|
+
* Image source to use as the icon.
|
|
51
|
+
* e.g., `require('./path/to/image.png')`
|
|
52
|
+
*/
|
|
53
|
+
source: ImageSourcePropType;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to apply tint color to the icon.
|
|
56
|
+
* Defaults to `true`.
|
|
57
|
+
*
|
|
58
|
+
* @platform ios
|
|
59
|
+
*/
|
|
60
|
+
tinted?: boolean;
|
|
61
|
+
};
|
|
62
|
+
type IconIOSSfSymbol = {
|
|
63
|
+
/**
|
|
64
|
+
* - `sfSymbol` - Use an SF Symbol as the icon on iOS.
|
|
65
|
+
*/
|
|
66
|
+
type: 'sfSymbol';
|
|
67
|
+
/**
|
|
68
|
+
* Name of the SF Symbol to use as the icon.
|
|
69
|
+
*
|
|
70
|
+
* @platform ios
|
|
71
|
+
*/
|
|
72
|
+
name: SFSymbol;
|
|
73
|
+
};
|
|
74
|
+
type IconAndroidDrawable = {
|
|
75
|
+
/**
|
|
76
|
+
* - `drawableResource` - Use a drawable resource as the icon on Android.
|
|
77
|
+
*/
|
|
78
|
+
type: 'drawableResource';
|
|
79
|
+
/**
|
|
80
|
+
* Name of the drawable resource to use as the icon.
|
|
81
|
+
*
|
|
82
|
+
* @platform android
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
};
|
|
86
|
+
type IconIOS = IconIOSSfSymbol | IconImage;
|
|
87
|
+
type IconAndroid = IconAndroidDrawable | IconImage;
|
|
88
|
+
export type Icon = IconIOS | IconAndroid;
|
|
89
|
+
export type NativeBottomTabNavigationOptions = NativeHeaderOptions & {
|
|
90
|
+
/**
|
|
91
|
+
* Title text for the screen.
|
|
92
|
+
*/
|
|
93
|
+
title?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Uses iOS built-in tab bar items with standard iOS styling and localized titles.
|
|
96
|
+
* If set to `search`, it's positioned next to the tab bar on iOS 26 and above.
|
|
97
|
+
*
|
|
98
|
+
* The `tabBarIcon` and `tabBarLabel` options will override the icon and label from the system item.
|
|
99
|
+
* If you want to keep the system behavior on iOS, but need to provide icon and label for other platforms,
|
|
100
|
+
* Use `Platform.OS` or `Platform.select` to conditionally set `undefined` for `tabBarIcon` and `tabBarLabel` on iOS.
|
|
101
|
+
*
|
|
102
|
+
* @platform ios
|
|
103
|
+
*/
|
|
104
|
+
tabBarSystemItem?: BottomTabsSystemItem;
|
|
105
|
+
/**
|
|
106
|
+
* Title string of a tab displayed in the tab bar
|
|
107
|
+
*
|
|
108
|
+
* Overrides the label provided by `tabBarSystemItem` on iOS.
|
|
109
|
+
*
|
|
110
|
+
* If not provided, or set to `undefined`:
|
|
111
|
+
* - The system values are used if `tabBarSystemItem` is set on iOS.
|
|
112
|
+
* - Otherwise, it falls back to the `title` or route name.
|
|
113
|
+
*/
|
|
114
|
+
tabBarLabel?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Style object for the tab label.
|
|
117
|
+
*/
|
|
118
|
+
tabBarLabelStyle?: Pick<TextStyle, 'fontFamily' | 'fontSize' | 'fontWeight' | 'fontStyle'>;
|
|
119
|
+
/**
|
|
120
|
+
* Icon to display for the tab.
|
|
121
|
+
* Showing a different icon for focused tab is only supported on iOS.
|
|
122
|
+
*
|
|
123
|
+
* Overrides the icon provided by `tabBarSystemItem` on iOS.
|
|
124
|
+
*/
|
|
125
|
+
tabBarIcon?: Icon | ((props: {
|
|
126
|
+
focused: boolean;
|
|
127
|
+
}) => Icon);
|
|
128
|
+
/**
|
|
129
|
+
* Text to show in a badge on the tab icon.
|
|
130
|
+
*/
|
|
131
|
+
tabBarBadge?: number | string;
|
|
132
|
+
/**
|
|
133
|
+
* Custom style for the tab bar badge.
|
|
134
|
+
* You can specify a background color or text color here.
|
|
135
|
+
* Only supported on Android.
|
|
136
|
+
*/
|
|
137
|
+
tabBarBadgeStyle?: {
|
|
138
|
+
backgroundColor?: ColorValue;
|
|
139
|
+
color?: ColorValue;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Color for the icon and label in the active tab.
|
|
143
|
+
*/
|
|
144
|
+
tabBarActiveTintColor?: ColorValue;
|
|
145
|
+
/**
|
|
146
|
+
* Color for the icon and label in the inactive tabs.
|
|
147
|
+
*
|
|
148
|
+
* @platform android
|
|
149
|
+
*/
|
|
150
|
+
tabBarInactiveTintColor?: ColorValue;
|
|
151
|
+
/**
|
|
152
|
+
* Specifies the background color of the active indicator.
|
|
153
|
+
*
|
|
154
|
+
* @platform android
|
|
155
|
+
*/
|
|
156
|
+
tabBarActiveIndicatorColor?: ColorValue;
|
|
157
|
+
/**
|
|
158
|
+
* Specifies if the active indicator should be used. Defaults to `true`.
|
|
159
|
+
*
|
|
160
|
+
* @platform android
|
|
161
|
+
*/
|
|
162
|
+
tabBarActiveIndicatorEnabled?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Specifies the color of each tab bar item's ripple effect.
|
|
165
|
+
*
|
|
166
|
+
* @platform android
|
|
167
|
+
*/
|
|
168
|
+
tabBarRippleColor?: ColorValue;
|
|
169
|
+
/**
|
|
170
|
+
* Style object for the tab bar container.
|
|
171
|
+
*/
|
|
172
|
+
tabBarStyle?: {
|
|
173
|
+
/**
|
|
174
|
+
* Background color of the tab bar.
|
|
175
|
+
*
|
|
176
|
+
* Only supported on Android and iOS 18 and below.
|
|
177
|
+
*/
|
|
178
|
+
backgroundColor?: ColorValue;
|
|
179
|
+
/**
|
|
180
|
+
* Shadow color of the tab bar.
|
|
181
|
+
*
|
|
182
|
+
* Only supported on iOS 18 and below.
|
|
183
|
+
*/
|
|
184
|
+
shadowColor?: ColorValue;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
|
188
|
+
* Set it to `false` if you want to render the screen on initial render.
|
|
189
|
+
*/
|
|
190
|
+
lazy?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Whether any nested stack should be popped to top when navigating away from the tab.
|
|
193
|
+
* Defaults to `false`.
|
|
194
|
+
*/
|
|
195
|
+
popToTopOnBlur?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Specifies the label visibility mode for the tab bar items.
|
|
198
|
+
*
|
|
199
|
+
* The following values are currently supported:
|
|
200
|
+
*
|
|
201
|
+
* - `automatic` - the system decides when to show or hide labels
|
|
202
|
+
* - `selected` - labels are shown only for the selected tab
|
|
203
|
+
* - `labeled` - labels are always shown
|
|
204
|
+
* - `unlabeled` - labels are never shown
|
|
205
|
+
*
|
|
206
|
+
* @platform android
|
|
207
|
+
*/
|
|
208
|
+
tabBarLabelVisibilityMode?: TabBarItemLabelVisibilityMode;
|
|
209
|
+
/**
|
|
210
|
+
* Specifies the display mode for the tab bar.
|
|
211
|
+
*
|
|
212
|
+
* Available starting from iOS 18.
|
|
213
|
+
* Not supported on tvOS.
|
|
214
|
+
*
|
|
215
|
+
* The following values are currently supported:
|
|
216
|
+
*
|
|
217
|
+
* - `automatic` - the system sets the display mode based on the tab’s content
|
|
218
|
+
* - `tabBar` - the system displays the content only as a tab bar
|
|
219
|
+
* - `tabSidebar` - the tab bar is displayed as a sidebar
|
|
220
|
+
*
|
|
221
|
+
* See the official documentation for more details:
|
|
222
|
+
* @see {@link https://developer.apple.com/documentation/uikit/uitabbarcontroller/mode|UITabBarController.Mode}
|
|
223
|
+
*
|
|
224
|
+
* @default Defaults to `automatic`.
|
|
225
|
+
*
|
|
226
|
+
* @platform ios
|
|
227
|
+
* @supported iOS 18 or higher, not supported on tvOS
|
|
228
|
+
*/
|
|
229
|
+
tabBarControllerMode?: TabBarControllerMode;
|
|
230
|
+
/**
|
|
231
|
+
* Specifies the minimize behavior for the tab bar.
|
|
232
|
+
*
|
|
233
|
+
* The following values are currently supported:
|
|
234
|
+
*
|
|
235
|
+
* - `automatic` - resolves to the system default minimize behavior
|
|
236
|
+
* - `never` - the tab bar does not minimize
|
|
237
|
+
* - `onScrollDown` - the tab bar minimizes when scrolling down and
|
|
238
|
+
* expands when scrolling back up
|
|
239
|
+
* - `onScrollUp` - the tab bar minimizes when scrolling up and expands
|
|
240
|
+
* when scrolling back down
|
|
241
|
+
*
|
|
242
|
+
* The supported values correspond to the official UIKit documentation:
|
|
243
|
+
* @see {@link https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior|UITabBarController.MinimizeBehavior}
|
|
244
|
+
*
|
|
245
|
+
* @platform ios
|
|
246
|
+
* @supported iOS 26 or higher
|
|
247
|
+
*/
|
|
248
|
+
tabBarMinimizeBehavior?: TabBarMinimizeBehavior;
|
|
249
|
+
};
|
|
250
|
+
export type NativeBottomTabDescriptor = Descriptor<NativeBottomTabNavigationOptions, NativeBottomTabNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
|
|
251
|
+
export type NativeBottomTabDescriptorMap = Record<string, NativeBottomTabDescriptor>;
|
|
252
|
+
export type NativeBottomTabNavigationConfig = {};
|
|
253
|
+
export type NativeBottomTabBarProps = {
|
|
254
|
+
state: TabNavigationState<ParamListBase>;
|
|
255
|
+
descriptors: NativeBottomTabDescriptorMap;
|
|
256
|
+
navigation: NavigationHelpers<ParamListBase, NativeBottomTabNavigationEventMap>;
|
|
257
|
+
insets: EdgeInsets;
|
|
258
|
+
};
|
|
259
|
+
export type NativeBottomTabNavigatorProps = DefaultNavigatorOptions<ParamListBase, string | undefined, TabNavigationState<ParamListBase>, NativeBottomTabNavigationOptions, NativeBottomTabNavigationEventMap, NativeBottomTabNavigationProp<ParamListBase>> & TabRouterOptions & NativeBottomTabNavigationConfig;
|
|
260
|
+
export type NativeBottomTabNavigationHelpers = NavigationHelpers<ParamListBase, NativeBottomTabNavigationEventMap> & TabActionHelpers<ParamListBase>;
|
|
261
|
+
export type NativeBottomTabHeaderProps = {
|
|
262
|
+
/**
|
|
263
|
+
* Options for the current screen.
|
|
264
|
+
*/
|
|
265
|
+
options: NativeBottomTabNavigationOptions;
|
|
266
|
+
/**
|
|
267
|
+
* Route object for the current screen.
|
|
268
|
+
*/
|
|
269
|
+
route: RouteProp<ParamListBase>;
|
|
270
|
+
/**
|
|
271
|
+
* Navigation prop for the header.
|
|
272
|
+
*/
|
|
273
|
+
navigation: NativeBottomTabNavigationProp<ParamListBase>;
|
|
274
|
+
};
|
|
275
|
+
export {};
|
|
276
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/unstable/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,EACN,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,sBAAsB,EACvB,MA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BAAuB,GAAG;IACpC,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,WAAW,EAAE,4BAA4B,CAAC;IAC1C,UAAU,EAAE,iBAAiB,CAC3B,aAAa,EACb,iCAAiC,CAClC,CAAC;IACF,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,uBAAuB,CACjE,aAAa,EACb,MAAM,GAAG,SAAS,EAClB,kBAAkB,CAAC,aAAa,CAAC,EACjC,gCAAgC,EAChC,iCAAiC,EACjC,6BAA6B,CAAC,aAAa,CAAC,CAC7C,GACC,gBAAgB,GAChB,+BAA+B,CAAC;AAElC,MAAM,MAAM,gCAAgC,GAAG,iBAAiB,CAC9D,aAAa,EACb,iCAAiC,CAClC,GACC,gBAAgB,CAAC,aAAa,CAAC,CAAC;AAElC,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,OAAO,EAAE,gCAAgC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IAChC;;OAEG;IACH,UAAU,EAAE,6BAA6B,CAAC,aAAa,CAAC,CAAC;CAC1D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/bottom-tabs",
|
|
3
3
|
"description": "Bottom tab navigator following iOS design guidelines",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.7.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native-component",
|
|
7
7
|
"react-component",
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"types": "./lib/typescript/src/index.d.ts",
|
|
26
26
|
"default": "./lib/module/index.js"
|
|
27
27
|
},
|
|
28
|
+
"./unstable": {
|
|
29
|
+
"source": "./src/unstable/index.tsx",
|
|
30
|
+
"types": "./lib/typescript/src/unstable/index.d.ts",
|
|
31
|
+
"default": "./lib/module/unstable/index.js"
|
|
32
|
+
},
|
|
28
33
|
"./package.json": "./package.json"
|
|
29
34
|
},
|
|
30
35
|
"files": [
|
|
@@ -41,12 +46,13 @@
|
|
|
41
46
|
"clean": "del lib"
|
|
42
47
|
},
|
|
43
48
|
"dependencies": {
|
|
44
|
-
"@react-navigation/elements": "^2.
|
|
45
|
-
"color": "^4.2.3"
|
|
49
|
+
"@react-navigation/elements": "^2.8.0",
|
|
50
|
+
"color": "^4.2.3",
|
|
51
|
+
"sf-symbols-typescript": "^2.1.0"
|
|
46
52
|
},
|
|
47
53
|
"devDependencies": {
|
|
48
54
|
"@jest/globals": "^30.0.0",
|
|
49
|
-
"@react-navigation/native": "^7.1.
|
|
55
|
+
"@react-navigation/native": "^7.1.19",
|
|
50
56
|
"@testing-library/react-native": "^13.2.0",
|
|
51
57
|
"@types/color": "^4.2.0",
|
|
52
58
|
"@types/react": "~19.0.10",
|
|
@@ -60,7 +66,7 @@
|
|
|
60
66
|
"typescript": "^5.8.3"
|
|
61
67
|
},
|
|
62
68
|
"peerDependencies": {
|
|
63
|
-
"@react-navigation/native": "^7.1.
|
|
69
|
+
"@react-navigation/native": "^7.1.19",
|
|
64
70
|
"react": ">= 18.2.0",
|
|
65
71
|
"react-native": "*",
|
|
66
72
|
"react-native-safe-area-context": ">= 4.0.0",
|
|
@@ -84,5 +90,5 @@
|
|
|
84
90
|
]
|
|
85
91
|
]
|
|
86
92
|
},
|
|
87
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "437fdd5547406b90d1045c47b86bcfdcf800f51d"
|
|
88
94
|
}
|
|
@@ -23,6 +23,7 @@ function BottomTabNavigator({
|
|
|
23
23
|
id,
|
|
24
24
|
initialRouteName,
|
|
25
25
|
backBehavior,
|
|
26
|
+
UNSTABLE_routeNamesChangeBehavior,
|
|
26
27
|
children,
|
|
27
28
|
layout,
|
|
28
29
|
screenListeners,
|
|
@@ -42,6 +43,7 @@ function BottomTabNavigator({
|
|
|
42
43
|
id,
|
|
43
44
|
initialRouteName,
|
|
44
45
|
backBehavior,
|
|
46
|
+
UNSTABLE_routeNamesChangeBehavior,
|
|
45
47
|
children,
|
|
46
48
|
layout,
|
|
47
49
|
screenListeners,
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLabel,
|
|
3
|
+
Lazy,
|
|
4
|
+
SafeAreaProviderCompat,
|
|
5
|
+
} from '@react-navigation/elements';
|
|
6
|
+
import {
|
|
7
|
+
CommonActions,
|
|
8
|
+
type ParamListBase,
|
|
9
|
+
type Route,
|
|
10
|
+
StackActions,
|
|
11
|
+
type TabNavigationState,
|
|
12
|
+
useTheme,
|
|
13
|
+
} from '@react-navigation/native';
|
|
14
|
+
import Color from 'color';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { type ColorValue, Platform, PlatformColor } from 'react-native';
|
|
17
|
+
import {
|
|
18
|
+
BottomTabs,
|
|
19
|
+
BottomTabsScreen,
|
|
20
|
+
type BottomTabsScreenItemStateAppearance,
|
|
21
|
+
type PlatformIcon,
|
|
22
|
+
} from 'react-native-screens';
|
|
23
|
+
|
|
24
|
+
import { NativeScreen } from './NativeScreen/NativeScreen';
|
|
25
|
+
import type {
|
|
26
|
+
Icon,
|
|
27
|
+
NativeBottomTabDescriptorMap,
|
|
28
|
+
NativeBottomTabNavigationConfig,
|
|
29
|
+
NativeBottomTabNavigationHelpers,
|
|
30
|
+
} from './types';
|
|
31
|
+
|
|
32
|
+
type Props = NativeBottomTabNavigationConfig & {
|
|
33
|
+
state: TabNavigationState<ParamListBase>;
|
|
34
|
+
navigation: NativeBottomTabNavigationHelpers;
|
|
35
|
+
descriptors: NativeBottomTabDescriptorMap;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function NativeBottomTabView({ state, navigation, descriptors }: Props) {
|
|
39
|
+
const { colors, fonts } = useTheme();
|
|
40
|
+
|
|
41
|
+
const focusedRouteKey = state.routes[state.index].key;
|
|
42
|
+
const previousRouteKeyRef = React.useRef(focusedRouteKey);
|
|
43
|
+
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
const previousRouteKey = previousRouteKeyRef.current;
|
|
46
|
+
|
|
47
|
+
if (
|
|
48
|
+
previousRouteKey !== focusedRouteKey &&
|
|
49
|
+
descriptors[previousRouteKey]?.options.popToTopOnBlur
|
|
50
|
+
) {
|
|
51
|
+
const prevRoute = state.routes.find(
|
|
52
|
+
(route) => route.key === previousRouteKey
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
if (prevRoute?.state?.type === 'stack' && prevRoute.state.key) {
|
|
56
|
+
const popToTopAction = {
|
|
57
|
+
...StackActions.popToTop(),
|
|
58
|
+
target: prevRoute.state.key,
|
|
59
|
+
};
|
|
60
|
+
navigation.dispatch(popToTopAction);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
previousRouteKeyRef.current = focusedRouteKey;
|
|
65
|
+
}, [descriptors, focusedRouteKey, navigation, state.index, state.routes]);
|
|
66
|
+
|
|
67
|
+
const currentOptions = descriptors[state.routes[state.index].key]?.options;
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
backgroundColor: tabBarBackgroundColor,
|
|
71
|
+
shadowColor: tabBarShadowColor,
|
|
72
|
+
} = currentOptions.tabBarStyle || {};
|
|
73
|
+
|
|
74
|
+
const {
|
|
75
|
+
fontFamily = Platform.select({
|
|
76
|
+
ios: fonts.medium.fontFamily,
|
|
77
|
+
default: fonts.regular.fontFamily,
|
|
78
|
+
}),
|
|
79
|
+
fontWeight = Platform.select({
|
|
80
|
+
ios: fonts.medium.fontWeight,
|
|
81
|
+
default: fonts.regular.fontWeight,
|
|
82
|
+
}),
|
|
83
|
+
fontSize,
|
|
84
|
+
fontStyle,
|
|
85
|
+
} = currentOptions.tabBarLabelStyle || {};
|
|
86
|
+
|
|
87
|
+
const activeTintColor =
|
|
88
|
+
currentOptions.tabBarActiveTintColor ?? colors.primary;
|
|
89
|
+
|
|
90
|
+
const inactiveTintColor =
|
|
91
|
+
currentOptions.tabBarInactiveTintColor ??
|
|
92
|
+
Platform.select<ColorValue | string>({
|
|
93
|
+
ios: PlatformColor('label'),
|
|
94
|
+
default: colors.text,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const activeIndicatorColor =
|
|
98
|
+
(currentOptions?.tabBarActiveIndicatorColor ??
|
|
99
|
+
typeof activeTintColor === 'string')
|
|
100
|
+
? Color(activeTintColor)?.alpha(0.1).string()
|
|
101
|
+
: undefined;
|
|
102
|
+
|
|
103
|
+
const onTransitionStart = ({
|
|
104
|
+
closing,
|
|
105
|
+
route,
|
|
106
|
+
}: {
|
|
107
|
+
closing: boolean;
|
|
108
|
+
route: Route<string>;
|
|
109
|
+
}) => {
|
|
110
|
+
navigation.emit({
|
|
111
|
+
type: 'transitionStart',
|
|
112
|
+
data: { closing },
|
|
113
|
+
target: route.key,
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const onTransitionEnd = ({
|
|
118
|
+
closing,
|
|
119
|
+
route,
|
|
120
|
+
}: {
|
|
121
|
+
closing: boolean;
|
|
122
|
+
route: Route<string>;
|
|
123
|
+
}) => {
|
|
124
|
+
navigation.emit({
|
|
125
|
+
type: 'transitionEnd',
|
|
126
|
+
data: { closing },
|
|
127
|
+
target: route.key,
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<SafeAreaProviderCompat>
|
|
133
|
+
<BottomTabs
|
|
134
|
+
tabBarItemLabelVisibilityMode={
|
|
135
|
+
currentOptions?.tabBarLabelVisibilityMode
|
|
136
|
+
}
|
|
137
|
+
tabBarControllerMode={currentOptions?.tabBarControllerMode}
|
|
138
|
+
tabBarMinimizeBehavior={currentOptions?.tabBarMinimizeBehavior}
|
|
139
|
+
tabBarTintColor={activeTintColor}
|
|
140
|
+
tabBarItemIconColor={inactiveTintColor}
|
|
141
|
+
tabBarItemIconColorActive={activeTintColor}
|
|
142
|
+
tabBarItemTitleFontColor={inactiveTintColor}
|
|
143
|
+
tabBarItemTitleFontColorActive={activeTintColor}
|
|
144
|
+
tabBarItemTitleFontFamily={fontFamily}
|
|
145
|
+
tabBarItemTitleFontWeight={fontWeight}
|
|
146
|
+
tabBarItemTitleFontSize={fontSize}
|
|
147
|
+
tabBarItemTitleFontSizeActive={fontSize}
|
|
148
|
+
tabBarBackgroundColor={currentOptions.tabBarStyle?.backgroundColor}
|
|
149
|
+
tabBarItemActiveIndicatorColor={activeIndicatorColor}
|
|
150
|
+
tabBarItemActiveIndicatorEnabled={
|
|
151
|
+
currentOptions?.tabBarActiveIndicatorEnabled
|
|
152
|
+
}
|
|
153
|
+
tabBarItemRippleColor={currentOptions?.tabBarRippleColor}
|
|
154
|
+
experimentalControlNavigationStateInJS
|
|
155
|
+
onNativeFocusChange={(e) => {
|
|
156
|
+
const route = state.routes.find(
|
|
157
|
+
(route) => route.key === e.nativeEvent.tabKey
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
if (route) {
|
|
161
|
+
const isFocused =
|
|
162
|
+
state.index ===
|
|
163
|
+
state.routes.findIndex((r) => r.key === route.key);
|
|
164
|
+
|
|
165
|
+
const event = navigation.emit({
|
|
166
|
+
type: 'tabPress',
|
|
167
|
+
target: route.key,
|
|
168
|
+
canPreventDefault: true,
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
if (!isFocused && !event.defaultPrevented) {
|
|
172
|
+
React.startTransition(() => {
|
|
173
|
+
navigation.dispatch({
|
|
174
|
+
...CommonActions.navigate(route.name, route.params),
|
|
175
|
+
target: state.key,
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
{state.routes.map((route, index) => {
|
|
183
|
+
const { options, render, navigation } = descriptors[route.key];
|
|
184
|
+
const isFocused = state.index === index;
|
|
185
|
+
const isPreloaded = state.preloadedRouteKeys.includes(route.key);
|
|
186
|
+
|
|
187
|
+
const {
|
|
188
|
+
title,
|
|
189
|
+
lazy = true,
|
|
190
|
+
tabBarLabel,
|
|
191
|
+
tabBarBadgeStyle,
|
|
192
|
+
tabBarIcon,
|
|
193
|
+
tabBarBadge,
|
|
194
|
+
tabBarSystemItem,
|
|
195
|
+
} = options;
|
|
196
|
+
|
|
197
|
+
const tabTitle =
|
|
198
|
+
// On iOS, `systemItem` already provides a localized label
|
|
199
|
+
// So we should only use `tabBarLabel` if explicitly provided
|
|
200
|
+
Platform.OS === 'ios' && tabBarSystemItem != null
|
|
201
|
+
? tabBarLabel
|
|
202
|
+
: getLabel({ label: tabBarLabel, title }, route.name);
|
|
203
|
+
|
|
204
|
+
const tabItemAppearance: BottomTabsScreenItemStateAppearance = {
|
|
205
|
+
tabBarItemTitleFontFamily: fontFamily,
|
|
206
|
+
tabBarItemTitleFontSize: fontSize,
|
|
207
|
+
tabBarItemTitleFontWeight: fontWeight,
|
|
208
|
+
tabBarItemTitleFontStyle: fontStyle,
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const badgeBackgroundColor =
|
|
212
|
+
tabBarBadgeStyle?.backgroundColor ?? colors.notification;
|
|
213
|
+
const badgeTextColor =
|
|
214
|
+
typeof badgeBackgroundColor === 'string' &&
|
|
215
|
+
Color(badgeBackgroundColor)?.isLight()
|
|
216
|
+
? 'black'
|
|
217
|
+
: 'white';
|
|
218
|
+
|
|
219
|
+
const icon =
|
|
220
|
+
typeof tabBarIcon === 'function'
|
|
221
|
+
? getPlatformIcon(tabBarIcon({ focused: false }))
|
|
222
|
+
: tabBarIcon != null
|
|
223
|
+
? getPlatformIcon(tabBarIcon)
|
|
224
|
+
: undefined;
|
|
225
|
+
|
|
226
|
+
const selectedIcon =
|
|
227
|
+
typeof tabBarIcon === 'function'
|
|
228
|
+
? getPlatformIcon(tabBarIcon({ focused: true }))
|
|
229
|
+
: undefined;
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<BottomTabsScreen
|
|
233
|
+
onWillDisappear={() =>
|
|
234
|
+
onTransitionStart({ closing: true, route })
|
|
235
|
+
}
|
|
236
|
+
onWillAppear={() => onTransitionStart({ closing: false, route })}
|
|
237
|
+
onDidAppear={() => onTransitionEnd({ closing: false, route })}
|
|
238
|
+
onDidDisappear={() => onTransitionEnd({ closing: true, route })}
|
|
239
|
+
key={route.key}
|
|
240
|
+
tabKey={route.key}
|
|
241
|
+
icon={icon}
|
|
242
|
+
selectedIcon={selectedIcon?.ios ?? selectedIcon?.shared}
|
|
243
|
+
tabBarItemBadgeBackgroundColor={badgeBackgroundColor}
|
|
244
|
+
tabBarItemBadgeTextColor={badgeTextColor}
|
|
245
|
+
badgeValue={tabBarBadge?.toString()}
|
|
246
|
+
systemItem={tabBarSystemItem}
|
|
247
|
+
isFocused={isFocused}
|
|
248
|
+
title={tabTitle}
|
|
249
|
+
standardAppearance={{
|
|
250
|
+
tabBarBackgroundColor,
|
|
251
|
+
tabBarShadowColor,
|
|
252
|
+
stacked: {
|
|
253
|
+
normal: tabItemAppearance,
|
|
254
|
+
},
|
|
255
|
+
inline: {
|
|
256
|
+
normal: tabItemAppearance,
|
|
257
|
+
},
|
|
258
|
+
compactInline: {
|
|
259
|
+
normal: tabItemAppearance,
|
|
260
|
+
},
|
|
261
|
+
}}
|
|
262
|
+
>
|
|
263
|
+
<Lazy
|
|
264
|
+
enabled={lazy ? isFocused || isPreloaded : true}
|
|
265
|
+
render={() => (
|
|
266
|
+
<NativeScreen
|
|
267
|
+
route={route}
|
|
268
|
+
navigation={navigation}
|
|
269
|
+
options={options}
|
|
270
|
+
>
|
|
271
|
+
{render()}
|
|
272
|
+
</NativeScreen>
|
|
273
|
+
)}
|
|
274
|
+
/>
|
|
275
|
+
</BottomTabsScreen>
|
|
276
|
+
);
|
|
277
|
+
})}
|
|
278
|
+
</BottomTabs>
|
|
279
|
+
</SafeAreaProviderCompat>
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function getPlatformIcon(icon: Icon): PlatformIcon {
|
|
284
|
+
return {
|
|
285
|
+
ios:
|
|
286
|
+
icon?.type === 'sfSymbol'
|
|
287
|
+
? icon
|
|
288
|
+
: icon?.type === 'image' && icon.tinted !== false
|
|
289
|
+
? {
|
|
290
|
+
type: 'templateSource',
|
|
291
|
+
templateSource: icon.source,
|
|
292
|
+
}
|
|
293
|
+
: undefined,
|
|
294
|
+
android: icon?.type === 'drawableResource' ? icon : undefined,
|
|
295
|
+
shared:
|
|
296
|
+
icon?.type === 'image'
|
|
297
|
+
? {
|
|
298
|
+
type: 'imageSource',
|
|
299
|
+
imageSource: icon.source,
|
|
300
|
+
}
|
|
301
|
+
: undefined,
|
|
302
|
+
} as const;
|
|
303
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ParamListBase,
|
|
3
|
+
type TabNavigationState,
|
|
4
|
+
} from '@react-navigation/native';
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
NativeBottomTabDescriptorMap,
|
|
8
|
+
NativeBottomTabNavigationConfig,
|
|
9
|
+
NativeBottomTabNavigationHelpers,
|
|
10
|
+
} from './types';
|
|
11
|
+
|
|
12
|
+
type Props = NativeBottomTabNavigationConfig & {
|
|
13
|
+
state: TabNavigationState<ParamListBase>;
|
|
14
|
+
navigation: NativeBottomTabNavigationHelpers;
|
|
15
|
+
descriptors: NativeBottomTabDescriptorMap;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function NativeBottomTabView(_: Props) {
|
|
19
|
+
throw new Error('Native Bottom Tabs are not supported on this platform.');
|
|
20
|
+
}
|