Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript error: .openDrawer() does not exist on type 'NavigationProp' #1

Closed
batjko opened this issue Aug 24, 2021 · 3 comments · Fixed by #2
Closed

Typescript error: .openDrawer() does not exist on type 'NavigationProp' #1

batjko opened this issue Aug 24, 2021 · 3 comments · Fixed by #2

Comments

@batjko
Copy link
Contributor

batjko commented Aug 24, 2021

Hi,

I am using Typescript in my project (react-navigation comes with types out of the box), but otherwise followed your instructions to the letter.

It all works fine in the emulator, too. 🥳
But it's worth noting that there seems to be a missing prop for the useNavigation hook.
It's not an issue with your code, just with react-navigation, it seems, which people using Typescript will notice when following your video, so i thought I register it here for others to find.

image

These are the props the navigation comes with:

image

For reference, there is a related issue on the react-native repo: react-navigation/hooks#42

@batjko
Copy link
Contributor Author

batjko commented Aug 24, 2021

I just found that this comment has the right solution: react-navigation/react-navigation#6592 (comment)

Apparently, the openDrawer() method now exists on the @react-navigation/native package, and needs to be dispatched by the navigation hook.

So this works:

image

@ghost
Copy link

ghost commented Sep 16, 2021

Thank you @batjko

@parmarravi
Copy link

Close drawer do not work with this method

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants