Advertisement
Guest User

NavigationService

a guest
Oct 16th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import { NavigationActions } from 'react-navigation';
  2.  
  3. let _navigator;
  4.  
  5. function setTopLevelNavigator(navigatorRef) {
  6. _navigator = navigatorRef;
  7. }
  8.  
  9. function navigate(routeName, params) {
  10. _navigator.dispatch(
  11. NavigationActions.navigate({
  12. routeName,
  13. params,
  14. })
  15. );
  16. }
  17.  
  18. // add other navigation functions that you need and export them
  19.  
  20. export default {
  21. navigate,
  22. setTopLevelNavigator,
  23. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement