{"action":"created","issue":{"url":"https://api.github.com/repos/react-community/react-navigation/issues/325","repository_url":"https://api.github.com/repos/react-community/react-navigation","labels_url":"https://api.github.com/repos/react-community/react-navigation/issues/325/labels{/name}","comments_url":"https://api.github.com/repos/react-community/react-navigation/issues/325/comments","events_url":"https://api.github.com/repos/react-community/react-navigation/issues/325/events","html_url":"https://github.com/react-community/react-navigation/issues/325","id":207353480,"number":325,"title":"Problem understanding the reset action","user":{"login":"jhilden","id":69657,"avatar_url":"https://avatars1.githubusercontent.com/u/69657?v=3","gravatar_id":"","url":"https://api.github.com/users/jhilden","html_url":"https://github.com/jhilden","followers_url":"https://api.github.com/users/jhilden/followers","following_url":"https://api.github.com/users/jhilden/following{/other_user}","gists_url":"https://api.github.com/users/jhilden/gists{/gist_id}","starred_url":"https://api.github.com/users/jhilden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhilden/subscriptions","organizations_url":"https://api.github.com/users/jhilden/orgs","repos_url":"https://api.github.com/users/jhilden/repos","events_url":"https://api.github.com/users/jhilden/events{/privacy}","received_events_url":"https://api.github.com/users/jhilden/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2017-02-13T22:05:43Z","updated_at":"2017-05-09T07:46:47Z","closed_at":null,"body":"I have the use case that I want to wipe the complete navigation history on user logout inside my react native app (with some nested navigators).  It seems like the `Reset` action would be the way to go, and that's what I have tried, but without luck so far. My problem is that I don't really understand from the [documentation](https://reactnavigation.org/docs/navigators/navigation-prop#Reset) how exactly the `Reset` action works and how it is supposed to be used.  I would like to understand it and to help writing better documentation for the next developer. What exactly is the `index` parameter for? How does the Reset action relate to nested navigators? Any general input on that would be highly appreciated.\r\n\r\n----\r\n\r\nConcerning my concrete logout use case, here is my relevant code:\r\n\r\n```\r\nconst MainNavigation = StackNavigator({\r\n  Main: { screen: MainTabNavigation },\r\n  Login: { screen: LoginView }\r\n}\r\n\r\nconst MainTabNavigation = TabNavigator({\r\n  Dashboard: { screen: DashboardView }\r\n})\r\n\r\nclass DashboardView extends React.Component {\r\n  logout () {\r\n    this.props.navigation.dispatch({\r\n      type: NavigationActions.NAVIGATE,\r\n      routeName: 'Login',\r\n      action: {\r\n        type: NavigationActions.RESET,\r\n        index: 0,\r\n        actions: [{type: NavigationActions.NAVIGATE, routeName: 'Login'}]\r\n      }\r\n    })\r\n  }\r\n}\r\n```\r\n\r\nThis does navigate to the Login view correctly, however it does **not** clear the navigation history, so when the user clicks e.g. the back button she ends up back on the logged out Dashboard."},"comment":{"url":"https://api.github.com/repos/react-community/react-navigation/issues/comments/300087797","html_url":"https://github.com/react-community/react-navigation/issues/325#issuecomment-300087797","issue_url":"https://api.github.com/repos/react-community/react-navigation/issues/325","id":300087797,"user":{"login":"laclance","id":10835285,"avatar_url":"https://avatars1.githubusercontent.com/u/10835285?v=3","gravatar_id":"","url":"https://api.github.com/users/laclance","html_url":"https://github.com/laclance","followers_url":"https://api.github.com/users/laclance/followers","following_url":"https://api.github.com/users/laclance/following{/other_user}","gists_url":"https://api.github.com/users/laclance/gists{/gist_id}","starred_url":"https://api.github.com/users/laclance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laclance/subscriptions","organizations_url":"https://api.github.com/users/laclance/orgs","repos_url":"https://api.github.com/users/laclance/repos","events_url":"https://api.github.com/users/laclance/events{/privacy}","received_events_url":"https://api.github.com/users/laclance/received_events","type":"User","site_admin":false},"created_at":"2017-05-09T07:46:47Z","updated_at":"2017-05-09T07:46:47Z","body":"This works for me however its shows the goBack animations for every screen in between"}}
{"actor":{"display_login":"laclance"}}