How to get current route name in react-navigation?

Eshant Bist picture Eshant Bist · Oct 29, 2018 · Viewed 60.6k times · Source

I want the name of the current route or screen in react-navigation which I want to use inside if condition to make some changes.

Answer

Hussam Kurd picture Hussam Kurd · Jan 19, 2019

You can catch it as the following code:

this.props.navigation.state.routeName