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:
Satyajit Sahoo
2020-10-23 17:06:31 +02:00
committed by GitHub
parent 8ec6c1a603
commit 7dc2f5832e
25 changed files with 144 additions and 101 deletions

View File

@@ -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)
);