Advertisement
Guest User

Untitled

a guest
Feb 26th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. // Root.js - part of my code
  2. <Provider {...stores}>
  3. <MainStack
  4. ref={ref => {
  5. if (ref) {
  6. AppStore.setMainNavigationRef(ref)
  7. // this.navigation_ref = ref._navigation
  8. }
  9. }}
  10. />
  11. </Provider>
  12.  
  13.  
  14. // AppStore (I'm using with mobx)
  15. @action setMainNavigationRef(main_navigation_ref) {
  16. this.main_navigation_ref = main_navigation_ref
  17. console.log('setMainNavigationRef', main_navigation_ref)
  18.  
  19. }
  20.  
  21. resetMainStack(routeName, params) {
  22. this.main_navigation_ref.dispatch(
  23. StackActions.reset({
  24. index: 0,
  25. actions: [
  26. NavigationActions.navigate({
  27. routeName,
  28. params,
  29. }),
  30. ],
  31. })
  32. );
  33. }
  34. }
  35.  
  36.  
  37. // UserProfile (child of tabStack)
  38.  
  39. resetStack = () => {
  40. this.props.AppStore.resetMainStack('Auth', null)
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement