Skip to content
Advertisement

TypeError: Cannot read property ‘navigate’ of undefine

Good evening to y’all!!

I’m trying to click my “login or register button” but I’m receiving the following error: “TypeError: Cannot read property ‘navigate’ of undefined”

I tried to do small changes within the project but no joy 🙁

JavaScript

This is my login screen

JavaScript

Maybe it is something simple but I can’t figure it out.

Anyone, to help? Thank you

My Welcome Screen

JavaScript

From Console

JavaScript

Advertisement

Answer

It seems like WelcomeScreen isn’t inside of the navigator the passes down navigation as props. If you’re using react-navigation 5.x you can use the hook:

JavaScript

https://reactnavigation.org/docs/use-navigation/

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement