Common navigation actions for direct use with react-navigation.
If you use yarn:
yarn add react-navigation-actions
If you use npm:
npm install --save react-navigation-actions
Override getStateForAction of your Navigator to be able to use the new actions.
;; const Navigator = screens navigatorConfig;NavigatorroutergetStateForAction = ;
react-navigation-actions provides simple action creators, which you can dispatch in navigation-aware components.
; // inside your navigation-aware component:thispropsnavigation;
Until now this library is only tested with StackNavigator. Nested navigators are also not tested yet. If you encounter problems feel free to open a pull request.
Available action creators
Discard the complete navigation stack of your router and show the route defined by
routeName and optional
Go back n routes in one step. If there are not enough routes to go back in the stack, this action is ignored.
Replace the current route with the route defined by
routeName and the optional
Contributions are welcome. Just open a pull request.