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

Fix useNavigation params typing #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Aure77
Copy link

@Aure77 Aure77 commented Nov 18, 2019

This fix #49

@slorber
Copy link
Member

slorber commented Nov 18, 2019

That was fast 👍

@@ -17,7 +17,10 @@ import {
EventType,
} from 'react-navigation';

export function useNavigation<S>(): NavigationScreenProp<S & NavigationRoute> {
export function useNavigation<S, P = NavigationParams>(): NavigationScreenProp<
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good for the specific usecase of params, but for #42 we should also probably remove the hardcoded "NavigationScreenProp" reference because it won't expose the custom navigator actions (like popToTop etc)

I prefer to have one PR fix both the params usecase and custom navigator actions usecases, because if we release a fix for #42 later, we're probably going to break the TS types retrocompatibility so it's likely to be annoying for the users.

Copy link
Member

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd rather fix #42 as well, otherwise we'll need to make a breaking change later when fixing #42 (which is likely to annoy you btw because the generics won't work the same way)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I can't define NavigationParams types with useNavigation
3 participants