// gets the current screen from navigation statefunctiongetCurrentRouteName(navigationState){if(!navigationState){returnnull;}const route = navigationState.routes[navigationState.index];// dive into nested navigatorsif(route.routes){returngetCurrentRouteName(route);}return route.routeName;}