mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-29 04:45:19 +08:00
feat: improve types for navigation state (#8980)
The commit improves the navigation state object to have more specific types. e.g. The `routeNames` array will now have proper type instead of `string[]`
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
TabRouter,
|
||||
TabRouterOptions,
|
||||
TabNavigationState,
|
||||
ParamListBase,
|
||||
} from '@react-navigation/native';
|
||||
import createCompatNavigatorFactory from './createCompatNavigatorFactory';
|
||||
|
||||
@@ -12,7 +13,7 @@ type Props = DefaultNavigatorOptions<{}> & TabRouterOptions;
|
||||
|
||||
function SwitchNavigator(props: Props) {
|
||||
const { state, descriptors } = useNavigationBuilder<
|
||||
TabNavigationState,
|
||||
TabNavigationState<ParamListBase>,
|
||||
TabRouterOptions,
|
||||
{},
|
||||
{}
|
||||
@@ -22,7 +23,10 @@ function SwitchNavigator(props: Props) {
|
||||
}
|
||||
|
||||
export default createCompatNavigatorFactory(
|
||||
createNavigatorFactory<TabNavigationState, {}, {}, typeof SwitchNavigator>(
|
||||
SwitchNavigator
|
||||
)
|
||||
createNavigatorFactory<
|
||||
TabNavigationState<ParamListBase>,
|
||||
{},
|
||||
{},
|
||||
typeof SwitchNavigator
|
||||
>(SwitchNavigator)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user