CommonActions

요약
navigate, reset, goBack, setParams

1) reset

  • 네비게이션 상태 변경
  • 라우터와 페이지 구성 상태를 원하는대로 수정 가능
  • 키 없이 새로운 상태를 제공하면 기존 화면 제거됨.
    • The state object specified in reset replaces the existing navigation state with the new one. This means that if you provide new route objects without a key, or route objects with a different key, it'll remove the existing screens for those routes and add new screens.
       

예시 코드

  • 기능 사용중 로그아웃 버튼 클릭했을 때 스택 다 날리고 로그인 화면만 유지
navigation.dispatch( CommonActions.reset({ index: 1, routes: [ { name: 'Login' } ] }) )