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
Description
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
Labels
No labels