Skip to content

Incorrect types for createMaterialBottomTabNavigatorΒ #4572

@ChromeQ

Description

@ChromeQ

Current behaviour

The types are incorrect when creating a material bottom tab navigator:

import { createMaterialBottomTabNavigator } from 'react-native-paper/react-navigation';

const TabNavigation = createMaterialBottomTabNavigator<TabStackParamList>(); // Type of TabNavigation is `any`

This makes it impossible to get typescript support when trying to add config or options to the TabNavigation.Navigator:

Looking at the types there are issues with the createNavigatorFactory and DefaultNavigatorOptions generics in this file: https://github.com/callstack/react-native-paper/blob/main/src/react-navigation/navigators/createMaterialBottomTabNavigator.tsx

The createNavigatorFactory does not expect any generic arguments and DefaultNavigatorOptions expects 6 but only 4 are provided.
The issues is also createNavigatorFactory comes from @react-navigation/[email protected] and the type there is actually any

Expected behaviour

I expect to get typescript intellisense when using the TabNavigation returned from createMaterialBottomTabNavigator

Preview

Image

Your Environment

software version
ios x
android x
react-native 0.76.3
react-native-paper 5.12.5
node x.x.x
npm or yarn [email protected]
expo sdk 52.0.14

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions