Skip to content
This repository was archived by the owner on Dec 3, 2022. It is now read-only.
This repository was archived by the owner on Dec 3, 2022. It is now read-only.

I can't define NavigationParams types with useNavigation #49

Closed
@Aure77

Description

@Aure77

There is a way to define navigation params typing on useNavigation with typescript ?

  const navigation = useNavigation<{ params: { title: string } }>();
  const title = navigation.getParam("title"); // title is inferred as "any" not "string"...

This is not working useNavigation because of this (P default value/type) :

export interface NavigationScreenProp<S, P = NavigationParams> {
  state: S & { params?: P };
...

there is no access to optional second type on NavigationScreenProp...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions