0

I wrote a function to return me the current route name but the problem is it only returns a stack navigation

 getActiveRouteState = function (route) {
    if (
      !route.routes ||
      route.routes.length === 0 ||
      route.index >= route.routes.length
    ) {
      return route;
    }

    const childActiveRoute = route.routes[route.index];
    return this.getActiveRouteState(childActiveRoute);
  };

is there any way I can get the current screen name with its tab navigation

  • Does this answer your question? [How to get current route name in react-navigation?](https://stackoverflow.com/questions/53040094/how-to-get-current-route-name-in-react-navigation) – Ahmet Firat Keler Jun 27 '22 at 18:48
  • i am using "@react-navigation/bottom-tabs": "^6.2.0" most of answers give like this.props.navigation.state.routeName return undefined – ubaidh khatlani Jun 27 '22 at 19:03
  • How about that? https://stackoverflow.com/questions/55198988/get-the-current-active-screen-route-of-the-tab-navigator-in-react-navigation – Ahmet Firat Keler Jun 27 '22 at 19:11

0 Answers0