1- import type {
2- DefaultNavigatorOptions ,
3- ParamListBase ,
4- TabActionHelpers ,
5- TabNavigationState ,
6- TabRouterOptions ,
7- } from '@react-navigation/native' ;
81import {
9- TabRouter ,
102 createNavigatorFactory ,
3+ type DefaultNavigatorOptions ,
4+ type NavigatorTypeBagBase ,
5+ type ParamListBase ,
6+ type StaticConfig ,
7+ type TabActionHelpers ,
8+ type TabNavigationState ,
9+ TabRouter ,
10+ type TabRouterOptions ,
11+ type TypedNavigator ,
1112 useNavigationBuilder ,
1213 useTheme ,
1314} from '@react-navigation/native' ;
@@ -17,14 +18,17 @@ import type {
1718 NativeBottomTabNavigationConfig ,
1819 NativeBottomTabNavigationEventMap ,
1920 NativeBottomTabNavigationOptions ,
21+ NativeBottomTabNavigationProp ,
2022} from '../types' ;
2123import NativeBottomTabView from '../views/NativeBottomTabView' ;
2224
2325export type NativeBottomTabNavigatorProps = DefaultNavigatorOptions <
2426 ParamListBase ,
27+ string | undefined ,
2528 TabNavigationState < ParamListBase > ,
2629 NativeBottomTabNavigationOptions ,
27- NativeBottomTabNavigationEventMap
30+ NativeBottomTabNavigationEventMap ,
31+ NativeBottomTabNavigationProp < ParamListBase >
2832> &
2933 TabRouterOptions &
3034 NativeBottomTabNavigationConfig ;
@@ -34,10 +38,12 @@ function NativeBottomTabNavigator({
3438 initialRouteName,
3539 backBehavior,
3640 children,
41+ layout,
3742 screenListeners,
3843 screenOptions,
3944 tabBarActiveTintColor : customActiveTintColor ,
4045 tabBarInactiveTintColor : customInactiveTintColor ,
46+ UNSTABLE_getStateForRouteNamesChange,
4147 ...rest
4248} : NativeBottomTabNavigatorProps ) {
4349 const { colors } = useTheme ( ) ;
@@ -63,8 +69,10 @@ function NativeBottomTabNavigator({
6369 initialRouteName,
6470 backBehavior,
6571 children,
72+ layout,
6673 screenListeners,
6774 screenOptions,
75+ UNSTABLE_getStateForRouteNamesChange,
6876 } ) ;
6977
7078 return (
@@ -81,9 +89,25 @@ function NativeBottomTabNavigator({
8189 ) ;
8290}
8391
84- export default createNavigatorFactory <
85- TabNavigationState < ParamListBase > ,
86- NativeBottomTabNavigationOptions ,
87- NativeBottomTabNavigationEventMap ,
88- typeof NativeBottomTabNavigator
89- > ( NativeBottomTabNavigator ) ;
92+ export default function createNativeBottomTabNavigator <
93+ const ParamList extends ParamListBase ,
94+ const NavigatorID extends string | undefined = undefined ,
95+ const TypeBag extends NavigatorTypeBagBase = {
96+ ParamList : ParamList ;
97+ NavigatorID : NavigatorID ;
98+ State : TabNavigationState < ParamList > ;
99+ ScreenOptions : NativeBottomTabNavigationOptions ;
100+ EventMap : NativeBottomTabNavigationEventMap ;
101+ NavigationList : {
102+ [ RouteName in keyof ParamList ] : NativeBottomTabNavigationProp <
103+ ParamList ,
104+ RouteName ,
105+ NavigatorID
106+ > ;
107+ } ;
108+ Navigator : typeof NativeBottomTabNavigator ;
109+ } ,
110+ const Config extends StaticConfig < TypeBag > = StaticConfig < TypeBag > ,
111+ > ( config ?: Config ) : TypedNavigator < TypeBag , Config > {
112+ return createNavigatorFactory ( NativeBottomTabNavigator ) ( config ) ;
113+ }
0 commit comments